示例#1
0
 public aktuator_control(aktuator a)
 {
     aktuator      = a;
     aktuatorIndex = a.Index;
     _aktor_type   = a.AktorType;
     set_uc(aktuator);
 }
示例#2
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);
                }
            }
        }
示例#3
0
 public UC_heater(object _a)
 {
     InitializeComponent();
     akt             = (aktuator)_a;
     label_name.Text = "[" + akt.Index.ToString() + "] " + akt.Name;
     akt.plc_send_IO(DataIOType.GetParam);
 }
示例#4
0
 public FrmJalousieEvent(object a)
 {
     InitializeComponent();
     _a = (aktuator)a;
     init();
     this.Text = "Jalousie: " + _a.Name;
 }
示例#5
0
 public UC_dialog_light(object aktor)
 {
     InitializeComponent();
     _aktor = (aktuator)aktor;
     _aktor.plc_send_IO(DataIOType.GetParam);
     //_aktor.plc_send(new Frame(Frame.GET_PARAM(_aktor.Index)));
 }
示例#6
0
        public UC_dialog_jalousie(object aktor)
        {
            InitializeComponent();
            _aktor = (aktuator)aktor;
            _aktor.plc_send_IO(DataIOType.GetParam);

            init_event();
        }
 private void fill_content(aktuator a)
 {
     label_id.Text               = a.Index.ToString();
     label_type.Text             = a.AktorType.ToString();
     label_aktuator_name.Text    = a.Name;
     this.WindowTitle            = "edit: " + a.Name;
     _platform_control._aktuator = a;
 }
示例#8
0
        public UC_jalousieEvent(object _a, Int16 _count)
        {
            InitializeComponent();
            count = _count;
            akt   = (aktuator)_a;

            //akt.plc_send_IO(DataIOType.GetParamJalousieEvent, new Int16[]{count });
            //akt.plc_send_IO(new Frame(Frame.JALOUSIE_EVENT_GET(akt.Index, count)));
            label_event_id.Text = "Event: " + _count;
        }
示例#9
0
        private void dataGridView_aktuators_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            aktuator     _akt = dataGridView_aktuators.SelectedRows[0].DataBoundItem as aktuator;
            DialogResult dr   = MessageBox.Show("Copy Running to Startup Config?", _akt.Name, MessageBoxButtons.YesNoCancel, MessageBoxIcon.Warning);

            if (dr == DialogResult.Yes)
            {
                _akt.copyRunningToStartConfig();
            }
        }
示例#10
0
 /// <summary>
 /// call from FrmPlatformConfig if aktuator of control is changed or set
 /// </summary>
 /// <param name="a"></param>
 public void change_aktuator(aktuator a)
 {
     _aktuator = a;
     if (_aktuator.AktorType == aktor_type.sensor)
     {
         _UCsensorValue.update_label_text();
     }
     else
     {
         _PictureBox.update_label_text();
     }
 }
示例#11
0
        public FrmMain_controlDialog(object akt)
        {
            InitializeComponent();
            _akt = (aktuator)akt;
            ip   = _akt._plc.IPplc;

            this.Text = _akt.Name;

            switch (_akt.AktorType)
            {
            case aktor_type.jalousie:
                ucdialog = new UC_dialog_jalousie(_akt);
                this.Controls.Add(ucdialog);
                break;

            case aktor_type.light:
                ucdialog = new UC_dialog_light(_akt);
                this.Controls.Add(ucdialog);
                break;

            case aktor_type.heater:
                ucdialog = new UC_dialog_heater(_akt);
                this.Controls.Add(ucdialog);
                break;

            case aktor_type.undef:
                ucdialog = new UC_dialog_undef(_akt);
                this.Controls.Add(ucdialog);
                break;

            case aktor_type.sensor:
                Label lsensor = new Label();
                lsensor.Text = "ERROR: aktor_type.sensor not implemented";
                this.Controls.Add(lsensor);
                break;

            default:
                Label lerror = new Label();
                lerror.Text = "ERROR: unknown aktor_type";
                this.Controls.Add(lerror);
                break;
            }
            this.Size = new Size(ucdialog.Size.Width + 6, ucdialog.Size.Height + 29);


            TimerUpdateGui          = new System.Windows.Forms.Timer();
            TimerUpdateGui.Interval = var.timer_refresh_GUI;
            TimerUpdateGui.Tick    += new EventHandler(timer_refresh_control_Tick);
            TimerUpdateGui.Start();
        }
示例#12
0
 public UC_dialog_undef(object aktor)
 {
     InitializeComponent();
     _aktor           = (aktuator)aktor;
     label_index.Text = _aktor.Index.ToString();
     label_name.Text  = _aktor.Name;
     label_type.Text  = _aktor.AktorType.ToString();
     if (_aktor._plc != null)
     {
         label_plc.Text = _aktor._plc.ToString();
     }
     else
     {
         label_plc.Text = "ERROR: plc = null";
     }
 }
示例#13
0
        private void dataGridView_aktuators_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            aktuator _akt = dataGridView_aktuators.SelectedRows[0].DataBoundItem as aktuator;

            //MessageBox.Show(_akt.Name + " " + _akt.AktorType,"add aktuator");
            panel_control.Controls.Clear();

            switch (_akt.AktorType)
            {
            case aktor_type.jalousie:
                ucdialog = new UC_dialog_jalousie(_akt);
                ((UC_dialog_jalousie)ucdialog).LoadData(_akt.ConfigAktuatorValuesRunning);
                panel_control.Controls.Add(ucdialog);
                break;

            case aktor_type.light:
                ucdialog = new UC_dialog_light(_akt);
                ((UC_dialog_light)ucdialog).LoadData(_akt.ConfigAktuatorValuesRunning);
                panel_control.Controls.Add(ucdialog);
                break;

            case aktor_type.heater:
                //((UC_dialog_heater)ucdialog).LoadData(_akt.AktuatorRunningConfig);
                panel_control.Controls.Add(new UC_dialog_heater(_akt).LoadData(_akt.ConfigAktuatorValuesRunning));
                break;

            case aktor_type.undef:
                ucdialog = new UC_dialog_undef(_akt);
                ((UC_dialog_undef)ucdialog).LoadData(_akt.ConfigAktuatorValuesRunning);
                panel_control.Controls.Add(ucdialog);
                break;

            case aktor_type.sensor:
                Label lsensor = new Label();
                lsensor.Text = "aktor_type.sensor: " + _akt.Name;
                panel_control.Controls.Add(lsensor);
                break;

            default:
                Label lerror = new Label();
                lerror.Text = "ERROR unknown aktor_type";
                panel_control.Controls.Add(lerror);
                break;
            }
            //EXCEPTION ucdialog==null  ->  this.Size = new Size(ucdialog.Size.Width + 6, ucdialog.Size.Height + 29);
        }
示例#14
0
 public void set_uc(aktuator _aktuator)
 {
     if (_aktuator.AktorType == aktor_type.light)
     {
         user_control = new UC_light(aktuator);
     }
     else if (_aktuator.AktorType == aktor_type.jalousie)
     {
         user_control = new UC_jalousie(aktuator);
     }
     else if (_aktuator.AktorType == aktor_type.heater)
     {
         user_control = new UC_heater(aktuator);
     }
     else
     {
         user_control = null;
     }
 }
示例#15
0
        private void listBox_aktors_MouseClick(object sender, MouseEventArgs e)
        {
            checkBox_add_new_aktuator.Checked = false;
            panel_edit_aktuator.Visible       = true;
            aktuator selected_aktuator = (aktuator)listBox_aktors.SelectedItem;

            if (selected_aktuator != null)
            {
                textBox_akt_id.Text     = selected_aktuator.Index.ToString();
                textBox_edit_name.Text  = selected_aktuator.Name;
                comboBox_edit_type.Text = selected_aktuator.AktorType.ToString();
                if (selected_aktuator._plc != null)
                {
                    comboBox_edit_plc.Text = selected_aktuator._plc.NamePlc;
                }
                else
                {
                    comboBox_edit_plc.Text = "SELECT PLC";
                }
            }
        }
示例#16
0
        private void button_save_actuator_Click(object sender, EventArgs e)
        {
            //ein item wird editiert
            if (listBox_aktors.SelectedItems.Count == 1 || checkBox_add_new_aktuator.Checked)
            {
                textBox_akt_id.BackColor = Color.White;
                Int16 index;
                //id auf zahl verifizieren
                if (Int16.TryParse(textBox_akt_id.Text, out index))
                {
                    plc        plc  = (plc)comboBox_edit_plc.SelectedItem;
                    aktor_type type = (aktor_type)Enum.Parse(typeof(aktor_type), comboBox_edit_type.Text);

                    if (checkBox_add_new_aktuator.Checked)
                    {
                        plc.ListAktuator.Add(new aktuator(index, textBox_edit_name.Text, plc, type));
                        textBox_akt_id.Text = (Convert.ToInt16(textBox_akt_id.Text) + 1).ToString();
                    }
                    else
                    {
                        aktuator a = (aktuator)listBox_aktors.SelectedItem;
                        //plc.ListAktuator.FindIndex(a)
                        if (comboBox_edit_type.SelectedItem != null)
                        {
                            a.AktorType = (aktor_type)Enum.Parse(typeof(aktor_type), comboBox_edit_type.Text);
                        }
                        if (comboBox_edit_plc.SelectedItem != null)
                        {
                            if (a._plc != (plc)comboBox_edit_plc.SelectedItem)
                            {
                                ((plc)comboBox_edit_plc.SelectedItem).ListAktuator.Add(a);
                                a._plc.ListAktuator.Remove(a);
                            }
                        }
                        if (textBox_akt_id.Text != "")
                        {
                            a.Index = Convert.ToInt16(textBox_akt_id.Text);
                        }
                        if (textBox_edit_name.Text != "")
                        {
                            a.Name = textBox_edit_name.Text;
                        }



                        //int nr = plc.ListAktuator.IndexOf(a);
                        //plc.ListAktuator[nr].Index = index;
                        //plc.ListAktuator[nr].Name = textBox_edit_name.Text;
                        //plc.ListAktuator[nr]._plc = plc;
                        //plc.ListAktuator[nr]._type = type;
                    }
                    //################################################# TODO:
                    //###################### alle bereits projektierten aktoren suchen und ebenfalls updaten

                    //foreach(platform p in _list_platform)
                    //    int fn = p._list_platform_control.
                }
                else
                {
                    textBox_akt_id.BackColor = Color.Red;
                }
            }
            //mehrere items werden gleichzeitig editiert
            else
            {
                ListBox.SelectedObjectCollection collection = new ListBox.SelectedObjectCollection(listBox_aktors);
                foreach (aktuator a in collection)
                {
                    if (comboBox_edit_type.SelectedItem != null)
                    {
                        a.AktorType = (aktor_type)Enum.Parse(typeof(aktor_type), comboBox_edit_type.Text);
                    }
                    if (comboBox_edit_plc.SelectedItem != null)
                    {
                        if (a._plc != (plc)comboBox_edit_plc.SelectedItem)
                        {
                            ((plc)comboBox_edit_plc.SelectedItem).ListAktuator.Add(a);
                            a._plc.ListAktuator.Remove(a);
                        }
                    }
                }
            }

            listBox_aktors_refresh();
        }
示例#17
0
 public UC_dialog_heater(object aktor)
 {
     InitializeComponent();
     akt = (aktuator)aktor;
     akt.plc_send_IO(cpsLIB.DataIOType.GetParam);
 }