Beispiel #1
0
        protected override void Handle()
        {
            string destinationFilePath = _appShell.BrowseForFileSave(IntPtr.Zero, Resources.PlotExportAsPdfFilter, null, Resources.ExportPlotAsPdfDialogTitle);

            if (!string.IsNullOrEmpty(destinationFilePath))
            {
                PlotHistory.PlotContentProvider.ExportAsPdf(destinationFilePath);
            }
        }
Beispiel #2
0
        public override CommandResult Invoke(Guid group, int id, object inputArg, ref object outputArg)
        {
            var initialPath = RToolsSettings.Current.WorkingDirectory != null?PathHelper.EnsureTrailingSlash(RToolsSettings.Current.WorkingDirectory) : null;

            var file = _appShell.BrowseForFileSave(IntPtr.Zero, Resources.HistoryFileFilter, initialPath, Resources.SaveHistoryAsTitle);

            if (file != null)
            {
                _history.TrySaveToFile(file);
            }

            return(CommandResult.Executed);
        }
Beispiel #3
0
        protected override void Handle()
        {
            var projectService    = _projectServiceAccessor.GetProjectService();
            var lastLoadedProject = projectService.LoadedUnconfiguredProjects.LastOrDefault();

            var initialPath = lastLoadedProject != null?lastLoadedProject.GetProjectDirectory() : Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);

            var file = _appShell.BrowseForFileSave(IntPtr.Zero, Resources.WorkspaceFileFilter, initialPath, Resources.SaveWorkspaceAsTitle);

            if (file == null)
            {
                return;
            }

            SaveWorkspace(file).DoNotWait();
        }
        protected override void Handle()
        {
            string destinationFilePath = _appShell.BrowseForFileSave(IntPtr.Zero, Resources.PlotExportAsImageFilter, null, Resources.ExportPlotAsImageDialogTitle);

            if (!string.IsNullOrEmpty(destinationFilePath))
            {
                string device    = string.Empty;
                string extension = Path.GetExtension(destinationFilePath).TrimStart('.').ToLowerInvariant();
                switch (extension)
                {
                case "png":
                    device = "png";
                    break;

                case "bmp":
                    device = "bmp";
                    break;

                case "tif":
                case "tiff":
                    device = "tiff";
                    break;

                case "jpg":
                case "jpeg":
                    device = "jpeg";
                    break;

                default:
                    VsAppShell.Current.ShowErrorMessage(string.Format(CultureInfo.InvariantCulture, Resources.PlotExportUnsupportedImageFormat, extension));
                    return;
                }

                PlotHistory.PlotContentProvider.ExportAsImage(destinationFilePath, device);
            }
        }