当前位置: 首页>>代码示例>>C#>>正文


C# ISurface.SendMessageEvent方法代码示例

本文整理汇总了C#中ISurface.SendMessageEvent方法的典型用法代码示例。如果您正苦于以下问题:C# ISurface.SendMessageEvent方法的具体用法?C# ISurface.SendMessageEvent怎么用?C# ISurface.SendMessageEvent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ISurface的用法示例。


在下文中一共展示了ISurface.SendMessageEvent方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ExportCapture

 public override bool ExportCapture(ISurface surface, ICaptureDetails captureDetails)
 {
     using (Image image = surface.GetImageForExport()) {
         bool uploaded = plugin.Upload(captureDetails, image);
         if (uploaded) {
             surface.SendMessageEvent(this, SurfaceMessageTyp.Info, "Exported to Dropbox");
             surface.Modified = false;
         }
         return uploaded;
     }
 }
开发者ID:ploufs,项目名称:Greenshot-DropBox-Plugin,代码行数:11,代码来源:DropboxDestination.cs

示例2: ExportCapture

		public override ExportInformation ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) {
			ExportInformation exportInformation = new ExportInformation(Designation, Description);
			try {
				ClipboardHelper.SetClipboardData(surface);
				exportInformation.ExportMade = true;
			} catch (Exception) {
				// TODO: Change to general logic in ProcessExport
				surface.SendMessageEvent(this, SurfaceMessageTyp.Error, Language.GetString(LangKey.editor_clipboardfailed));
			}
			ProcessExport(exportInformation, surface);
			return exportInformation;
		}
开发者ID:logtcn,项目名称:greenshot,代码行数:12,代码来源:ClipboardDestination.cs

示例3: ExportCapture

        public override bool ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails)
        {
            bool outputMade = false;
            string pattern = "${title}";
            if (string.IsNullOrEmpty(pattern))
            {
                pattern = "greenshot ${capturetime}";
            }
            string filename = FilenameHelper.GetFilenameFromPattern(pattern, conf.OutputFileFormat, captureDetails);
            string filepath = FilenameHelper.FillVariables(conf.OutputFilePath, false);
            string fullPath = Path.Combine(filepath, filename);

            // Catching any exception to prevent that the user can't write in the directory.
            // This is done for e.g. bugs #2974608, #2963943, #2816163, #2795317, #2789218, #3004642
            using (Image image = surface.GetImageForExport())
            {
                try
                {
                    // TODO: For now we overwrite, but this should be fixed some time
                    ImageOutput.Save(image, fullPath, true);
                    outputMade = true;
                }
                catch (Exception e)
                {
                    LOG.Error("Error saving screenshot!", e);
                    // Show the problem
                    MessageBox.Show(Language.GetString(LangKey.error_save), Language.GetString(LangKey.error));
                    // when save failed we present a SaveWithDialog
                    fullPath = ImageOutput.SaveWithDialog(image, captureDetails);
                    outputMade = (fullPath != null);
                }
            }
            // Don't overwite filename if no output is made
            if (outputMade)
            {
                surface.LastSaveFullPath = fullPath;
                surface.Modified = false;
                captureDetails.Filename = fullPath;
                surface.SendMessageEvent(this, SurfaceMessageTyp.FileSaved, Language.GetFormattedString(LangKey.editor_imagesaved, surface.LastSaveFullPath));
            }
            else
            {
                surface.SendMessageEvent(this, SurfaceMessageTyp.Info, "");
            }
            return outputMade;
        }
开发者ID:modulexcite,项目名称:ZScreen_Google_Code,代码行数:46,代码来源:FileDestination.cs

示例4: ExportCapture

        public override bool ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails)
        {
            try {
                using (Image image = surface.GetImageForExport()) {
                    ClipboardHelper.SetClipboardData(image);
                    surface.Modified = false;
                }
                surface.SendMessageEvent(this, SurfaceMessageTyp.Info, Language.GetString(LangKey.editor_storedtoclipboard));
                return true;
            } catch (Exception) {
                surface.SendMessageEvent(this, SurfaceMessageTyp.Error, Language.GetString(LangKey.editor_clipboardfailed));
            }

            return false;
        }
开发者ID:modulexcite,项目名称:ZScreen_Google_Code,代码行数:15,代码来源:ClipboardDestination.cs

示例5: ProcessExport

		/// <summary>
		/// A small helper method to perform some default destination actions, like inform the surface of the export
		/// </summary>
		/// <param name="exportInformation"></param>
		/// <param name="surface"></param>
		public void ProcessExport(ExportInformation exportInformation, ISurface surface) {
			if (exportInformation != null && exportInformation.ExportMade) {
				if (!string.IsNullOrEmpty(exportInformation.Uri)) {
					surface.UploadURL = exportInformation.Uri;
					surface.SendMessageEvent(this, SurfaceMessageTyp.UploadedUri, Language.GetFormattedString("exported_to", exportInformation.DestinationDescription));
				} else if (!string.IsNullOrEmpty(exportInformation.Filepath)) {
					surface.LastSaveFullPath = exportInformation.Filepath;
					surface.SendMessageEvent(this, SurfaceMessageTyp.FileSaved, Language.GetFormattedString("exported_to", exportInformation.DestinationDescription));
				} else {
					surface.SendMessageEvent(this, SurfaceMessageTyp.Info, Language.GetFormattedString("exported_to", exportInformation.DestinationDescription));
				}
				surface.Modified = false;
			} else if (exportInformation != null && !string.IsNullOrEmpty(exportInformation.ErrorMessage)) {
				surface.SendMessageEvent(this, SurfaceMessageTyp.Error, Language.GetFormattedString("exported_to_error", exportInformation.DestinationDescription) + " " + exportInformation.ErrorMessage);
			}
		}
开发者ID:logtcn,项目名称:greenshot,代码行数:21,代码来源:AbstractDestination.cs

示例6: ExportCapture

 public override bool ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails)
 {
     string savedTo = null;
     using (Image image = surface.GetImageForExport()) {
         // Bug #2918756 don't overwrite path if SaveWithDialog returns null!
         savedTo = ImageOutput.SaveWithDialog(image, captureDetails);
         if (savedTo != null) {
             surface.Modified = false;
             surface.LastSaveFullPath = savedTo;
             captureDetails.Filename = savedTo;
             surface.SendMessageEvent(this, SurfaceMessageTyp.FileSaved, Language.GetFormattedString(LangKey.editor_imagesaved, surface.LastSaveFullPath));
         }
     }
     return savedTo != null;
 }
开发者ID:modulexcite,项目名称:ZScreen_Google_Code,代码行数:15,代码来源:FileWithDialogDestination.cs

示例7: ExportCapture

        public override bool ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails)
        {
            string tmpFile = captureDetails.Filename;
            if (tmpFile == null || surface.Modified) {
                using (Image image = surface.GetImageForExport()) {
                    tmpFile = ImageOutput.SaveNamedTmpFile(image, captureDetails, conf.OutputFileFormat, conf.OutputFileJpegQuality, conf.OutputFileReduceColors);
                }
            }
            if (documentCaption != null) {
                WordExporter.InsertIntoExistingDocument(documentCaption, tmpFile);
            } else {
                if (!manuallyInitiated) {
                    List<string> documents = WordExporter.GetWordDocuments();
                    if (documents != null && documents.Count > 0) {
                        List<IDestination> destinations = new List<IDestination>();
                        destinations.Add(new WordDestination());
                        foreach (string document in documents) {
                            destinations.Add(new WordDestination(document));
                        }
                        ContextMenuStrip menu = PickerDestination.CreatePickerMenu(false, surface, captureDetails, destinations);
                        PickerDestination.ShowMenuAtCursor(menu);
                        return false;
                    }
                }
                WordExporter.InsertIntoNewDocument(tmpFile);
            }
            surface.SendMessageEvent(this, SurfaceMessageTyp.Info, Language.GetFormattedString(LangKey.exported_to, Description));
            surface.Modified = false;

            return true;
        }
开发者ID:modulexcite,项目名称:ZScreen_Google_Code,代码行数:31,代码来源:WordDestination.cs

示例8: ExportCapture

 public override bool ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails)
 {
     string tmpFile = captureDetails.Filename;
     Size imageSize = Size.Empty;
     if (tmpFile == null || surface.Modified) {
         using (Image image = surface.GetImageForExport()) {
             tmpFile = ImageOutput.SaveNamedTmpFile(image, captureDetails, conf.OutputFileFormat, conf.OutputFileJpegQuality, conf.OutputFileReduceColors);
             imageSize = image.Size;
         }
     }
     if (presentationName != null) {
         PowerpointExporter.ExportToPresentation(presentationName, tmpFile, imageSize, captureDetails.Title);
     } else {
         if (!manuallyInitiated) {
             List<string> presentations = PowerpointExporter.GetPowerpointPresentations();
             if (presentations != null && presentations.Count > 0) {
                 List<IDestination> destinations = new List<IDestination>();
                 destinations.Add(new PowerpointDestination());
                 foreach (string presentation in presentations) {
                     destinations.Add(new PowerpointDestination(presentation));
                 }
                 ContextMenuStrip menu = PickerDestination.CreatePickerMenu(false, surface, captureDetails, destinations);
                 PickerDestination.ShowMenuAtCursor(menu);
                 return false;
             }
         }
         PowerpointExporter.InsertIntoNewPresentation(tmpFile, imageSize, captureDetails.Title);
     }
     surface.SendMessageEvent(this, SurfaceMessageTyp.Info, Language.GetFormattedString(LangKey.exported_to, Description));
     surface.Modified = false;
     return true;
 }
开发者ID:modulexcite,项目名称:ZScreen_Google_Code,代码行数:32,代码来源:PowerpointDestination.cs

示例9: ExportCapture

        public override bool ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails)
        {
            if (editor == null) {
                // Make sure we collect the garbage before opening the screenshot
                GC.Collect();
                GC.WaitForPendingFinalizers();

                try {
                    ImageEditorForm editorForm = new ImageEditorForm(surface, !surface.Modified); // Output made??

                    if (!string.IsNullOrEmpty(captureDetails.Filename)) {
                        editorForm.SetImagePath(captureDetails.Filename);
                    }
                    editorForm.Show();
                    editorForm.Activate();
                    LOG.Debug("Finished opening Editor");
                    return true;
                } catch (Exception e) {
                    LOG.Error(e);
                }
            } else {
                using (Bitmap image = (Bitmap)surface.GetImageForExport()) {
                    editor.Surface.AddBitmapContainer(image, 10, 10);
                }
                surface.SendMessageEvent(this, SurfaceMessageTyp.Info, Language.GetFormattedString(LangKey.exported_to, Description));
            }
            return false;
        }
开发者ID:modulexcite,项目名称:ZScreen_Google_Code,代码行数:28,代码来源:EditorDestination.cs

示例10: ExportCapture

        public override bool ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails)
        {
            if (!isOutlookUsed) {
                using (Image image = surface.GetImageForExport()) {
                    MapiMailMessage.SendImage(image, captureDetails);
                    surface.Modified = false;
                    surface.SendMessageEvent(this, SurfaceMessageTyp.Info, "Exported to " + mapiClient);
                }
                return true;
            }

            // Outlook logic
            string tmpFile = captureDetails.Filename;
            if (tmpFile == null || surface.Modified) {
                using (Image image = surface.GetImageForExport()) {
                    tmpFile = ImageOutput.SaveNamedTmpFile(image, captureDetails, conf.OutputFileFormat, conf.OutputFileJpegQuality, conf.OutputFileReduceColors);
                }
            } else {
                LOG.InfoFormat("Using already available file: {0}", tmpFile);
            }

            // Create a attachment name for the image
            string attachmentName = captureDetails.Title;
            if (!string.IsNullOrEmpty(attachmentName)) {
                attachmentName = attachmentName.Trim();
            }
            // Set default if non is set
            if (string.IsNullOrEmpty(attachmentName)) {
                attachmentName = "Greenshot Capture";
            }
            // Make sure it's "clean" so it doesn't corrupt the header
            attachmentName = Regex.Replace(attachmentName, @"[^\x20\d\w]", "");

            if (outlookInspectorCaption != null) {
                OutlookEmailExporter.ExportToInspector(outlookInspectorCaption, tmpFile, attachmentName);
            } else {
                if (!manuallyInitiated) {
                    Dictionary<string, OlObjectClass> inspectorCaptions = OutlookEmailExporter.RetrievePossibleTargets(conf.OutlookAllowExportInMeetings);
                    if (inspectorCaptions != null && inspectorCaptions.Count > 0) {
                        List<IDestination> destinations = new List<IDestination>();
                        destinations.Add(new EmailDestination());
                        foreach (string inspectorCaption in inspectorCaptions.Keys) {
                            destinations.Add(new EmailDestination(inspectorCaption, inspectorCaptions[inspectorCaption]));
                        }
                        ContextMenuStrip menu = PickerDestination.CreatePickerMenu(false, surface, captureDetails, destinations);
                        PickerDestination.ShowMenuAtCursor(menu);
                        return false;
                    }
                }
                OutlookEmailExporter.ExportToOutlook(conf.OutlookEmailFormat, tmpFile, captureDetails.Title, attachmentName);
            }
            surface.SendMessageEvent(this, SurfaceMessageTyp.Info, Language.GetFormattedString(LangKey.exported_to, Description));
            surface.Modified = false;

            // Don't know how to handle a cancel in the email

            return true;
        }
开发者ID:modulexcite,项目名称:ZScreen_Google_Code,代码行数:58,代码来源:EmailDestination.cs

示例11: ExportCapture

		public override ExportInformation ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) {
			ExportInformation exportInformation = new ExportInformation(this.Designation, this.Description);
			string tmpFile = captureDetails.Filename;
			if (tmpFile == null || surface.Modified || !Regex.IsMatch(tmpFile, @".*(\.png|\.gif|\.jpg|\.jpeg|\.tiff|\.bmp)$")) {
				tmpFile = ImageOutput.SaveNamedTmpFile(surface, captureDetails, new SurfaceOutputSettings().PreventGreenshotFormat());
			}
			if (documentCaption != null) {
				try {
					WordExporter.InsertIntoExistingDocument(documentCaption, tmpFile);
					exportInformation.ExportMade = true;
				} catch (Exception) {
					try {
						WordExporter.InsertIntoExistingDocument(documentCaption, tmpFile);
						exportInformation.ExportMade = true;
					} catch (Exception ex) {
						LOG.Error(ex);
						// TODO: Change to general logic in ProcessExport
						surface.SendMessageEvent(this, SurfaceMessageTyp.Error, Language.GetFormattedString("destination_exportfailed", Description));
					}
				}
			} else {
				if (!manuallyInitiated) {
					List<string> documents = WordExporter.GetWordDocuments();
					if (documents != null && documents.Count > 0) {
						List<IDestination> destinations = new List<IDestination>();
						destinations.Add(new WordDestination());
						foreach (string document in documents) {
							destinations.Add(new WordDestination(document));
						}
						// Return the ExportInformation from the picker without processing, as this indirectly comes from us self
						return ShowPickerMenu(false, surface, captureDetails, destinations);
					}
				}
				try {
					WordExporter.InsertIntoNewDocument(tmpFile, null, null);
					exportInformation.ExportMade = true;
				} catch(Exception) {
					// Retry once, just in case
					try {
						WordExporter.InsertIntoNewDocument(tmpFile, null, null);
						exportInformation.ExportMade = true;
					} catch (Exception ex) {
						LOG.Error(ex);
						// TODO: Change to general logic in ProcessExport
						surface.SendMessageEvent(this, SurfaceMessageTyp.Error, Language.GetFormattedString("destination_exportfailed", Description));
					}
				}
			}
			ProcessExport(exportInformation, surface);
			return exportInformation;
		}
开发者ID:logtcn,项目名称:greenshot,代码行数:51,代码来源:WordDestination.cs

示例12: ExportCapture

        public override bool ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails)
        {
            PrinterSettings printerSettings = null;
            using (Image image = surface.GetImageForExport()) {
                if (!string.IsNullOrEmpty(printerName)) {
                    printerSettings = new PrintHelper(image, captureDetails).PrintTo(printerName);
                } else if (!manuallyInitiated) {
                    PrinterSettings settings = new PrinterSettings();
                    printerSettings = new PrintHelper(image, captureDetails).PrintTo(settings.PrinterName);
                } else {
                    printerSettings = new PrintHelper(image, captureDetails).PrintWithDialog();
                }
                if (printerSettings != null) {
                    surface.Modified = false;
                    surface.SendMessageEvent(this, SurfaceMessageTyp.Info, Language.GetFormattedString(LangKey.editor_senttoprinter, printerSettings.PrinterName));
                }
            }

            return printerSettings != null;
        }
开发者ID:modulexcite,项目名称:ZScreen_Google_Code,代码行数:20,代码来源:PrinterDestination.cs

示例13: ExportCapture

 public override bool ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails)
 {
     string tmpFile = captureDetails.Filename;
     if (tmpFile == null || surface.Modified) {
         using (Image image = surface.GetImageForExport()) {
             tmpFile = ImageOutput.SaveNamedTmpFile(image, captureDetails, conf.OutputFileFormat, conf.OutputFileJpegQuality, conf.OutputFileReduceColors);
         }
     }
     if (workbookName != null) {
         ExcelExporter.InsertIntoExistingWorkbook(workbookName, tmpFile);
     } else {
         ExcelExporter.InsertIntoNewWorkbook(tmpFile);
     }
     surface.SendMessageEvent(this, SurfaceMessageTyp.Info, Language.GetFormattedString(LangKey.exported_to, Description));
     surface.Modified = false;
     return true;
 }
开发者ID:modulexcite,项目名称:ZScreen_Google_Code,代码行数:17,代码来源:ExcelDestination.cs


注:本文中的ISurface.SendMessageEvent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。