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);
        }
Esempio n. 2
0
		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;
		}