예제 #1
0
 public void setTasterState(Boolean s)
 {
     if (!notausVorgeschaltet || notausVorgeschaltet && NotAus.getInstance().getState() == 1)
     {
         this.tasterState = s;
         Form1.form1.Ios.setBoolean(tasterItem.byteAdr, tasterItem.bitAdr, s);
     }
     else
     {
         storedState = s;
     }
 }
예제 #2
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();
 }
예제 #3
0
 public NotAus()
 {
     InitializeComponent();
     try
     {
         freiImage        = Image.FromFile(Application.StartupPath + "\\Resources\\notaus0.gif");
         ausgeloestImage  = Image.FromFile(Application.StartupPath + "\\Resources\\notaus1.gif");
         pictureBox.Image = freiImage;
     }
     catch (Exception e)
     {
         Console.WriteLine("** Exception bei init Notaus>" + e.Message);
     }
     instance = this;
 }
예제 #4
0
 public void keyPressed(char key)
 {
     if (key == this.getTasterTaste())
     {
         if (type == Taster)
         {
             if (schliesser)
             {
                 setTasterState(true);
                 this.pictureBox.Image = einschalterPressedImage;
                 this.pictureBox.Size  = new System.Drawing.Size(this.pictureBox.Image.Width, this.pictureBox.Image.Height);
             }
             else
             {
                 this.pictureBox.Image = ausschalterPressedImage;
                 this.pictureBox.Size  = new System.Drawing.Size(this.pictureBox.Image.Width, this.pictureBox.Image.Height);
                 setTasterState(false);
             }
         }
         else if (type == FarbSchalter)
         {
             if (pictureBox.Image == leuchtmelderImage[0, LeuchtmelderFarbe])
             {
                 setTasterState(true);
                 if (!mitNotaus() || mitNotaus() && NotAus.getInstance().getState() == 1)
                 {
                     this.pictureBox.Image = leuchtmelderImage[1, LeuchtmelderFarbe];;
                     this.pictureBox.Size  = new System.Drawing.Size(this.pictureBox.Image.Width, this.pictureBox.Image.Height);
                 }
             }
             else
             {
                 setTasterState(false);
                 this.pictureBox.Image = leuchtmelderImage[0, LeuchtmelderFarbe];;
                 this.pictureBox.Size  = new System.Drawing.Size(this.pictureBox.Image.Width, this.pictureBox.Image.Height);
             }
         }
         else if (type == Schalter)
         {
             if (pictureBox.Image == kipp0Image)
             {
                 setTasterState(true);
                 this.pictureBox.Image = kipp1Image;
                 this.pictureBox.Size  = new System.Drawing.Size(this.pictureBox.Image.Width, this.pictureBox.Image.Height);
             }
             else
             {
                 setTasterState(false);
                 this.pictureBox.Image = kipp0Image;
                 this.pictureBox.Size  = new System.Drawing.Size(this.pictureBox.Image.Width, this.pictureBox.Image.Height);
             }
         }
         else if (type == LeuchtTaster)
         {
             if (leuchtmelderState)
             {
                 this.pictureBox.Image = leuchtmelderImage[3, LeuchtmelderFarbe];;
                 this.pictureBox.Size  = new System.Drawing.Size(this.pictureBox.Image.Width, this.pictureBox.Image.Height);
             }
             else
             {
                 this.pictureBox.Image = leuchtmelderImage[2, LeuchtmelderFarbe];;
                 this.pictureBox.Size  = new System.Drawing.Size(this.pictureBox.Image.Width, this.pictureBox.Image.Height);
             }
             if (schliesser)
             {
                 setTasterState(true);
             }
             else
             {
                 setTasterState(false);
             }
         }
     }
 }
예제 #5
0
        private void pictureBox_MouseDown(object sender, MouseEventArgs e)
        {
            if (type == Taster)
            {
                if (schliesser)
                {
                    setTasterState(true);
                    this.pictureBox.Image = einschalterPressedImage;
                    this.pictureBox.Size  = new System.Drawing.Size(this.pictureBox.Image.Width, this.pictureBox.Image.Height);
                }
                else
                {
                    this.pictureBox.Image = ausschalterPressedImage;
                    this.pictureBox.Size  = new System.Drawing.Size(this.pictureBox.Image.Width, this.pictureBox.Image.Height);
                    setTasterState(false);
                }
            }
            else if (type == Schalter)
            {
                if (this.pictureBox.Image == kipp0Image)
                {
                    this.setTasterState(true);
                    this.pictureBox.Image = kipp1Image;
                    this.pictureBox.Size  = new System.Drawing.Size(this.pictureBox.Image.Width, this.pictureBox.Image.Height);
                }
                else
                {
                    this.setTasterState(false);
                    this.pictureBox.Image = kipp0Image;
                    this.pictureBox.Size  = new System.Drawing.Size(this.pictureBox.Image.Width, this.pictureBox.Image.Height);
                }
            }
            else if (type == FarbSchalter)
            {
                if (pictureBox.Image == leuchtmelderImage[0, LeuchtmelderFarbe])
                {
                    setTasterState(true);
                    if (!mitNotaus() || mitNotaus() && NotAus.getInstance().getState() == 1)
                    {
                        this.pictureBox.Image = leuchtmelderImage[1, LeuchtmelderFarbe];;
                        this.pictureBox.Size  = new System.Drawing.Size(this.pictureBox.Image.Width, this.pictureBox.Image.Height);
                    }
                }
                else
                {
                    setTasterState(false);
                    this.pictureBox.Image = leuchtmelderImage[0, LeuchtmelderFarbe];;
                    this.pictureBox.Size  = new System.Drawing.Size(this.pictureBox.Image.Width, this.pictureBox.Image.Height);
                }
            }

            else if (type == LeuchtTaster)
            {
                if (leuchtmelderState)
                {
                    this.pictureBox.Image = leuchtmelderImage[3, LeuchtmelderFarbe];
                    this.pictureBox.Size  = new System.Drawing.Size(this.pictureBox.Image.Width, this.pictureBox.Image.Height);
                }
                else
                {
                    this.pictureBox.Image = leuchtmelderImage[2, LeuchtmelderFarbe];;
                    this.pictureBox.Size  = new System.Drawing.Size(this.pictureBox.Image.Width, this.pictureBox.Image.Height);
                }
                if (schliesser)
                {
                    setTasterState(true);
                }
                else
                {
                    setTasterState(false);
                }
            }
        }
예제 #6
0
        public void setControl(Control c)
        {
            mycontrol        = c;
            nametextBox.Text = c.Name;
            if (c is Rutsche)
            {
                this.Text = "Eigenschaften Rutsche";
            }
            else if (c is Magazin)
            {
                this.Text = "Eigenschaften Magazin";
            }
            else if (c is NotAus)
            {
                this.Text = "Eigenschaften NotAus";
                NotAus z = (NotAus)mycontrol;
                panel1.Controls.Add(Notauspanel);
                Notauspanel.Dock     = System.Windows.Forms.DockStyle.Fill;
                Notauspanel.Visible  = true;
                quittextBox.Text     = z.getQuitAdress();
                freigabetextBox.Text = z.getFreigabeAdress();
            }
            else if (c is Zylinder)
            {
                this.Text = "Eigenschaften Zylinder";

                Zylinder z = (Zylinder)mycontrol;
                panel1.Controls.Add(zylinderpanel);
                zylinderpanel.Dock       = System.Windows.Forms.DockStyle.Fill;
                zylinderpanel.Visible    = true;
                zeinfahrentextBox.Text   = z.getEinfahrenAdress();
                zeingefahrentextBox.Text = z.getEingefahrenAdress();
                zausfahrentextBox.Text   = z.getAusfahrenAdress();
                zausgefahrentextBox.Text = z.getAusgefahrenAdress();
            }
            else if (c is Sensor)
            {
                this.Text = "Eigenschaften Sensor";

                Sensor s = (Sensor)mycontrol;
                panel1.Controls.Add(sensorpanel);
                sensorpanel.Dock          = System.Windows.Forms.DockStyle.Fill;
                sensorpanel.Visible       = true;
                sensorLinkstextBox.Text   = s.getLeftBound().ToString();
                sensorRechtstextBox.Text  = s.getRightBound().ToString();
                sensorObentextBox.Text    = s.getTopBound().ToString();
                sensorUntentextBox.Text   = s.getBottumBound().ToString();
                sensorEingangtextBox.Text = s.getAdress();
            }
            else if (c is Band)
            {
                this.Text = "Eigenschaften Band";

                Band b = (Band)mycontrol;
                panel1.Controls.Add(bandpanel);
                bandpanel.Dock            = System.Windows.Forms.DockStyle.Fill;
                bandpanel.Visible         = true;
                rechtstextBox.Text        = b.getRightAdress();
                linkstextBox.Text         = b.getLeftAdress();
                schnellrechtstextBox.Text = b.getSpeedRightAdress();
                schnelllinkstextBox.Text  = b.getSpeedLeftAdress();
                if (b.getRightAdress() == "")
                {
                    checkBox1.Checked = false;
                }
                if (b.getLeftAdress() == "")
                {
                    checkBox2.Checked = false;
                }
                if (b.getSpeedRightAdress() == "")
                {
                    checkBox3.Checked = false;
                }
                if (b.getSpeedLeftAdress() == "")
                {
                    checkBox4.Checked = false;
                }
            }
        }