public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) { //throw new NotImplementedException(); CombinedTwoValues combinedTwoValues = new CombinedTwoValues(); CounterSystem counterSystem = values[0] as CounterSystem; if (counterSystem != null) { combinedTwoValues.counterSystem = counterSystem; } SystemMeasurementsResults measurementsResults = values[1] as SystemMeasurementsResults; if (measurementsResults != null) { combinedTwoValues.measurementResults = measurementsResults; } var mainVm = (MainViewModel)values[2]; //if (currentMeasurementNumber != null) //combinedTwoValues.currentMeasurementNumber = ref currentMeasurementNumber; combinedTwoValues.mainVm = mainVm; Debug.WriteLine(""); return(combinedTwoValues); }
public static bool StartMeasurements(CounterSystem counterSystem) { CounterSystem tmpCounterSystem = counterSystem; bool isOK = true; foreach (var device in tmpCounterSystem.device) { int activeCounters = 0; int index = 0; foreach (var counter in device.counter) { if (counter.Active) { activeCounters |= 1 << index; if (IsAllSetCouterParametersOK(counter)) { isOK &= SetCounterValues(counter); } } ++index; } if (activeCounters != 0) { DeviceMakeSendReadCommand(device, (byte)ModbusCommand.StartCounters); } } return(isOK); //Start measurement }
public override string GetText(RenderableData context, CssProperty property) { if (context == null) { return(""); } // Get the document: ReflowDocument doc = context.computedStyle.reflowDocument; if (System_ == null) { // Get the system by name: Css.Value style = Style; if (style != null) { System_ = doc.GetCounter(style.Text); } else { System_ = null; } if (System_ == null) { // Default to decimal: System_ = CounterSystems.Decimal; } } return(System_.Get(doc.Renderer.GetCounter(Counter), false)); }
public override bool CanExecute(object parameter) { mainViewModel = parameter as MainViewModel; if (mainViewModel != null) { this.systemDevice = mainViewModel.countersSystem; this.measurementsResults = mainViewModel.measurementsResults; this.currentMeasurementNumber = mainViewModel.CurrentMeasurementNumber; //Debug.WriteLine("FNC true"); if (systemDevice != null) { foreach (var device in systemDevice.device) { foreach (var counter in device.counter) { if (counter.Active) { return(true); } } } } } return(false); }
public override string GetText(RenderableData context, CssProperty property) { if (context == null) { return(""); } // Get the document: ReflowDocument doc = context.computedStyle.reflowDocument; if (System_ == null) { // Get the system by name: Css.Value style = Style; if (style != null) { System_ = doc.GetCounter(style.Text); } else { System_ = null; } if (System_ == null) { // Default to decimal: System_ = CounterSystems.Decimal; } } // Get all counters from the system and join them: List <CssCounter> counters = doc.Renderer.Counters; if (counters == null) { return(""); } // Go forward here: string result = ""; for (int i = 0; i < counters.Count; i++) { if (counters[i].Name == Counter) { // Got one! Add it on: if (result != "") { result += Separator; } result += System_.Get(counters[i].Count, false); } } return(result); }
public bool CanExecute(object parameter) { CounterSystem systemFound = parameter as CounterSystem; if (systemFound == null) { return(true); } return(false); }
private int[] SetValuesStartMeasurements(CounterSystem devices) { CounterSystem countersSystem = devices; int[] numberOfActiveDevices = new int[countersSystem.numberOfSlaveDevices]; int index = 0; foreach (var device in countersSystem.device) { foreach (var counter in device.counter) { if (counter.Active == true) { numberOfActiveDevices[index] = 1; //++numberOfActiveCountersInDevice[index]; if (TransferData.IsAllSetCouterParametersOK(counter)) { if (!TransferData.SetCounterValues(counter)) { MessageBox.Show("Error writing data to device at address: " + device.DeviceAddress + " counter: " + counter.CounterNumber); } } else { MessageBox.Show("Counter parameters are not correct: " + counter.CounterNumber); } } } if (numberOfActiveDevices[index] == 1) { TransferData.DeviceMakeSendReadCommand(device, (byte)ModbusCommand.StartCounters); } ++index; } //start devicec //Debug.WriteLine(numberOfActiveCountersInDevice); return(numberOfActiveDevices); }