Esempio n. 1
0
 public async Task Plot(PlotMessage plot, CancellationToken ct)
 {
     await Console.Error.WriteLineAsync(plot.FilePath);
 }
Esempio n. 2
0
 public Task Plot(PlotMessage plot, CancellationToken ct)
 {
     PlotResult = plot.Data;
     return(Task.CompletedTask);
 }
Esempio n. 3
0
 public async Task Plot(PlotMessage plot, CancellationToken ct) {
     await Console.Error.WriteLineAsync(plot.FilePath);
 }
Esempio n. 4
0
 /// <summary>
 /// Displays R plot in the host app-provided window
 /// </summary>
 public Task Plot(PlotMessage plot, CancellationToken ct)
     => _workflow.Plots.LoadPlotAsync(plot, ct);
Esempio n. 5
0
        public async Task LoadPlotAsync(PlotMessage plot, CancellationToken cancellationToken) {
            await _shell.SwitchToMainThreadAsync(cancellationToken);

            var device = FindDevice(plot.DeviceId);
            device.DeviceNum = plot.DeviceNum;

            if (plot.IsClearAll) {
                device.Clear();
            } else if (plot.IsPlot) {
                try {
                    var img = plot.ToBitmapImage();

                    // Remember the size of the last plot.
                    // We'll use that when exporting the plot to image/pdf.
                    device.PixelWidth = img.PixelWidth;
                    device.PixelHeight = img.PixelHeight;
                    device.Resolution = (int)Math.Round(img.DpiX);

                    device.AddOrUpdate(plot.PlotId, img);
                } catch (Exception e) when (!e.IsCriticalException()) {
                }
            } else if (plot.IsError) {
                device.AddOrUpdate(plot.PlotId, null);
            }

            var visualComponent = GetVisualComponentForDevice(plot.DeviceId);
            if (visualComponent != null) {
                visualComponent.Container.Show(focus: false, immediate: false);
                visualComponent.Container.UpdateCommandStatus(false);
            }
        }