コード例 #1
0
 /// <summary>
 /// Ruft ein neues DialogFenster zur Auswahl eines Backups auf
 /// </summary>
 private void RestoreButton_Click(object sender, EventArgs e)
 {
     //this.Hide();
     using (BackupRestoreGUI restoreDial = new BackupRestoreGUI(this))
     {
         restoreDial.ShowDialog();
         this.Show();
     }
 }
コード例 #2
0
        /// <summary>
        /// Spielt ein gespeichertes Backup nach Auswahl wieder ein.
        /// </summary>
        public void RestoreLists(string restorefile, BackupRestoreGUI restoreWindow)
        {
            restoreWindow.Close();

            try
            {
                this.backupprogress.Visible = true;
                this.selectionBox.Enabled   = false; // Deaktiviere Bedienelemente
                this.coorBox.Enabled        = false;

                XmlDocument xmlDoc = new XmlDocument();
                xmlDoc.Load(GetBackupDirectory() + restorefile);

                XmlNode root = xmlDoc.SelectSingleNode("/Produkte");

                XmlNodeList produkte = root.ChildNodes;

                for (int i = 0; i < produkte.Count; i++)
                {
                    XmlNode produkt = produkte[i];

                    for (int j = 0; j < xylist_size; j++)
                    {
                        short xval = Int16.Parse(produkt.SelectSingleNode("X" + j).InnerText);
                        short yval = Int16.Parse(produkt.SelectSingleNode("Y" + j).InnerText);

                        SPSController.WriteX(xval, j);
                        SPSController.WriteY(yval, j);

                        //Console.WriteLine(xval + " " + yval + "\n");
                    }
                    SPSController.WriteDBentry(i);
                    this.backupprogress.PerformStep();
                }
                SendToConsole(restorefile + " wiederhergestellt!");
            }
            catch (NullReferenceException e)
            {
                MessageBox.Show(e.Message.ToString() + "Die gelesene Anzahl Einträge stimmt nicht mit der erwarteten Menge überein!");
                SendToConsole("Fehler beim Einspielen des Backups!\n Bitte manuell auslesen ");
            }
            SPSController.ReadDBEntry(productlist.SelectedIndex);
            Init_XYLists();
            this.backupprogress.Visible = false;
            this.backupprogress.Value   = 0;
            this.selectionBox.Enabled   = true; // Deaktiviere Bedienelemente
            this.coorBox.Enabled        = true;
        }