protected void OnDataChanged(DataChangedEventArgs e) { if (_dataChanged != null) { _dataChanged(this, e); } }
private void DriverDataChanged(object sender, DataChangedEventArgs e) { if (e.ItemName == Address) { if (!ServiceManager.DesignMode && _value != null && !_value.Equals(e.Value.ToString())) { Console.WriteLine(Name + " Valor atual " + _value.ToString()); Console.WriteLine(Name + " Valor novo " + e.Value.ToString()); _counter = ++_counter; _value = e.Value.ToString(); _tmr.Start(); Console.WriteLine(Name + " Executou o contador. " + _counter.ToString()); } else if (_value == null) { Console.WriteLine(Name + " Inicializou com valor " + e.Value.ToString()); _value = e.Value.ToString(); } } }
private void DriverDataChanged(object sender, DataChangedEventArgs e) { if (!ServiceManager.IsClient || ServiceManager.DesignMode) { if (e.ItemName == Address) { if (_value == null || _value != e.Value.ToString()) { _value = e.Value.ToString(); if (!ServiceManager.DesignMode) { OnValueChanged(new EventArgs()); } } } } else { if (e.ItemName == Name) { if (_value == null || !_value.Equals(e.Value)) { _value = e.Value.ToString(); if (!ServiceManager.DesignMode) { OnValueChanged(new EventArgs()); } } } } }
private void DriverDataChanged(object sender, DataChangedEventArgs e) { if ( e.ItemName == Address ) { if (!ServiceManager.DesignMode && _value != null && !_value.Equals(e.Value.ToString())) { Console.WriteLine(Name + " Valor atual " + _value.ToString()); Console.WriteLine(Name + " Valor novo " + e.Value.ToString()); _counter = ++_counter; _value = e.Value.ToString(); _tmr.Start(); Console.WriteLine(Name + " Executou o contador. " + _counter.ToString()); } else if (_value == null) { Console.WriteLine(Name + " Inicializou com valor " + e.Value.ToString()); _value = e.Value.ToString(); } } }
private void DriverDataChanged(object sender, DataChangedEventArgs e) { if (!ServiceManager.IsClient || ServiceManager.DesignMode) { if (e.ItemName == Address) { if (SignalCondition != null) { string fromDataSource = SignalCondition.Convert(e.Value.ToString(), Min, Max, TypeDirection.FromDataSource); if (_value == null || _value != fromDataSource) { _value = fromDataSource; if (!ServiceManager.DesignMode) { OnValueChanged(new EventArgs()); } } } else { if (_value == null || _value != e.Value.ToString()) { _value = e.Value.ToString(); if (!ServiceManager.DesignMode) { OnValueChanged(new EventArgs()); } } } } } else { if (e.ItemName == Name) { if (SignalCondition != null) { string fromDataSource = SignalCondition.Convert(e.Value.ToString(), Min, Max, TypeDirection.FromDataSource); if (_value == null || _value != fromDataSource) { _value = fromDataSource; if (!ServiceManager.DesignMode) { OnValueChanged(new EventArgs()); } } } else { if (_value == null || _value != e.Value.ToString()) { _value = e.Value.ToString(); if (!ServiceManager.DesignMode) { OnValueChanged(new EventArgs()); } } } } } }