Ejemplo n.º 1
0
 public async Task Plot(PlotMessage plot, CancellationToken ct)
 {
     await Console.Error.WriteLineAsync(plot.FilePath);
 }
Ejemplo n.º 2
0
 public Task Plot(PlotMessage plot, CancellationToken ct)
 {
     PlotResult = plot.Data;
     return(Task.CompletedTask);
 }
Ejemplo n.º 3
0
 public async Task Plot(PlotMessage plot, CancellationToken ct) {
     await Console.Error.WriteLineAsync(plot.FilePath);
 }
Ejemplo 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);
Ejemplo 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);
            }
        }