private void pictureBoxRemadeWhen_MouseClick(object sender, MouseEventArgs e) { switch (this.comboBoxWhen.Text) { case "Устройство получило команду": using (var win = new ItemReceivesCommandForm(Form.itemList, _deviceWhen, _stateWhen)) { var result = win.ShowDialog(); if (result == DialogResult.OK) { _deviceWhen = win.comboBoxItems.Text; _stateWhen = win.comboBoxState.Text; } } break; case "Устройство изменило состояние": using (var win = new ItemStateChangesForm(Form.itemList, _deviceWhen, _stateWhen, _prevState)) { var result = win.ShowDialog(); if (result == DialogResult.OK) { _deviceWhen = win.comboBoxItems.Text; _stateWhen = win.comboBoxState.Text; _prevState = win.comboBoxPrevState.Text; } } break; case "Устройство обновило состояние": using (var win = new ItemStateUpdatedForm(Form.itemList, _deviceWhen, _stateWhen)) { var result = win.ShowDialog(); if (result == DialogResult.OK) { _deviceWhen = win.comboBoxItems.Text; _stateWhen = win.comboBoxState.Text; } } break; case "Фиксированное время": using (var win = new FixedTimeDayForm(_time)) { var result = win.ShowDialog(); if (result == DialogResult.OK) { _time = win.comboBoxHours.Text + ":" + win.comboBoxMinutes.Text; } } break; case "Если состояние верно...": break; } }
private void comboBoxWhen_SelectedIndexChanged(object sender, EventArgs e) { switch (this.comboBoxWhen.Text) { case "Устройство получило команду": using (var win = new ItemReceivesCommandForm(Form.itemList)) { var result = win.ShowDialog(); if (result == DialogResult.OK) { _deviceWhen = win.comboBoxItems.Text; _stateWhen = win.comboBoxState.Text; } } //ItemReceivesCommandForm winReceivesCom = new ItemReceivesCommandForm(Form.itemList); //winReceivesCom.Show(); break; case "Устройство изменило состояние": using (var win = new ItemStateChangesForm(Form.itemList)) { var result = win.ShowDialog(); if (result == DialogResult.OK) { _deviceWhen = win.comboBoxItems.Text; _stateWhen = win.comboBoxState.Text; _prevState = win.comboBoxPrevState.Text; } } //ItemStateChangesForm winStateChanges = new ItemStateChangesForm(Form.itemList); //winStateChanges.Show(); break; case "Устройство обновило состояние": using (var win = new ItemStateUpdatedForm(Form.itemList)) { var result = win.ShowDialog(); if (result == DialogResult.OK) { _deviceWhen = win.comboBoxItems.Text; _stateWhen = win.comboBoxState.Text; } } //ItemStateUpdatedForm winStateUpdated = new ItemStateUpdatedForm(Form.itemList); //winStateUpdated.Show(); break; case "Фиксированное время": using (var win = new FixedTimeDayForm()) { var result = win.ShowDialog(); if (result == DialogResult.OK) { //_device = win.comboBoxItems.Text; _time = win.comboBoxHours.Text + ":" + win.comboBoxMinutes.Text; } } //FixedTimeDayForm winFixedTime = new FixedTimeDayForm(); //winFixedTime.Show(); break; case "Если состояние верно...": break; } }