//private void ViewModel_PropertyChanged(object sender, PropertyChangedEventArgs e) //{ // if (e.PropertyName == "Points" || e.PropertyName == "Labels") // { // UpdateView(); // } //} //private void UpdateView() //{ // if (_vm == null) // return; // if (!Dispatcher.CheckAccess()) // { // Dispatcher.Invoke(UpdateView); // return; // } // Series = new SeriesCollection() // { // new CandleSeries // { // Values = new ChartValues<OhlcPoint>(_vm.Points) // } // }; // //Chart.Series = Series; //} //private void InitializeSeries(Collection<OhlcPoint> points) //{ // if (!Dispatcher.CheckAccess()) // { // Dispatcher.Invoke(new Action<Collection<OhlcPoint>>(InitializeSeries), points); // return; // } // Series = new SeriesCollection() // { // new CandleSeries // { // Values = new ChartValues<OhlcPoint>(points) // } // }; //} public override DialogViewModel ConstructDefaultViewModel(ISensorDialogModel model) { //var viewModel = new BarSensorViewModel(model); //_vm = viewModel; //_vm.PropertyChanged += ViewModel_PropertyChanged; //return viewModel; return(new BarSensorViewModel(model)); }
public void Expand(MonitoringSensorViewModel sensor) { SensorControl view = null; DialogSensorViewTypes VVMTypes = _typeToDialogDictionary[sensor.SensorType]; object viewObj = Activator.CreateInstance(VVMTypes.ViewType); view = viewObj as SensorControl; ISensorDialogModel model = _factory.ConstructModel(sensor); DialogViewModel viewModel = null; if (view != null) { if (VVMTypes.ViewModelType != null) { object viewModelObj = Activator.CreateInstance(VVMTypes.ViewModelType, model); viewModel = viewModelObj as DialogViewModel; } else { viewModel = view.ConstructDefaultViewModel(model); } } else { view = new DefaultValuesListSensorView(); viewModel = new DefaultValuesListSensorViewModel(model); } if (VVMTypes.ViewType != typeof(object)) { string title = $"{sensor.Product}/{sensor.Path}"; DialogWindow dw = new DialogWindow(view, viewModel, title); dw.Show(); } }
public abstract DialogViewModel ConstructDefaultViewModel(ISensorDialogModel model);
public BarSensorViewModel(ISensorDialogModel model) : base(model) { }
public override DialogViewModel ConstructDefaultViewModel(ISensorDialogModel model) { return(new NumericSensorViewModel(model)); }
public DefaultValuesListSensorViewModel(ISensorDialogModel model) : base(model) { RefreshCommand = new MultipleDelegateCommand(Refresh, CanRefresh); }
public DialogViewModel(ISensorDialogModel model) : base(model as ModelBase) { }
public override DialogViewModel ConstructDefaultViewModel(ISensorDialogModel model) { return(new DefaultValuesListSensorViewModel(model)); }
public NumericSensorViewModel(ISensorDialogModel model) : base(model) { }