public AnalogOutputControlViewModel(IAnalogOutput analogOutput, CoreDispatcher dispatcher) { TickFrequency = 0.01; Name = analogOutput.UniqueIdentifyer.IdentifierString; _analogOutput = analogOutput; _dispatcher = dispatcher; _analogOutput.OnAnalogoutputChanged += _analogOutput_OnAnalogoutputChanged; analogOutput.RaiseAllObjectEvents(); }
public void AssignAnalogOutput(IAnalogOutput analogOutput) { if (analogOutput == null) { timer1.Enabled = false; return; } this.analogOutput = analogOutput; labelUnit.Text = analogOutput.Unit; labelName.Text = analogOutput.Name; numberLimitMax.Number = analogOutput.LimitMax; numberLimitMin.Number = analogOutput.LimitMin; }
private void listView1_AfterLabelEdit(object sender, System.Windows.Forms.LabelEditEventArgs e) { ListViewItem item = listView1.SelectedItems[0]; if (item.Tag is IAnalogOutput) { IAnalogOutput analogOut = (IAnalogOutput)item.Tag; if (e.Label != null) { double newValue = Convert.ToDouble(e.Label); analogOut.Set(newValue); } } }
public void AddIO(IAnalogOutput anOut, string label) { SetType(IOType.Analog); AnalogControl newAC = new AnalogControl(); newAC.Value = anOut.Get(); newAC.IOTypeOutput = true; newAC.OutputMin = anOut.LimitMin; newAC.OutputMax = anOut.LimitMax; newAC.ValueChanged += new EventHandler(this.AnalogControl_ValueChanged); newAC.Label = label; newAC.Units = anOut.Unit; this.ioObjList.Add(anOut); this.Controls.Add(newAC); }
protected virtual void listView1_DoubleClick(object sender, System.EventArgs e) { ListViewItem item = listView1.SelectedItems[0]; if (item.Tag is IDigitalOutput) { IDigitalOutput digOut = (IDigitalOutput)item.Tag; digOut.Toggle(); } else if (item.Tag is IAnalogOutput) { IAnalogOutput analogOut = (IAnalogOutput)item.Tag; item.BeginEdit(); } }
public void RegisterAnalogOutput(IAnalogOutput analogOut, int registrationID, string name) { if (analogOut == null) { throw new Exception(string.Format("The analog output '{0}' is invalid(null)!", name)); } if (analogOutputMap.Contains(registrationID)) { throw new Exception("The IO is already registered!"); } analogOut.Name = name; analogOutputMap.Add(registrationID, analogOut); }
private void RaiseOnAnalogoutputChanged(IAnalogOutput output, double percentagevalue, double voltagevalue, double milliAmpereValue) => Task.Run(() => OnAnalogoutputChanged?.Invoke(output, percentagevalue, voltagevalue, milliAmpereValue));
public AnalogOutputControl(IAnalogOutput analogOutput) { ViewModel = new AnalogOutputControlViewModel(analogOutput, Dispatcher); InitializeComponent(); }
private void _analogOutput_OnAnalogoutputChanged(IAnalogOutput output, double percentageValue, double voltageValue, double milliampereValue) { Voltage = voltageValue; Percent = percentageValue; }