public RPlotHistoryViewModel(RPlotHistoryControl control, IRPlotManager plotManager, IMainThread mainThread) { Check.ArgumentNull(nameof(control), control); Check.ArgumentNull(nameof(plotManager), plotManager); Check.ArgumentNull(nameof(mainThread), mainThread); _control = control; _plotManager = plotManager; _mainThread = mainThread; _disposableBag = DisposableBag.Create <RPlotHistoryViewModel>() .Add(() => _plotManager.DeviceAdded -= DeviceAdded) .Add(() => _plotManager.DeviceRemoved -= DeviceRemoved); _plotManager.DeviceAdded += DeviceAdded; _plotManager.DeviceRemoved += DeviceRemoved; foreach (var group in _plotManager.GetAllPlots().GroupBy(p => p.ParentDevice)) { SubscribeDeviceEvents(group.Key); foreach (var plot in group) { Entries.Add(new RPlotHistoryEntryViewModel(_plotManager, _mainThread, plot, plot.Image)); } } }
public RPlotHistoryVisualComponent(IRPlotManager plotManager, ICommandTarget controller, IVisualComponentContainer <IRPlotHistoryVisualComponent> container, ICoreShell coreShell) { if (plotManager == null) { throw new ArgumentNullException(nameof(plotManager)); } if (container == null) { throw new ArgumentNullException(nameof(container)); } if (coreShell == null) { throw new ArgumentNullException(nameof(coreShell)); } _plotManager = plotManager; _viewModel = new RPlotHistoryViewModel(plotManager, coreShell); _shell = coreShell; var control = new RPlotHistoryControl { DataContext = _viewModel }; _disposableBag = DisposableBag.Create <RPlotDeviceVisualComponent>() .Add(() => control.ContextMenuRequested -= Control_ContextMenuRequested); control.ContextMenuRequested += Control_ContextMenuRequested; Control = control; Controller = controller; Container = container; }
public RPlotHistoryVisualComponent(IRPlotManager plotManager, IVisualComponentContainer <IRPlotHistoryVisualComponent> container, IServiceContainer services) { Check.ArgumentNull(nameof(plotManager), plotManager); Check.ArgumentNull(nameof(container), container); Check.ArgumentNull(nameof(services), services); var control = new RPlotHistoryControl(); _viewModel = new RPlotHistoryViewModel(control, plotManager, services.MainThread()); control.DataContext = _viewModel; _disposableBag = DisposableBag.Create <RPlotDeviceVisualComponent>() .Add(() => control.ContextMenuRequested -= Control_ContextMenuRequested); control.ContextMenuRequested += Control_ContextMenuRequested; Control = control; Container = container; }