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; } }
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); } } } }
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); } } }