public CommunicationService() { _Ports = new ObservableCollection<string>(); _Log = new ObservableCollection<string>(); RefreshPortsCommand = new Command((x) => RefreshPorts(), (x) => true); RefreshPorts(); }
public DBManager() { Open = new Command((x) => OpenAction(), (x) => true); Save = new Command((x) => SaveAction(), (x) => true); SaveAs = new Command((x) => SaveAsAction(), (x) => true); _Serializer = new XmlSerializer(typeof(RoadDataBase)); DataBase = new RoadDataBase(); }
public EditNodeViewModel(object model) { _model = model; if (_model is RoadDBItem) Name = ((RoadDBItem)_model).Наименование; else if (_model is ProbeDBItem) Name = ((ProbeDBItem)_model).ИмяЗонда; _view = new EditNode(); _view.DataContext = this; Result = EditNodeResult.Null; Ok = new Command((x) => OkAction(), (x) => true); Cancel = new Command((x) => CancelAction(), (x) => true); }
public EditHistoryViewModel(SensorDBHistory history) { _history = history; Sensor1Value = _history.Sensor1Value; Sensor2Value = _history.Sensor2Value; Temperature = _history.Temperature; TimeStamp = _history.TimeStamp; _view = new EditHistoryItem(); _view.DataContext = this; Ok = new Command((x) => OkAction(), (x) => true); Cancel = new Command((x) => CancelAction(), (x) => true); }
public EditSensorViewModel(SensorDBItem sensor, ProbeDBItem probe) { if (sensor == null) throw new ArgumentNullException("sensor", "sensor is null."); if (probe == null) throw new ArgumentNullException("probe", "probe is null."); _probe = probe; _sensor = sensor; _availableIndexes = CalculateIndexes(); SensorID = _sensor.SensorId == -1 ? _availableIndexes.FirstOrDefault() : _sensor.SensorId; SensorIndex = _sensor.SensorIndex; Name = sensor.Name; ActualPosition = sensor.ActualPosition; _view = new EditSensor(); _view.DataContext = this; Ok = new Command((x) => OkAction(), (x) => true); Cancel = new Command((x) => CancelAction(), (x) => true); }
private void InitializeCommands() { AddRoad = new Command((x) => AddRoadAction(), (x) => true); DeleteRoad = new Command((x) => DeleteRoadAction(), (x) => CurrentRoad != null); EditRoad = new Command((x) => EditRoadAction(), (x) => CurrentRoad != null); AddProbe = new Command((x) => AddProbeAction(), (x) => CurrentRoad != null); DeleteProbe = new Command((x) => DeleteProbeAction(), (x) => CurrentProbe != null); EditProbe = new Command((x) => EditProbeAction(), (x) => CurrentProbe != null); AddSensor = new Command((x) => AddSensorAction(), (x) => CurrentProbe != null); DeleteSensor = new Command((x) => DeleteSensorAction(), (x) => CurrentSensor != null); EditSensor = new Command((x) => EditSensorAction(), (x) => CurrentSensor != null); DeleteHistoryItem = new Command((x) => DeleteHistoryItemAction(), (x) => CurrentHistory != null); RequestSensor = new Command((x) => ComService.AskSensor(CurrentSensor), (x) => CurrentSensor != null); AddHistoryItem = new Command((x) => AddHistoryItemAction(), (x) => CurrentSensor != null); EdHistoryItem = new Command((x) => EditHistoryItemAction(), (x) => CurrentHistory != null); OpenTare = new Command((x) => OpenSensorDBAction(), (x)=> true); }
public RoadPeakerViewModel() { LoadData(); AddRoad = new Command(x => AddRoadAction(), x => SelectedStation != null); Cancel = new Command(x => Close(), x => true); }
public TermoGraphViewModel() { _Layers = new ObservableCollection<LayerTermoGraphItem>(); EndDate = DateTime.Now.Date.AddDays(1); StartDate = DateTime.Now.AddDays(-30).Date; Update = new Command((x) => ReadSensorData(), (x) => true); }
public GraphViewModel() { GraphItems = new ObservableCollection<GraphItemViewModel>(); Refresh = new Command(x => OnSelectedProbeChanged(), x => true); }