public async Task <PlotDeviceProperties> DeviceCreatedAsync(Guid deviceId, CancellationToken cancellationToken) { await _shell.SwitchToMainThreadAsync(cancellationToken); var device = new RPlotDevice(deviceId); lock (_devicesLock) { _devices.Add(device); } PlotDeviceProperties props; var visualComponent = GetVisualComponentForDevice(deviceId); if (visualComponent != null) { visualComponent.Container.Show(focus: false, immediate: true); props = visualComponent.GetDeviceProperties(); } else { Debug.Assert(false, "Failed to create a plot visual component."); props = PlotDeviceProperties.Default; } device.PixelWidth = props.Width; device.PixelHeight = props.Height; device.Resolution = props.Resolution; DeviceAdded?.Invoke(this, new RPlotDeviceEventArgs(device)); return(props); }
public async Task <PlotDeviceProperties> DeviceCreatedAsync(Guid deviceId) { InteractiveWorkflow.Shell.AssertIsOnMainThread(); var device = new RPlotDevice(deviceId); _devices.Add(device); PlotDeviceProperties props; var visualComponent = await GetVisualComponentForDevice(deviceId); if (visualComponent != null) { visualComponent.Container.Show(focus: false, immediate: true); props = visualComponent.GetDeviceProperties(); } else { Debug.Assert(false, "Failed to create a plot visual component."); props = PlotDeviceProperties.Default; } device.PixelWidth = props.Width; device.PixelHeight = props.Height; device.Resolution = props.Resolution; DeviceAdded?.Invoke(this, new RPlotDeviceEventArgs(device)); return(props); }
public async Task<PlotDeviceProperties> DeviceCreatedAsync(Guid deviceId, CancellationToken cancellationToken) { await _shell.SwitchToMainThreadAsync(cancellationToken); var device = new RPlotDevice(deviceId); _devices.Add(device); PlotDeviceProperties props; var visualComponent = GetVisualComponentForDevice(deviceId); if (visualComponent != null) { visualComponent.Container.Show(focus: false, immediate: true); props = visualComponent.GetDeviceProperties(); } else { Debug.Assert(false, "Failed to create a plot visual component."); props = PlotDeviceProperties.Default; } device.PixelWidth = props.Width; device.PixelHeight = props.Height; device.Resolution = props.Resolution; DeviceAdded?.Invoke(this, new RPlotDeviceEventArgs(device)); return props; }