예제 #1
0
        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());
        }
예제 #2
0
        private static Sequenz initNew()
        {
            Sequenz newSequenz = new Sequenz();

            newSequenz.steps = new List <Step>();
            newSequenz.steps.Add(new Step());

            return(newSequenz);
        }
예제 #3
0
        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);
            }
        }
예제 #4
0
 private void bSaveAs_Click(object sender, EventArgs e)
 {
     Sequenz.save(true, sequenz);
 }
예제 #5
0
 private void bSave_Click(object sender, EventArgs e)
 {
     Sequenz.save(false, sequenz);
 }
예제 #6
0
 private void bLoad_Click(object sender, EventArgs e)
 {
     Sequenz.loadFromFIle(false);
 }
예제 #7
0
 private void Form1_FormClosing(object sender, FormClosingEventArgs e)
 {
     Sequenz.save(false, sequenz);
 }
예제 #8
0
 private void Form1_Load(object sender, EventArgs e)
 {
     sequenz = Sequenz.loadFromFIle(true);
     update();
 }