Esempio n. 1
0
        public void deserialize_init(List <plc> list_plc)
        {
            foreach (plc p in list_plc)
            {
                foreach (aktuator _akt_in_list in p.ListAktuator)
                {
                    if (mapped_aktuator_hash == _akt_in_list.get_aktor_hash())
                    {
                        _aktuator = _akt_in_list;
                        break;
                    }
                }
            }

            //wird beim deserialisieren aufgerufen da PictureBox nicht serialisierbar ist
            //sollte erst passieren nachdem der aktuator zugewiesen ist da sonst die label info nicht vorhanden ist
            if (_aktuator != null)
            {
                if (_aktuator.AktorType == aktor_type.sensor)
                {
                    _UCsensorValue = new UC_SensorValue(this, _pos_x, _pos_y);
                }
                else
                {
                    _PictureBox = new PBplatformControl(this, _pos_x, _pos_y);
                }
            }
        }
Esempio n. 2
0
 //anlegen eines neuen controls ohne ausgewähltem aktuator
 public platform_control(aktor_type t)
 {
     _type = t;
     if (t == aktor_type.sensor)
     {
         _UCsensorValue = new UC_SensorValue(this);
     }
     else
     {
         _PictureBox = new PBplatformControl(t, this);
     }
 }
Esempio n. 3
0
        int selected_plc = 0; //damit beim öffnen des dialogs immer die letzte gewählte cpu ausgewählt ist
        //control wird angeklickt
        void _PictureBox_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            if (sender is PBplatformControl)
            {
                PBplatformControl pc = (PBplatformControl)sender;
                FrmPlatformConfig_EditControlDialog d = new FrmPlatformConfig_EditControlDialog(pc._platform_control, _list_plc, selected_plc);

                DialogResult dr = d.ShowDialog();
                if (dr == DialogResult.OK)
                { //aktuator zuweisen oder ändern
                    pc._platform_control.change_aktuator((aktuator)d.get_aktuator());
                    selected_plc = d.get_selected_plc();
                }
                else if (dr == DialogResult.Abort) //controll wird komplett gelöscht
                {
                    pictureBox_platform.Controls.Remove(pc._platform_control._PictureBox);
                    platform_selected._list_platform_control.Remove(pc._platform_control);
                }
            }
            else if (sender is UC_SensorValue)
            {
                UC_SensorValue uc = (UC_SensorValue)sender;
                FrmPlatformConfig_EditControlDialog d = new FrmPlatformConfig_EditControlDialog(uc._platform_control, _list_plc, selected_plc);

                DialogResult dr = d.ShowDialog();
                if (dr == DialogResult.OK)
                { //aktuator zuweisen oder ändern
                    uc._platform_control.change_aktuator((aktuator)d.get_aktuator());
                    selected_plc = d.get_selected_plc();
                }
                else if (dr == DialogResult.Abort) //controll wird komplett gelöscht
                {
                    pictureBox_platform.Controls.Remove(uc._platform_control._UCsensorValue);
                    platform_selected._list_platform_control.Remove(uc._platform_control);
                }
            }
            else if (sender is Label) //TODO: die 3 typen ohne verzweigung behandeln
            {
                //MessageBox.Show("sender -> label " + Environment.NewLine + l.Handle.ToString() + Environment.NewLine + l.Tag.ToString()
                //    + Environment.NewLine + ((UC_SensorValue)l.Tag).label_sensorName );

                UC_SensorValue uc = (UC_SensorValue)((Label)sender).Tag;
                FrmPlatformConfig_EditControlDialog d = new FrmPlatformConfig_EditControlDialog(uc._platform_control, _list_plc, selected_plc);

                DialogResult dr = d.ShowDialog();
                if (dr == DialogResult.OK)
                { //aktuator zuweisen oder ändern
                    uc._platform_control.change_aktuator((aktuator)d.get_aktuator());
                    selected_plc = d.get_selected_plc();
                }
                else if (dr == DialogResult.Abort) //controll wird komplett gelöscht
                {
                    pictureBox_platform.Controls.Remove(uc._platform_control._UCsensorValue);
                    platform_selected._list_platform_control.Remove(uc._platform_control);
                }
            }
            else
            {
                log.msg(this, "call control_MouseMove with unknown sender (allowed PBplatformControl/UC_SensorValue): " + sender.GetType());
            }
        }