private IRPlotDeviceVisualComponent GetVisualComponentForDevice(Guid deviceId) { InteractiveWorkflow.Shell.AssertIsOnMainThread(); // If we've already assigned a plot window, reuse it IRPlotDeviceVisualComponent component = GetPlotDeviceVisualComponent(deviceId); if (component != null) { return(component); } // Recycle one that doesn't have a plot device assigned, or create a new one if none available component = GetOrCreatePlotDeviceVisualComponent(); var device = FindDevice(deviceId); component.Assign(device); _assignedVisualComponents[deviceId] = component; if (_unassignedVisualComponents.Contains(component)) { _unassignedVisualComponents.Remove(component); } return(component); }
public RPlotDeviceCommands(IRInteractiveWorkflow interactiveWorkflow, IRPlotDeviceVisualComponent visualComponent) { if (interactiveWorkflow == null) { throw new ArgumentNullException(nameof(interactiveWorkflow)); } if (visualComponent == null) { throw new ArgumentNullException(nameof(visualComponent)); } ActivatePlotDevice = new PlotDeviceActivateCommand(interactiveWorkflow, visualComponent); ExportAsImage = new PlotDeviceExportAsImageCommand(interactiveWorkflow, visualComponent); ExportAsPdf = new PlotDeviceExportAsPdfCommand(interactiveWorkflow, visualComponent); Cut = new PlotDeviceCutCopyCommand(interactiveWorkflow, visualComponent, cut: true); Copy = new PlotDeviceCutCopyCommand(interactiveWorkflow, visualComponent, cut: false); Paste = new PlotDevicePasteCommand(interactiveWorkflow, visualComponent); CopyAsBitmap = new PlotDeviceCopyAsBitmapCommand(interactiveWorkflow, visualComponent); CopyAsMetafile = new PlotDeviceCopyAsMetafileCommand(interactiveWorkflow, visualComponent); RemoveAllPlots = new PlotDeviceRemoveAllCommand(interactiveWorkflow, visualComponent); RemoveCurrentPlot = new PlotDeviceRemoveCurrentCommand(interactiveWorkflow, visualComponent); NextPlot = new PlotDeviceMoveNextCommand(interactiveWorkflow, visualComponent); PreviousPlot = new PlotDeviceMovePreviousCommand(interactiveWorkflow, visualComponent); EndLocator = new PlotDeviceEndLocatorCommand(interactiveWorkflow, visualComponent); }
public RPlotDeviceCommands(IRInteractiveWorkflow interactiveWorkflow, IRPlotDeviceVisualComponent visualComponent) { if (interactiveWorkflow == null) { throw new ArgumentNullException(nameof(interactiveWorkflow)); } if (visualComponent == null) { throw new ArgumentNullException(nameof(visualComponent)); } _interactiveWorkflow = interactiveWorkflow; _visualComponent = visualComponent; ActivatePlotDevice = new PlotDeviceActivateCommand(_interactiveWorkflow, _visualComponent); ExportAsImage = new PlotDeviceExportAsImageCommand(_interactiveWorkflow, _visualComponent); ExportAsPdf = new PlotDeviceExportAsPdfCommand(_interactiveWorkflow, _visualComponent); Cut = new PlotDeviceCutCopyCommand(_interactiveWorkflow, _visualComponent, cut: true); Copy = new PlotDeviceCutCopyCommand(_interactiveWorkflow, _visualComponent, cut: false); Paste = new PlotDevicePasteCommand(_interactiveWorkflow, _visualComponent); CopyAsBitmap = new PlotDeviceCopyAsBitmapCommand(_interactiveWorkflow, _visualComponent); CopyAsMetafile = new PlotDeviceCopyAsMetafileCommand(_interactiveWorkflow, _visualComponent); RemoveAllPlots = new PlotDeviceRemoveAllCommand(_interactiveWorkflow, _visualComponent); RemoveCurrentPlot = new PlotDeviceRemoveCurrentCommand(_interactiveWorkflow, _visualComponent); NextPlot = new PlotDeviceMoveNextCommand(_interactiveWorkflow, _visualComponent); PreviousPlot = new PlotDeviceMovePreviousCommand(_interactiveWorkflow, _visualComponent); EndLocator = new PlotDeviceEndLocatorCommand(_interactiveWorkflow, _visualComponent); }
public PlotDeviceCommand(IRInteractiveWorkflow interactiveWorkflow, IRPlotDeviceVisualComponent visualComponent) : base(interactiveWorkflow) { if (visualComponent == null) { throw new ArgumentNullException(nameof(visualComponent)); } VisualComponent = visualComponent; }
public IRPlotDeviceVisualComponent GetPlotVisualComponent(int instanceId) { _mainThread.CheckAccess(); IRPlotDeviceVisualComponent visualComponent = null; _visualComponents.TryGetValue(instanceId, out visualComponent); return(visualComponent); }
public IRPlotDeviceVisualComponent GetPlotVisualComponent(IRPlotDevice device) { _mainThread.CheckAccess(); IRPlotDeviceVisualComponent visualComponent = null; _assignedVisualComponents.TryGetValue(device.DeviceId, out visualComponent); return(visualComponent); }
public IRPlotDeviceVisualComponent GetPlotVisualComponent(int instanceId) { _shell.AssertIsOnMainThread(); IRPlotDeviceVisualComponent visualComponent = null; _visualComponents.TryGetValue(instanceId, out visualComponent); return(visualComponent); }
public IRPlotDeviceVisualComponent GetPlotVisualComponent(IRPlotDevice device) { _shell.AssertIsOnMainThread(); IRPlotDeviceVisualComponent visualComponent = null; _assignedVisualComponents.TryGetValue(device.DeviceId, out visualComponent); return(visualComponent); }
public PlotDeviceCommand(IRInteractiveWorkflow interactiveWorkflow, IRPlotDeviceVisualComponent visualComponent) : base(interactiveWorkflow) { if (visualComponent == null) { throw new ArgumentNullException(nameof(visualComponent)); } VisualComponent = visualComponent; }
public RPlotIntegrationUITest(IServiceContainer services, ContainerHostMethodFixture containerHost) { _containerHost = containerHost; _plotDeviceVisualComponentContainerFactory = services.GetService <TestRPlotDeviceVisualComponentContainerFactory>(); // Don't override the standard behavior of using the control size _plotDeviceVisualComponentContainerFactory.DeviceProperties = null; _plotHistoryVisualComponentContainerFactory = services.GetService <IRPlotHistoryVisualComponentContainerFactory>(); _workflow = services.GetService <IRInteractiveWorkflowVisualProvider>().GetOrCreate(); _plotVisual = (IRPlotManagerVisual)_workflow.Plots; _plotVisualComponent = UIThreadHelper.Instance.Invoke(() => _workflow.Plots.GetOrCreateVisualComponent(_plotDeviceVisualComponentContainerFactory, PlotWindowInstanceId)); UIThreadHelper.Instance.Invoke(() => ((IRPlotManagerVisual)_workflow.Plots).RegisterVisualComponent(_plotVisualComponent)); }
public RPlotIntegrationUITest(RComponentsMefCatalogFixture catalog, ContainerHostMethodFixture containerHost) { _containerHost = containerHost; _exportProvider = catalog.CreateExportProvider(); _exportProvider.GetExportedValue<TestRInteractiveWorkflowProvider>(); _plotDeviceVisualComponentContainerFactory = _exportProvider.GetExportedValue<TestRPlotDeviceVisualComponentContainerFactory>(); // Don't override the standard behavior of using the control size _plotDeviceVisualComponentContainerFactory.DeviceProperties = null; _plotHistoryVisualComponentContainerFactory = _exportProvider.GetExportedValue<IRPlotHistoryVisualComponentContainerFactory>(); _workflow = _exportProvider.GetExportedValue<IRInteractiveWorkflowProvider>().GetOrCreate(); _plotVisualComponent = UIThreadHelper.Instance.Invoke(() => _workflow.Plots.GetOrCreateVisualComponent(_plotDeviceVisualComponentContainerFactory, PlotWindowInstanceId)); UIThreadHelper.Instance.Invoke(() => _workflow.Plots.RegisterVisualComponent(_plotVisualComponent)); }
public RPlotIntegrationUITest(IExportProvider exportProvider, ContainerHostMethodFixture containerHost) { _containerHost = containerHost; _exportProvider = exportProvider; _exportProvider.GetExportedValue <TestRInteractiveWorkflowProvider>(); _plotDeviceVisualComponentContainerFactory = _exportProvider.GetExportedValue <TestRPlotDeviceVisualComponentContainerFactory>(); // Don't override the standard behavior of using the control size _plotDeviceVisualComponentContainerFactory.DeviceProperties = null; _plotHistoryVisualComponentContainerFactory = _exportProvider.GetExportedValue <IRPlotHistoryVisualComponentContainerFactory>(); _workflow = _exportProvider.GetExportedValue <IRInteractiveWorkflowProvider>().GetOrCreate(); _plotVisualComponent = UIThreadHelper.Instance.Invoke(() => _workflow.Plots.GetOrCreateVisualComponent(_plotDeviceVisualComponentContainerFactory, PlotWindowInstanceId)); UIThreadHelper.Instance.Invoke(() => _workflow.Plots.RegisterVisualComponent(_plotVisualComponent)); }
private void CheckEnabledCommands(IRPlotDeviceVisualComponent visualComponent, bool isFirst, bool isLast, bool anyPlot) { var deviceCommands = new RPlotDeviceCommands(_workflow, visualComponent); deviceCommands.EndLocator.Should().BeDisabled(); if (anyPlot) { deviceCommands.RemoveAllPlots.Should().BeEnabled(); deviceCommands.RemoveCurrentPlot.Should().BeEnabled(); deviceCommands.Cut.Should().BeEnabled(); deviceCommands.Copy.Should().BeEnabled(); deviceCommands.CopyAsBitmap.Should().BeEnabled(); deviceCommands.CopyAsMetafile.Should().BeEnabled(); deviceCommands.ExportAsImage.Should().BeEnabled(); deviceCommands.ExportAsPdf.Should().BeEnabled(); } else { deviceCommands.RemoveAllPlots.Should().BeDisabled(); deviceCommands.RemoveCurrentPlot.Should().BeDisabled(); deviceCommands.Cut.Should().BeDisabled(); deviceCommands.Copy.Should().BeDisabled(); deviceCommands.CopyAsBitmap.Should().BeDisabled(); deviceCommands.CopyAsMetafile.Should().BeDisabled(); deviceCommands.ExportAsImage.Should().BeDisabled(); deviceCommands.ExportAsPdf.Should().BeDisabled(); } if (isFirst || !anyPlot) { deviceCommands.PreviousPlot.Should().BeDisabled(); } else { deviceCommands.PreviousPlot.Should().BeEnabled(); } if (isLast || !anyPlot) { deviceCommands.NextPlot.Should().BeDisabled(); } else { deviceCommands.NextPlot.Should().BeEnabled(); } }
public RPlotIntegrationUITest(RComponentsMefCatalogFixture catalog, ContainerHostMethodFixture containerHost, TestMethodFixture testMethod, TestFilesFixture testFiles) { _containerHost = containerHost; _exportProvider = catalog.CreateExportProvider(); _workflowProvider = _exportProvider.GetExportedValue <TestRInteractiveWorkflowProvider>(); _workflowProvider.BrokerName = nameof(RPlotIntegrationTest); _plotDeviceVisualComponentContainerFactory = _exportProvider.GetExportedValue <TestRPlotDeviceVisualComponentContainerFactory>(); // Don't override the standard behavior of using the control size _plotDeviceVisualComponentContainerFactory.DeviceProperties = null; _plotHistoryVisualComponentContainerFactory = _exportProvider.GetExportedValue <IRPlotHistoryVisualComponentContainerFactory>(); _workflow = _exportProvider.GetExportedValue <IRInteractiveWorkflowProvider>().GetOrCreate(); _componentContainerFactory = _exportProvider.GetExportedValue <IInteractiveWindowComponentContainerFactory>(); _testMethod = testMethod.MethodInfo; _testFiles = testFiles; _plotVisualComponent = UIThreadHelper.Instance.Invoke(() => _workflow.Plots.GetOrCreateVisualComponent(_plotDeviceVisualComponentContainerFactory, PlotWindowInstanceId)); UIThreadHelper.Instance.Invoke(() => _workflow.Plots.RegisterVisualComponent(_plotVisualComponent)); }
private IRPlotDeviceVisualComponent GetOrCreatePlotDeviceVisualComponent() { IRPlotDeviceVisualComponent component = null; // If we have an unused plot window, reuse it if (_unassignedVisualComponents.Count > 0) { component = _unassignedVisualComponents[0]; } // If we have no plot window to reuse, create one if (component == null) { var containerFactory = InteractiveWorkflow.Shell.ExportProvider.GetExportedValue <IRPlotDeviceVisualComponentContainerFactory>(); component = GetOrCreateVisualComponent(containerFactory, GetUnusedInstanceId()); } return(component); }
public void RegisterVisualComponent(IRPlotDeviceVisualComponent visualComponent) { _shell.AssertIsOnMainThread(); _unassignedVisualComponents.Add(visualComponent); }
protected PlotDeviceCommand(IRInteractiveWorkflow interactiveWorkflow, IRPlotDeviceVisualComponent visualComponent) : base(interactiveWorkflow) { Check.ArgumentNull(nameof(visualComponent), visualComponent); VisualComponent = visualComponent; }
public void RegisterVisualComponent(IRPlotDeviceVisualComponent visualComponent) { _shell.AssertIsOnMainThread(); _unassignedVisualComponents.Add(visualComponent); }
public PlotDeviceRemoveCurrentCommand(IRInteractiveWorkflow interactiveWorkflow, IRPlotDeviceVisualComponent visualComponent) : base(interactiveWorkflow, visualComponent) { }
public PlotDeviceCutCopyCommand(IRInteractiveWorkflow interactiveWorkflow, IRPlotDeviceVisualComponent visualComponent, bool cut) : base(interactiveWorkflow, visualComponent) { _cut = cut; }
public PlotDeviceExportAsImageCommand(IRInteractiveWorkflow interactiveWorkflow, IRPlotDeviceVisualComponent visualComponent) : base(interactiveWorkflow, visualComponent) { }
public void RegisterVisualComponent(IRPlotDeviceVisualComponent visualComponent) { _mainThread.CheckAccess(); _unassignedVisualComponents.Add(visualComponent); }
public PlotDeviceEndLocatorCommand(IRInteractiveWorkflow interactiveWorkflow, IRPlotDeviceVisualComponent visualComponent) : base(interactiveWorkflow, visualComponent) { }
public PlotDeviceActivateCommand(IRInteractiveWorkflow interactiveWorkflow, IRPlotDeviceVisualComponent visualComponent) : base(interactiveWorkflow, visualComponent) { }
public PlotDeviceMovePreviousCommand(IRInteractiveWorkflow interactiveWorkflow, IRPlotDeviceVisualComponent visualComponent) : base(interactiveWorkflow, visualComponent) { }
public PlotDeviceCopyAsMetafileCommand(IRInteractiveWorkflow interactiveWorkflow, IRPlotDeviceVisualComponent visualComponent) : base(interactiveWorkflow, visualComponent) { }
public void RegisterVisualComponent(IRPlotDeviceVisualComponent visualComponent) { InteractiveWorkflow.Shell.AssertIsOnMainThread(); _unassignedVisualComponents.Add(visualComponent); }
public PlotDeviceRemoveCurrentCommand(IRInteractiveWorkflow interactiveWorkflow, IRPlotDeviceVisualComponent visualComponent) : base(interactiveWorkflow, visualComponent) { }
public PlotDeviceCutCopyCommand(IRInteractiveWorkflow interactiveWorkflow, IRPlotDeviceVisualComponent visualComponent, bool cut) : base(interactiveWorkflow, visualComponent) { _cut = cut; }
public PlotDevicePasteCommand(IRInteractiveWorkflow interactiveWorkflow, IRPlotDeviceVisualComponent visualComponent) : base(interactiveWorkflow, visualComponent) { }
private void CheckEnabledCommands(IRPlotDeviceVisualComponent visualComponent, bool isFirst, bool isLast, bool anyPlot) { var deviceCommands = new RPlotDeviceCommands(_workflow, visualComponent); deviceCommands.EndLocator.Should().BeDisabled(); if (anyPlot) { deviceCommands.RemoveAllPlots.Should().BeEnabled(); deviceCommands.RemoveCurrentPlot.Should().BeEnabled(); deviceCommands.Cut.Should().BeEnabled(); deviceCommands.Copy.Should().BeEnabled(); deviceCommands.CopyAsBitmap.Should().BeEnabled(); deviceCommands.CopyAsMetafile.Should().BeEnabled(); deviceCommands.ExportAsImage.Should().BeEnabled(); deviceCommands.ExportAsPdf.Should().BeEnabled(); } else { deviceCommands.RemoveAllPlots.Should().BeDisabled(); deviceCommands.RemoveCurrentPlot.Should().BeDisabled(); deviceCommands.Cut.Should().BeDisabled(); deviceCommands.Copy.Should().BeDisabled(); deviceCommands.CopyAsBitmap.Should().BeDisabled(); deviceCommands.CopyAsMetafile.Should().BeDisabled(); deviceCommands.ExportAsImage.Should().BeDisabled(); deviceCommands.ExportAsPdf.Should().BeDisabled(); } if (isFirst || !anyPlot) { deviceCommands.PreviousPlot.Should().BeDisabled(); } else { deviceCommands.PreviousPlot.Should().BeEnabled(); } if (isLast || !anyPlot) { deviceCommands.NextPlot.Should().BeDisabled(); } else { deviceCommands.NextPlot.Should().BeEnabled(); } }
public PlotDeviceMovePreviousCommand(IRInteractiveWorkflow interactiveWorkflow, IRPlotDeviceVisualComponent visualComponent) : base(interactiveWorkflow, visualComponent) { }
public PlotDeviceExportAsPdfCommand(IRInteractiveWorkflow interactiveWorkflow, IRPlotDeviceVisualComponent visualComponent) : base(interactiveWorkflow, visualComponent) { }