Пример #1
0
 private void okbutton_Click(object sender, EventArgs e)
 {
     mycontrol.Name = nametextBox.Text;
     if (mycontrol is Rutsche)
     {
     }
     else if (mycontrol is NotAus)
     {
         NotAus s = (NotAus)mycontrol;
         s.setAdress(quittextBox.Text, freigabetextBox.Text);
     }
     else if (mycontrol is Sensor)
     {
         Sensor s = (Sensor)mycontrol;
         s.setBoundary(Int32.Parse(sensorRechtstextBox.Text), Int32.Parse(sensorObentextBox.Text), Int32.Parse(sensorLinkstextBox.Text), Int32.Parse(sensorUntentextBox.Text));
         s.setAdress(sensorEingangtextBox.Text);
     }
     else if (mycontrol is Band)
     {
         Band   b   = (Band)mycontrol;
         String re  = rechtstextBox.Text;
         String li  = linkstextBox.Text;
         String sre = schnellrechtstextBox.Text;
         String sli = schnelllinkstextBox.Text;
         if (!checkBox1.Checked)
         {
             re = "";
         }
         if (!checkBox2.Checked)
         {
             li = "";
         }
         if (!checkBox3.Checked)
         {
             sre = "";
         }
         if (!checkBox4.Checked)
         {
             sli = "";
         }
         b.setAdresses(re, li, sre, sli);
     }
     else if (mycontrol is Zylinder)
     {
         Zylinder z = (Zylinder)mycontrol;
         z.setAdresses(zeingefahrentextBox.Text, zausgefahrentextBox.Text, zeinfahrentextBox.Text, zausfahrentextBox.Text);
     }
     this.Close();
 }