/// <summary> /// sets InitialDirectory and FileName property of a SaveFileDialog smartly, considering default pattern and last used path /// </summary> /// <param name="sfd">a SaveFileDialog instance</param> private void ApplySuggestedValues() { // build the full path and set dialog properties string filenameFromPattern = FilenameHelper.GetFilenameWithoutExtensionFromPattern(conf.OutputFileFilenamePattern, captureDetails); FileName = Path.GetFileNameWithoutExtension(filenameFromPattern); Extension = Path.GetExtension(filenameFromPattern); }
public override ExportInformation ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) { ExportInformation exportInformation = new ExportInformation(this.Designation, this.Description); // force password check to take place before the pages load if (!ConfluencePlugin.ConfluenceConnector.isLoggedIn) { return(exportInformation); } Page selectedPage = page; bool openPage = (page == null) && config.OpenPageAfterUpload; string filename = FilenameHelper.GetFilenameWithoutExtensionFromPattern(coreConfig.OutputFileFilenamePattern, captureDetails); if (selectedPage == null) { ConfluenceUpload confluenceUpload = new ConfluenceUpload(filename); Nullable <bool> dialogResult = confluenceUpload.ShowDialog(); if (dialogResult.HasValue && dialogResult.Value) { selectedPage = confluenceUpload.SelectedPage; if (confluenceUpload.isOpenPageSelected) { openPage = false; } filename = confluenceUpload.Filename; } } string extension = "." + config.UploadFormat; if (!filename.ToLower().EndsWith(extension)) { filename = filename + extension; } if (selectedPage != null) { string errorMessage; bool uploaded = upload(surface, selectedPage, filename, out errorMessage); if (uploaded) { if (openPage) { try { Process.Start(selectedPage.Url); } catch { } } exportInformation.ExportMade = true; exportInformation.Uri = selectedPage.Url; } else { exportInformation.ErrorMessage = errorMessage; } } ProcessExport(exportInformation, surface); return(exportInformation); }
protected override ExportInformation ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) { var exportInformation = new ExportInformation(Designation, Description); // force password check to take place before the pages load var selectedPage = _page; var openPage = _page == null && _confluenceConfiguration.OpenPageAfterUpload; var filename = FilenameHelper.GetFilenameWithoutExtensionFromPattern(_confluenceConfiguration.OutputFileFilenamePattern, captureDetails); if (selectedPage == null) { } var extension = "." + _confluenceConfiguration.UploadFormat; if (!filename.ToLower().EndsWith(extension)) { filename = filename + extension; } if (selectedPage != null) { var uploaded = Upload(surface, selectedPage, filename, out var errorMessage); if (uploaded) { if (openPage) { try { Process.Start(selectedPage.Links.WebUi); } catch { // Ignore } } exportInformation.ExportMade = true; exportInformation.Uri = selectedPage.Links.WebUi; } else { exportInformation.ErrorMessage = errorMessage; } } ProcessExport(exportInformation, surface); return(exportInformation); }
protected override ExportInformation ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) { var exportInformation = new ExportInformation(Designation, Description); // force password check to take place before the pages load if (!_confluenceConnector.IsLoggedIn) { return(exportInformation); } var selectedPage = _page; var openPage = _page == null && _confluenceConfiguration.OpenPageAfterUpload; var filename = FilenameHelper.GetFilenameWithoutExtensionFromPattern(_coreConfiguration.OutputFileFilenamePattern, captureDetails); if (selectedPage == null) { var confluenceUpload = new ConfluenceUpload(_confluenceConnector, filename); var dialogResult = confluenceUpload.ShowDialog(); if (dialogResult.HasValue && dialogResult.Value) { selectedPage = confluenceUpload.SelectedPage; if (confluenceUpload.IsOpenPageSelected) { openPage = false; } filename = confluenceUpload.Filename; } } var extension = "." + _confluenceConfiguration.UploadFormat; if (!filename.ToLower().EndsWith(extension)) { filename = filename + extension; } if (selectedPage != null) { var uploaded = Upload(surface, selectedPage, filename, out var errorMessage); if (uploaded) { if (openPage) { try { Process.Start(selectedPage.Url); } catch { // Ignore } } exportInformation.ExportMade = true; exportInformation.Uri = selectedPage.Url; } else { exportInformation.ErrorMessage = errorMessage; } } ProcessExport(exportInformation, surface); return(exportInformation); }