Inheritance: IRPlotDevice
Esempio n. 1
0
        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);
        }
Esempio n. 2
0
        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);
        }
Esempio n. 3
0
        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;
        }