예제 #1
0
 private void comboBox2_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (comboBox2.SelectedItem.ToString() != "")
     {
         try
         {
             VirtualSystem.Load(comboBox2.SelectedItem.ToString() + ".xml");
             label3.Text      = VirtualSystem.Name;
             label4.Text      = "Number of digital sensors: " + VirtualSystem.NumberOfDigitalSensors.ToString();
             label5.Text      = "Number of digital actuators: " + VirtualSystem.NumberOfDigitalActuators.ToString();
             label6.Text      = "Description:";
             textBox2.Text    = VirtualSystem.Description;
             textBox2.Visible = true;
             pictureBox5.Size = new System.Drawing.Size(VirtualSystem.picture.Width, VirtualSystem.picture.Height);
             Bitmap bmp = new Bitmap(VirtualSystem.picture.FilePath);
             this.pictureBox5.Image = (System.Drawing.Image)bmp;
         }
         catch (ArgumentException ae)
         {
             MessageBox.Show("Brak pliku z podglądowym obrazkiem");
         }
         catch (FileNotFoundException fsince)
         {
             MessageBox.Show(fsince.Message);
         }
         catch (Devices.FileStructIsNotCorectException fsince)
         {
             MessageBox.Show(fsince.Message);
         }
     }
 }
예제 #2
0
 private void specialButton3_Click(object sender, EventArgs e)
 {
     if (actualPanel != null)
     {
         actualPanel.Visible = false;
     }
     actualPanel         = virtualSystemPanel;
     actualPanel.Visible = true;
     try
     {
         button2.Visible = false;
         button5.Visible = false;
         List <string> names = VirtualSystem.VirtualSystemList(@"Virtual System\");
         if (names != null && names.Count != 0)
         {
             comboBox2.Items.Clear();
             foreach (var name in names)
             {
                 comboBox2.Items.Add(name);
             }
             if (comboBox2.SelectedItem == null)
             {
                 comboBox2.SelectedItem = comboBox2.Items[0];
             }
             button2.Visible = true;
             button5.Visible = true;
         }
     }
     catch (DirectoryNotFoundException dnfe)
     {
         MessageBox.Show(dnfe.Message);
     }
     catch (FileNotFoundException fnfe)
     {
         System.Windows.Forms.MessageBox.Show(fnfe.Message +
                                              "\n\rMożliwe przyczyny:" +
                                              "\n\r1. Brak rozszerzenia w wyszukiwanej nazwie pliku" +
                                              "\n\r2. Plik został usunięty w trakcie uruchamiania bądź działania programu.");
     }
 }