Ajout dialogue sauvegarde et declaration des fonctions
This commit is contained in:
parent
453b8ddd1a
commit
aaa450523a
8 changed files with 101 additions and 10 deletions
|
|
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
|||
using System.Diagnostics;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Threading;
|
||||
using System.Xml;
|
||||
|
||||
|
||||
namespace DMX2
|
||||
|
|
@ -179,6 +180,25 @@ namespace DMX2
|
|||
}
|
||||
#endregion
|
||||
|
||||
#region Sauvegarde
|
||||
|
||||
public XmlDocument Save ()
|
||||
{
|
||||
XmlDocument doc = new XmlDocument();
|
||||
|
||||
|
||||
|
||||
|
||||
return doc;
|
||||
}
|
||||
|
||||
public static Conduite Load (XmlDocument doc)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ using System;
|
|||
using Gtk;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
|
||||
|
||||
namespace DMX2
|
||||
|
|
@ -10,7 +11,8 @@ namespace DMX2
|
|||
{
|
||||
static MainWindow win;
|
||||
static object circuitKey = new object();
|
||||
ListStore lsMatrice;
|
||||
ListStore lsMatrice = null;
|
||||
FileInfo conduiteFile=null;
|
||||
|
||||
public static MainWindow Win {
|
||||
get { return win; }
|
||||
|
|
@ -338,7 +340,51 @@ namespace DMX2
|
|||
|
||||
}
|
||||
|
||||
protected void OnSaveActionActivated (object sender, EventArgs e)
|
||||
{
|
||||
if(conduiteFile==null)
|
||||
SaveFileAs();
|
||||
else
|
||||
SaveFile();
|
||||
}
|
||||
|
||||
protected void OnSaveAsActionActivated (object sender, EventArgs e)
|
||||
{
|
||||
SaveFileAs();
|
||||
}
|
||||
|
||||
void SaveFileAs ()
|
||||
{
|
||||
FileChooserDialog fcd = new FileChooserDialog("Sauver sous ...",this,FileChooserAction.Save,
|
||||
"Annuler",ResponseType.Cancel,
|
||||
"Ouvrir",ResponseType.Accept);
|
||||
|
||||
fcd.Filter = new FileFilter();
|
||||
|
||||
fcd.Filter.AddPattern("*.dmx2");
|
||||
|
||||
if ((ResponseType)fcd.Run() == ResponseType.Cancel)
|
||||
{
|
||||
fcd.Destroy();
|
||||
return;
|
||||
}
|
||||
string file = fcd.Filename;
|
||||
|
||||
if(!file.EndsWith(".dmx2"))
|
||||
file+=".dmx2";
|
||||
|
||||
conduiteFile = new FileInfo(fcd.Filename);
|
||||
if (conduiteFile.Exists);
|
||||
|
||||
|
||||
fcd.Destroy();
|
||||
|
||||
}
|
||||
|
||||
void SaveFile()
|
||||
{
|
||||
if(conduiteFile==null)return;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -371,7 +371,6 @@ namespace DMX2
|
|||
|
||||
protected void OnSeqMasterScaleValueChanged (object sender, EventArgs e)
|
||||
{
|
||||
|
||||
if (fullUpdFlag)return;
|
||||
sequenceur.Master = (int)(seqMasterScale.Value);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -54,7 +54,10 @@ namespace DMX2
|
|||
{
|
||||
}
|
||||
|
||||
public abstract XmlElement Save();
|
||||
public abstract XmlElement Save ();
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Xml;
|
||||
|
||||
namespace DMX2
|
||||
{
|
||||
|
|
@ -55,5 +56,17 @@ namespace DMX2
|
|||
{
|
||||
lignes.Add(new Ligne());
|
||||
}
|
||||
|
||||
public XmlElement Save ()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public static SequenceurMaitre Load (XmlElement doc)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Xml;
|
||||
|
||||
namespace DMX2
|
||||
{
|
||||
|
|
@ -52,12 +53,6 @@ namespace DMX2
|
|||
}
|
||||
}
|
||||
|
||||
public void Save ()
|
||||
{
|
||||
}
|
||||
public void Load ()
|
||||
{
|
||||
}
|
||||
|
||||
public void CalculUnivers(byte[] valeurs, int offset, int count)
|
||||
{
|
||||
|
|
@ -89,6 +84,17 @@ namespace DMX2
|
|||
}
|
||||
}
|
||||
|
||||
public XmlElement Save ()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public static UniversDMX Load (XmlElement doc)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -375,6 +375,8 @@ namespace DMX2
|
|||
this.DefaultHeight = 709;
|
||||
this.Show ();
|
||||
this.DeleteEvent += new global::Gtk.DeleteEventHandler (this.OnDeleteEvent);
|
||||
this.saveAction.Activated += new global::System.EventHandler (this.OnSaveActionActivated);
|
||||
this.saveAsAction.Activated += new global::System.EventHandler (this.OnSaveAsActionActivated);
|
||||
this.quitAction.Activated += new global::System.EventHandler (this.OnQuitActionActivated);
|
||||
this.closeAction.Activated += new global::System.EventHandler (this.OnCloseActionActivated);
|
||||
this.circAction.Activated += new global::System.EventHandler (this.OnCircuitsActionActivated);
|
||||
|
|
|
|||
|
|
@ -75,12 +75,14 @@
|
|||
<property name="Label" translatable="yes" />
|
||||
<property name="Sensitive">False</property>
|
||||
<property name="StockId">gtk-save</property>
|
||||
<signal name="Activated" handler="OnSaveActionActivated" />
|
||||
</action>
|
||||
<action id="saveAsAction">
|
||||
<property name="Type">Action</property>
|
||||
<property name="Label" translatable="yes" />
|
||||
<property name="Sensitive">False</property>
|
||||
<property name="StockId">gtk-save-as</property>
|
||||
<signal name="Activated" handler="OnSaveAsActionActivated" />
|
||||
</action>
|
||||
<action id="quitAction">
|
||||
<property name="Type">Action</property>
|
||||
|
|
|
|||
Loading…
Reference in a new issue