private void engine_EngineStatusChanged(object sender, DebuggerEngineStatusChangedEventArgs e) { switch (e.Status) { case DebuggerEngineStatus.Started: this.lEngineStatus.Text = "Работает"; this.lEngineStatus.ForeColor = Color.FromArgb(0, 153, 0); /////////////////////////////// this.RefreshFormTimer.Start(); this.gbSettingsConnect.Enabled = false; this.bSyncTimeWithPC.Enabled = true; this.bStart.Text = "Стоп"; break; case DebuggerEngineStatus.Stopping: this.lEngineStatus.Text = "Останавливается"; this.lEngineStatus.ForeColor = Color.FromArgb(255, 204, 0); break; case DebuggerEngineStatus.Stopped: this.lEngineStatus.Text = "Остановлен"; this.lEngineStatus.ForeColor = Color.FromArgb(255, 51, 0); if (e.Error != null) { Utils.ErrorMessage(e.Error.Message); } ///////////////////////////// this.gbSettingsConnect.Enabled = true; this.bStart.Text = "Старт"; this.bSyncTimeWithPC.Enabled = false; this.RefreshFormTimer.Stop(); break; } }
/// <summary> /// Смена режима работы отладчика /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void DebuggerParametersList_ChangeStatusEngine(object sender, DebuggerEngineStatusChangedEventArgs e) { if (e.Status == DebuggerEngineStatus.Stopped) { //Установка полей недоступными this.digitalIO.EnabledMouseClick = false; for (int i = 0; i < this.ascInputs.Length; i++) { this.ascInputs[i].EnabledMouseClick = false; } for (int i = 0; i < this.ascOutputs.Length; i++) { this.ascOutputs[i].EnabledMouseClick = false; } } else { this.digitalIO.EnabledMouseClick = true; for (int i = 0; i < this.ascInputs.Length; i++) { this.ascInputs[i].EnabledMouseClick = true; } for (int i = 0; i < this.ascOutputs.Length; i++) { this.ascOutputs[i].EnabledMouseClick = true; } } }
/// <summary> /// Изменение состояния отладчика /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void DebuggerParametersList_ChangeStatusEngine(object sender, DebuggerEngineStatusChangedEventArgs e) { //при осатновке отладчика циклическое чтение прерывается this.bRead.Enabled = _engine.EngineStatus == DebuggerEngineStatus.Started; this.bTimerRead.Enabled = _engine.EngineStatus == DebuggerEngineStatus.Started; this.bWrite.Enabled = _engine.EngineStatus == DebuggerEngineStatus.Started; if (_cycleReading && e.Status != DebuggerEngineStatus.Started) { //_cycleReading = false; this.button2_Click(null, null); } this.bTimerRead.Text = "Циклическое чтение"; this.tbStartAddress.Enabled = true; this.tbReadingSize.Enabled = true; this.ddlMemoryType.Enabled = true; this.tbStartAddress.BackColor = System.Drawing.SystemColors.Window; this.tbReadingSize.BackColor = System.Drawing.SystemColors.Window; this.pbStatus.Visible = false; //поля ввода данных не активны при остановленном отладчике //this.bRead.Enabled = (_engine.EngineStatus == DebuggerEngineStatus.Started) && !_cycleReading && this.pbStatus.Value == 0; //this.bTimerRead.Enabled = _engine.EngineStatus == DebuggerEngineStatus.Started && (_cycleReading || !_cycleReading && this.pbStatus.Value == 0); //this.bWrite.Enabled = (_engine.EngineStatus == DebuggerEngineStatus.Started) && !_cycleReading && this.pbStatus.Value == 0; //this.tbStartAddress.Enabled = (_engine.EngineStatus == DebuggerEngineStatus.Started) && !_cycleReading && this.pbStatus.Value == 0; //this.tbReadingSize.Enabled = (_engine.EngineStatus == DebuggerEngineStatus.Started) && !_cycleReading && this.pbStatus.Value == 0; //this.ddlMemoryType.Enabled = (_engine.EngineStatus == DebuggerEngineStatus.Started) && !_cycleReading && this.pbStatus.Value == 0; //this.tbStartAddress.BackColor = System.Drawing.SystemColors.Window; //this.tbReadingSize.BackColor = System.Drawing.SystemColors.Window; //this.pbStatus.Visible = this.pbStatus.Value > 0 && !_cycleReading; }
/// <summary> /// Событие при изменении состояния отладчика /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void DebuggerParametersList_ChangeStatusEngine(object sender, DebuggerEngineStatusChangedEventArgs e) { if ((_engine.EngineStatus == DebuggerEngineStatus.Stopped)) { for (int i = 0; i < this.dgProcess.Rows.Count; i++) { this.dgProcess.Rows[i].Cells[1].Value = "***"; } } }
/// <summary> /// Событие при изменении состояния отладчика /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void DebuggerParametersList_ChangeStatusEngine(object sender, DebuggerEngineStatusChangedEventArgs e) { if ((_engine.EngineStatus == DebuggerEngineStatus.Started) && (_solution != null) && (this._IsReading)) { this.dgv_askStructs.Columns[2].ReadOnly = false; } else { this.dgv_askStructs.Columns[2].ReadOnly = true; } }