Ejemplo n.º 1
0
        private void restoreOEForms()
        {
            string        tempPath2 = Application.StartupPath + "/temp2";
            DirectoryInfo d2        = new DirectoryInfo(tempPath2);//Assuming Test is your Folder


            FileInfo[] Files2 = d2.GetFiles("*.xml"); //Getting Text files
            foreach (FileInfo file in Files2)
            {
                using (StreamReader streamReader = new StreamReader(file.FullName, Encoding.UTF8))
                {
                    string    props    = streamReader.ReadToEnd();
                    FormProps formprop = FormProps.ConvertFromXMLString(props);
                    oe_gen    oe       = new oe_gen(formprop);

                    oe.ShowForm();
                }
            }
            formsRestoredOE = true;
            foreach (FileInfo file in Files2)
            {
                if (File.Exists(file.FullName))
                {
                    File.Delete(file.FullName);
                }
            }
        }
Ejemplo n.º 2
0
        private void oEFormToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (!formsRestoredOE)
            {
                string        tempPath = Application.StartupPath + "/temp2";
                DirectoryInfo d2       = new DirectoryInfo(tempPath);//Assuming Test is your Folder

                if (d2.GetFiles("*.xml").Any())
                {
                    if (MessageBox.Show("Do you want to load previous OE session?", Text, MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes)
                    {
                        restoreOEForms();
                    }
                    else
                    {
                        FileInfo[] Files2 = d2.GetFiles("*.xml"); //Getting Text files

                        foreach (FileInfo file in Files2)
                        {
                            if (File.Exists(file.FullName))
                            {
                                File.Delete(file.FullName);
                            }
                        }

                        oe_gen oe = new oe_gen();

                        oe.ShowForm();

                        formsRestoredOE = true;
                    }
                }
                else
                {
                    oe_gen oe = new oe_gen();

                    oe.ShowForm();

                    formsRestoredOE = true;
                }
            }
            else
            {
                oe_gen oe = new oe_gen();

                oe.ShowForm();
            }
        }