ajout des updates
This commit is contained in:
parent
ddbc724475
commit
bca2a9ca33
6 changed files with 62 additions and 12 deletions
|
|
@ -1,11 +1,11 @@
|
||||||
<Properties>
|
<Properties>
|
||||||
<MonoDevelop.Ide.Workspace ActiveConfiguration="Debug|x86" />
|
<MonoDevelop.Ide.Workspace ActiveConfiguration="Debug|x86" />
|
||||||
<MonoDevelop.Ide.Workbench ActiveDocument="DMX-2.0/SequenceurLineaire.cs">
|
<MonoDevelop.Ide.Workbench ActiveDocument="DMX-2.0/Conduite.cs">
|
||||||
<Files>
|
<Files>
|
||||||
<File FileName="DMX-2.0/SeqLinUI.cs" Line="127" Column="4" />
|
<File FileName="DMX-2.0/SeqLinUI.cs" Line="127" Column="4" />
|
||||||
<File FileName="DMX-2.0/MainWindow.cs" Line="98" Column="47" />
|
<File FileName="DMX-2.0/MainWindow.cs" Line="52" Column="51" />
|
||||||
<File FileName="DMX-2.0/SequenceurLineaire.cs" Line="69" Column="22" />
|
<File FileName="DMX-2.0/SequenceurLineaire.cs" Line="69" Column="22" />
|
||||||
<File FileName="DMX-2.0/Conduite.cs" Line="29" Column="17" />
|
<File FileName="DMX-2.0/Conduite.cs" Line="20" Column="24" />
|
||||||
<File FileName="DMX-2.0/Sequenceur.cs" Line="42" Column="4" />
|
<File FileName="DMX-2.0/Sequenceur.cs" Line="42" Column="4" />
|
||||||
</Files>
|
</Files>
|
||||||
</MonoDevelop.Ide.Workbench>
|
</MonoDevelop.Ide.Workbench>
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
|
using System.Threading;
|
||||||
|
|
||||||
|
|
||||||
namespace DMX2
|
namespace DMX2
|
||||||
|
|
@ -11,9 +12,12 @@ namespace DMX2
|
||||||
|
|
||||||
public static Conduite Courante = null;
|
public static Conduite Courante = null;
|
||||||
|
|
||||||
|
Timer timer = null;
|
||||||
|
|
||||||
public Conduite()
|
public Conduite()
|
||||||
{
|
{
|
||||||
|
timer = new Timer(new TimerCallback(TimerTick),this,
|
||||||
|
100,100);
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Circuit> circuits = new List<Circuit>();
|
List<Circuit> circuits = new List<Circuit>();
|
||||||
|
|
@ -87,7 +91,26 @@ namespace DMX2
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
disposed=true;
|
disposed=true;
|
||||||
// stop thread if running
|
if(timer!=null)
|
||||||
|
timer.Dispose();
|
||||||
|
timer=null;
|
||||||
|
}
|
||||||
|
|
||||||
|
static public void TimerTick (object state)
|
||||||
|
{
|
||||||
|
Conduite.Courante.Tick();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Tick ()
|
||||||
|
{
|
||||||
|
foreach (var c in Circuits) {
|
||||||
|
int val=0;
|
||||||
|
foreach (var seq in Sequenceurs) {
|
||||||
|
val = Math.Max(val, seq.ValeurCircuit(c));
|
||||||
|
}
|
||||||
|
c.ValeurCourante=val;
|
||||||
|
}
|
||||||
|
MainWindow.Win.ScheduleUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
#region IDisposable implementation
|
#region IDisposable implementation
|
||||||
|
|
|
||||||
|
|
@ -7,8 +7,14 @@ namespace DMX2
|
||||||
{
|
{
|
||||||
public partial class MainWindow: Gtk.Window
|
public partial class MainWindow: Gtk.Window
|
||||||
{
|
{
|
||||||
|
static MainWindow win;
|
||||||
|
public static MainWindow Win {
|
||||||
|
get { return win; }
|
||||||
|
}
|
||||||
|
|
||||||
public MainWindow (): base (Gtk.WindowType.Toplevel)
|
public MainWindow (): base (Gtk.WindowType.Toplevel)
|
||||||
{
|
{
|
||||||
|
win=this;
|
||||||
Build ();
|
Build ();
|
||||||
MajWidgets();
|
MajWidgets();
|
||||||
}
|
}
|
||||||
|
|
@ -26,6 +32,7 @@ namespace DMX2
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected void MajCircuits ()
|
protected void MajCircuits ()
|
||||||
{
|
{
|
||||||
// Ajoute une ProgressBar par circuit, met a jour le texte si necessaire
|
// Ajoute une ProgressBar par circuit, met a jour le texte si necessaire
|
||||||
|
|
@ -99,5 +106,22 @@ namespace DMX2
|
||||||
seqUiVbox.ShowAll();
|
seqUiVbox.ShowAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool updScheduled=false;
|
||||||
|
public void ScheduleUpdate ()
|
||||||
|
{
|
||||||
|
if(updScheduled) return;
|
||||||
|
updScheduled=true;
|
||||||
|
Gtk.Application.Invoke(new EventHandler(Update));
|
||||||
|
}
|
||||||
|
|
||||||
|
void Update (object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
foreach (var sequi in seqUiVbox.Children) {
|
||||||
|
(sequi as SequenceurUI).Update();
|
||||||
|
}
|
||||||
|
MajCircuits();
|
||||||
|
updScheduled=false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -113,7 +113,8 @@ namespace DMX2
|
||||||
xpos+=30;
|
xpos+=30;
|
||||||
if(lastKnownWidth < xpos +30)
|
if(lastKnownWidth < xpos +30)
|
||||||
{
|
{
|
||||||
xpos =10; ypos+= 215;
|
xpos = 10;
|
||||||
|
ypos += 215;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -124,12 +125,14 @@ namespace DMX2
|
||||||
{
|
{
|
||||||
VScale t = sender as VScale;
|
VScale t = sender as VScale;
|
||||||
Circuit c = t.Data[circuitKey] as Circuit;
|
Circuit c = t.Data[circuitKey] as Circuit;
|
||||||
|
sequenceur.ChangeValeur(c,(int)(t.Value));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void UpdateValues()
|
protected void UpdateValues()
|
||||||
{
|
{
|
||||||
|
foreach (Circuit c in tirettes.Keys) {
|
||||||
|
tirettes[c].Value = sequenceur.ValeurCircuit(c);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void OnZoneWidSizeAllocated (object o, SizeAllocatedArgs args)
|
protected void OnZoneWidSizeAllocated (object o, SizeAllocatedArgs args)
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ namespace DMX2
|
||||||
|
|
||||||
public abstract SequenceurUI GetUI();
|
public abstract SequenceurUI GetUI();
|
||||||
|
|
||||||
public abstract int EtatCircuit(Circuit c);
|
public abstract int ValeurCircuit(Circuit c);
|
||||||
public abstract void Tick(TimeSpan time);
|
public abstract void Tick(TimeSpan time);
|
||||||
public static Sequenceur Load(XmlElement el)
|
public static Sequenceur Load(XmlElement el)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -131,14 +131,14 @@ namespace DMX2
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override int EtatCircuit (Circuit c)
|
public override int ValeurCircuit (Circuit c)
|
||||||
{
|
{
|
||||||
if (!circuitsSeq.Contains (c))
|
if (!circuitsSeq.Contains (c))
|
||||||
return 0;
|
return 0;
|
||||||
return valeurscourantes [c];
|
return valeurscourantes [c];
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ChangeCircuit (Circuit c, int value)
|
public void ChangeValeur (Circuit c, int value)
|
||||||
{
|
{
|
||||||
valeurschangees [c] = true;
|
valeurschangees [c] = true;
|
||||||
valeurscourantes [c] = value;
|
valeurscourantes [c] = value;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue