public static Sequenz loadFromFIle(Boolean loadLast) { if (new FileInfo(Properties.Settings.Default.lastProfile).Exists&& loadLast) { try { Sequenz sequenz = XMLHelper.DeSerializeObject <Sequenz>(Properties.Settings.Default.lastProfile); return(sequenz); } catch (Exception e) { MessageBox.Show(e.Message, "Could not load last profile, created new one"); } } SaveFileDialog sfd = new SaveFileDialog(); sfd.FileName = "xmlanimation.xml"; if (sfd.ShowDialog() == System.Windows.Forms.DialogResult.OK) { Properties.Settings.Default.lastProfile = sfd.FileName; Properties.Settings.Default.Save(); } return(Sequenz.initNew()); }
private static Sequenz initNew() { Sequenz newSequenz = new Sequenz(); newSequenz.steps = new List <Step>(); newSequenz.steps.Add(new Step()); return(newSequenz); }
public static void save(bool saveas, Sequenz sequenz) { if (saveas) { SaveFileDialog sfd = new SaveFileDialog(); sfd.FileName = "xmlanimation.xml"; if (sfd.ShowDialog() == System.Windows.Forms.DialogResult.OK) { Properties.Settings.Default.lastProfile = sfd.FileName; Properties.Settings.Default.Save(); } } if (MessageBox.Show("Save to " + Properties.Settings.Default.lastProfile, "Save", MessageBoxButtons.OKCancel) == System.Windows.Forms.DialogResult.OK) { XMLHelper.SerializeObject <Sequenz>(sequenz, Properties.Settings.Default.lastProfile); } }
private void bSaveAs_Click(object sender, EventArgs e) { Sequenz.save(true, sequenz); }
private void bSave_Click(object sender, EventArgs e) { Sequenz.save(false, sequenz); }
private void bLoad_Click(object sender, EventArgs e) { Sequenz.loadFromFIle(false); }
private void Form1_FormClosing(object sender, FormClosingEventArgs e) { Sequenz.save(false, sequenz); }
private void Form1_Load(object sender, EventArgs e) { sequenz = Sequenz.loadFromFIle(true); update(); }