Beispiel #1
0
 public IVisualComponentContainer <IRPlotDeviceVisualComponent> GetOrCreate(IRPlotManager plotManager, IRSession session, int instanceId = 0)
 {
     return(GetOrCreate(instanceId, container => new RPlotDeviceVisualComponent(plotManager, null, instanceId, container, _coreShell)
     {
         TestDeviceProperties = DeviceProperties
     }));
 }
        public RPlotDeviceVisualComponent(IRPlotManager plotManager
                                          , int instanceId
                                          , IVisualComponentContainer <IRPlotDeviceVisualComponent> container
                                          , IServiceContainer services)
        {
            Check.ArgumentNull(nameof(plotManager), plotManager);
            Check.ArgumentNull(nameof(plotManager), plotManager);

            _mainThread = services.MainThread();
            _viewModel  = new RPlotDeviceViewModel(plotManager, _mainThread, instanceId);

            var control = new RPlotDeviceControl {
                DataContext = _viewModel,
            };

            _disposableBag = DisposableBag.Create <RPlotDeviceVisualComponent>()
                             .Add(() => control.ContextMenuRequested    -= Control_ContextMenuRequested)
                             .Add(() => _viewModel.DeviceNameChanged    -= ViewModel_DeviceNameChanged)
                             .Add(() => _viewModel.LocatorModeChanged   -= ViewModel_LocatorModeChanged)
                             .Add(() => _viewModel.PlotChanged          -= ViewModel_PlotChanged)
                             .Add(() => plotManager.ActiveDeviceChanged -= PlotManager_ActiveDeviceChanged);

            control.ContextMenuRequested    += Control_ContextMenuRequested;
            _viewModel.DeviceNameChanged    += ViewModel_DeviceNameChanged;
            _viewModel.LocatorModeChanged   += ViewModel_LocatorModeChanged;
            _viewModel.PlotChanged          += ViewModel_PlotChanged;
            plotManager.ActiveDeviceChanged += PlotManager_ActiveDeviceChanged;

            Control   = control;
            Container = container;
        }
Beispiel #3
0
        public RPlotHistoryViewModel(IRPlotManager plotManager, ICoreShell shell)
        {
            if (plotManager == null)
            {
                throw new ArgumentNullException(nameof(plotManager));
            }

            if (shell == null)
            {
                throw new ArgumentNullException(nameof(shell));
            }

            _plotManager = plotManager;
            _shell       = shell;

            _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, _shell, plot, plot.Image));
                }
            }
        }
        public RPlotHistoryViewModel(IRPlotManager plotManager, ICoreShell shell) {
            if (plotManager == null) {
                throw new ArgumentNullException(nameof(plotManager));
            }

            if (shell == null) {
                throw new ArgumentNullException(nameof(shell));
            }

            _plotManager = plotManager;
            _shell = shell;

            _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, _shell, plot, plot.Image));
                }
            }
        }
Beispiel #5
0
        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, 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;
        }
Beispiel #8
0
 public RPlotManagerVisualComponent(IRPlotManager plotManager, IVisualComponentContainer <IRPlotManagerVisualComponent> container, IRSettings settings, ICoreShell coreShell)
 {
     Container  = container;
     Controller = null;
     ViewModel  = new RPlotManagerViewModel(plotManager);
     Control    = new RPlotManagerControl {
         DataContext = ViewModel,
     };
 }
        public PlotHistoryWindowPane(IRPlotManager plotManager, IServiceContainer services) : base(services)
        {
            _plotManager = plotManager;

            // this value matches with icmdShowPlotWindow's Icon in VSCT file
            BitmapImageMoniker = KnownMonikers.ChartFilter;
            Caption            = Resources.PlotHistoryWindowCaption;
            ToolBar            = new System.ComponentModel.Design.CommandID(RGuidList.RCmdSetGuid, RPackageCommandId.plotHistoryWindowToolBarId);
        }
Beispiel #10
0
        public RPlotDeviceViewModel(IRPlotManager plotManager, IMainThread mainThread, int instanceId)
        {
            Check.ArgumentNull(nameof(plotManager), plotManager);
            Check.ArgumentNull(nameof(mainThread), mainThread);

            _plotManager   = plotManager;
            _mainThread    = mainThread;
            InstanceId     = instanceId;
            _showWatermark = true;
        }
        public IVisualComponentContainer <IRPlotManagerVisualComponent> GetOrCreate(IRPlotManager plotManager, IRSession session, int instanceId = 0)
        {
            var workflow = _workflowProvider.GetOrCreate();

            if (workflow.ActiveWindow == null)
            {
                VsAppShell.Current.DispatchOnUIThread(() => workflow.GetOrCreateVisualComponent(_componentContainerFactory).DoNotWait());
            }
            return(GetOrCreate(instanceId, i => new PlotManagerWindowPane(plotManager, session, RToolsSettings.Current, VsAppShell.Current)));
        }
Beispiel #12
0
        public PlotManagerWindowPane(IRPlotManager plotManager, IRSettings settings, ICoreShell coreShell)
        {
            _plotManager = plotManager;
            _settings    = settings;
            _coreShell   = coreShell;

            // this value matches with icmdShowPlotWindow's Icon in VSCT file
            BitmapImageMoniker = KnownMonikers.LineChart;
            Caption            = Resources.PlotWindowCaption;
            ToolBar            = new CommandID(RGuidList.RCmdSetGuid, RPackageCommandId.plotWindowToolBarId);
        }
Beispiel #13
0
        public RPlotHistoryEntryViewModel(IRPlotManager plotManager, IMainThread mainThread, IRPlot plot, object plotImage)
        {
            Check.ArgumentNull(nameof(plotManager), plotManager);
            Check.ArgumentNull(nameof(mainThread), mainThread);
            Check.ArgumentNull(nameof(plot), plot);
            Check.ArgumentNull(nameof(plotImage), plotImage);

            _plotManager = plotManager;
            _mainThread  = mainThread;
            _plot        = plot;
            _plotImage   = plotImage;

            RefreshDeviceName();
        }
Beispiel #14
0
        public RPlotDeviceViewModel(IRPlotManager plotManager, ICoreShell shell, int instanceId) {
            if (plotManager == null) {
                throw new ArgumentNullException(nameof(plotManager));
            }

            if (shell == null) {
                throw new ArgumentNullException(nameof(shell));
            }

            _plotManager = plotManager;
            _shell = shell;
            InstanceId = instanceId;
            _showWatermark = true;
        }
        public RPlotDeviceViewModel(IRPlotManager plotManager, ICoreShell shell, int instanceId)
        {
            if (plotManager == null)
            {
                throw new ArgumentNullException(nameof(plotManager));
            }

            if (shell == null)
            {
                throw new ArgumentNullException(nameof(shell));
            }

            _plotManager   = plotManager;
            _shell         = shell;
            InstanceId     = instanceId;
            _showWatermark = true;
        }
Beispiel #16
0
        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;
        }
Beispiel #17
0
        public RPlotDeviceVisualComponent(IRPlotManager plotManager, ICommandTarget controller, int instanceId, IVisualComponentContainer <IRPlotDeviceVisualComponent> 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 RPlotDeviceViewModel(plotManager, coreShell, instanceId);
            _shell       = coreShell;

            var control = new RPlotDeviceControl {
                DataContext = _viewModel,
            };

            _disposableBag = DisposableBag.Create <RPlotDeviceVisualComponent>()
                             .Add(() => control.ContextMenuRequested     -= Control_ContextMenuRequested)
                             .Add(() => _viewModel.DeviceNameChanged     -= ViewModel_DeviceNameChanged)
                             .Add(() => _viewModel.LocatorModeChanged    -= ViewModel_LocatorModeChanged)
                             .Add(() => _viewModel.PlotChanged           += ViewModel_PlotChanged)
                             .Add(() => _plotManager.ActiveDeviceChanged += PlotManager_ActiveDeviceChanged);

            control.ContextMenuRequested     += Control_ContextMenuRequested;
            _viewModel.DeviceNameChanged     += ViewModel_DeviceNameChanged;
            _viewModel.LocatorModeChanged    += ViewModel_LocatorModeChanged;
            _viewModel.PlotChanged           += ViewModel_PlotChanged;
            _plotManager.ActiveDeviceChanged += PlotManager_ActiveDeviceChanged;

            Control    = control;
            Controller = controller;
            Container  = container;
        }
        public RPlotHistoryEntryViewModel(IRPlotManager plotManager, ICoreShell shell, IRPlot plot, BitmapImage plotImage) {
            if (plotManager == null) {
                throw new ArgumentNullException(nameof(plotManager));
            }

            if (shell == null) {
                throw new ArgumentNullException(nameof(shell));
            }

            if (plot == null) {
                throw new ArgumentNullException(nameof(plot));
            }

            _plotManager = plotManager;
            _shell = shell;
            _plot = plot;
            _plotImage = plotImage;

            RefreshDeviceName();
        }
        public RPlotDeviceVisualComponent(IRPlotManager plotManager, ICommandTarget controller, int instanceId, IVisualComponentContainer<IRPlotDeviceVisualComponent> 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 RPlotDeviceViewModel(plotManager, coreShell, instanceId);
            _shell = coreShell;

            var control = new RPlotDeviceControl {
                DataContext = _viewModel,
            };

            _disposableBag = DisposableBag.Create<RPlotDeviceVisualComponent>()
                .Add(() => control.ContextMenuRequested -= Control_ContextMenuRequested)
                .Add(() => _viewModel.DeviceNameChanged -= ViewModel_DeviceNameChanged)
                .Add(() => _viewModel.LocatorModeChanged -= ViewModel_LocatorModeChanged)
                .Add(() => _viewModel.PlotChanged += ViewModel_PlotChanged)
                .Add(() => _plotManager.ActiveDeviceChanged += PlotManager_ActiveDeviceChanged);

            control.ContextMenuRequested += Control_ContextMenuRequested;
            _viewModel.DeviceNameChanged += ViewModel_DeviceNameChanged;
            _viewModel.LocatorModeChanged += ViewModel_LocatorModeChanged;
            _viewModel.PlotChanged += ViewModel_PlotChanged;
            _plotManager.ActiveDeviceChanged += PlotManager_ActiveDeviceChanged;

            Control = control;
            Controller = controller;
            Container = container;
        }
Beispiel #20
0
        public RPlotHistoryEntryViewModel(IRPlotManager plotManager, ICoreShell shell, IRPlot plot, BitmapImage plotImage)
        {
            if (plotManager == null)
            {
                throw new ArgumentNullException(nameof(plotManager));
            }

            if (shell == null)
            {
                throw new ArgumentNullException(nameof(shell));
            }

            if (plot == null)
            {
                throw new ArgumentNullException(nameof(plot));
            }

            _plotManager = plotManager;
            _shell       = shell;
            _plot        = plot;
            _plotImage   = plotImage;

            RefreshDeviceName();
        }
 public IVisualComponentContainer <IRPlotManagerVisualComponent> GetOrCreate(IRPlotManager plotManager, IRSession session, int instanceId = 0)
 {
     return(GetOrCreate(instanceId, container => new RPlotManagerVisualComponent(plotManager, container, session, _settings, _coreShell)));
 }
Beispiel #22
0
 public RPlotManagerViewModel(IRPlotManager plotManager)
 {
     _plotManager   = plotManager;
     _showWatermark = true;
 }
 public IVisualComponentContainer <IRPlotHistoryVisualComponent> GetOrCreate(IRPlotManager plotManager, int instanceId = 0)
 {
     return(GetOrCreate(instanceId, i => new PlotHistoryWindowPane(plotManager, i, RToolsSettings.Current, VsAppShell.Current)));
 }
Beispiel #24
0
 public ShowPlotWindowCommand(IApplicationShell appShell, IRInteractiveWorkflow workflow)
 {
     _plotManager = workflow.Plots;
     _shell       = appShell.GlobalServices.GetService <IVsUIShell4>(typeof(SVsUIShell));
 }
 public IVisualComponentContainer <IRPlotHistoryVisualComponent> GetOrCreate(IRPlotManager plotManager, int instanceId = 0)
 => GetOrCreate(instanceId, i => new PlotHistoryWindowPane(plotManager, _coreShell.Services));
Beispiel #26
0
 public ShowPlotWindowCommand(IApplicationShell appShell, IRInteractiveWorkflow workflow) {
     _plotManager = workflow.Plots;
     _shell = appShell.GetGlobalService<IVsUIShell4>(typeof(SVsUIShell));
 }
 public IVisualComponentContainer <IRPlotDeviceVisualComponent> GetOrCreate(IRPlotManager plotManager, IRSession session, int instanceId = 0)
 {
     return(GetOrCreate(instanceId, i => new PlotDeviceWindowPane(plotManager, session, i, RToolsSettings.Current, VsAppShell.Current)));
 }
Beispiel #28
0
 public static IRPlotHistoryVisualComponent GetOrCreateVisualComponent(this IRPlotManager pm, IRPlotHistoryVisualComponentContainerFactory factory, int id)
 => ((IRPlotManagerVisual)pm).GetOrCreateVisualComponent(factory, id);
 public IVisualComponentContainer <IRPlotHistoryVisualComponent> GetOrCreate(IRPlotManager plotManager, int instanceId = 0)
 {
     return(GetOrCreate(instanceId, container => new RPlotHistoryVisualComponent(plotManager, container, _coreShell.Services)));
 }