Here are the examples of the csharp api class System.Windows.Forms.Clipboard.SetDataObject(object, bool) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
69 Examples
0
1. Example
Project: PoESkillTree
Source File: MainWindow.xaml.cs
Source File: MainWindow.xaml.cs
private async Task ShowPoeUrlMessageAndAddToClipboard(string poeurl) { try { System.Windows.Forms.Clipboard.SetDataObject(poeurl, true); await this.ShowInfoAsync(L10n.Message("The PoEUrl link has been copied to Clipboard.") + "\n\n" + poeurl); } catch (Exception ex) { await this.ShowErrorAsync(L10n.Message("An error occurred while copying to Clipboard."), ex.Message); } }
0
2. Example
Project: DeOps
Source File: PacketsForm.cs
Source File: PacketsForm.cs
private void TreeViewPacket_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e) { if(e.Control && e.KeyCode == Keys.C) Clipboard.SetDataObject(TreeViewPacket.SelectedNode.Text, true); }
0
3. Example
Project: SquareOne
Source File: ExceptionsControl.Clipboard.cs
Source File: ExceptionsControl.Clipboard.cs
void copyExceptionsSelected_toClipboard() { Clipboard.SetDataObject(this.exceptionsSelectedInTree_AsString, true); }
0
4. Example
Project: logwizard
Source File: clipboard_util.cs
Source File: clipboard_util.cs
public static void copy(string html, string plain) { var dataObject = new_data_object(html, plain); Clipboard.SetDataObject(dataObject, true); }
0
5. Example
Project: TDMaker
Source File: ZedGraphControl.ContextMenu.cs
Source File: ZedGraphControl.ContextMenu.cs
private void ClipboardCopyThread() { Clipboard.SetDataObject( ImageRender(), true ); }
0
6. Example
Project: HTML-Renderer
Source File: ClipboardHelper.cs
Source File: ClipboardHelper.cs
public static void CopyToClipboard(string html, string plainText) { var dataObject = CreateDataObject(html, plainText); Clipboard.SetDataObject(dataObject, true); }
0
7. Example
Project: HTML-Renderer
Source File: ClipboardHelper.cs
Source File: ClipboardHelper.cs
public static void CopyToClipboard(string plainText) { var dataObject = new DataObject(); dataObject.SetData(DataFormats.Text, plainText); dataObject.SetData(DataFormats.UnicodeText, plainText); Clipboard.SetDataObject(dataObject, true); }
0
8. Example
Project: poderosa
Source File: BasicCommands.cs
Source File: BasicCommands.cs
private void CopyToClipboard(string data) { try { Clipboard.SetDataObject(data, false); } catch (Exception ex) { RuntimeUtil.ReportException(ex); } }
0
9. Example
Project: poderosa
Source File: CommandResultPopup.cs
Source File: CommandResultPopup.cs
private void CopyToClipboard(string data) { try { Clipboard.SetDataObject(data, false); } catch (Exception ex) { RuntimeUtil.ReportException(ex); } }
0
10. Example
Project: poderosa
Source File: TerminalCommands.cs
Source File: TerminalCommands.cs
private static void CopyToClipboard(string data) { try { Clipboard.SetDataObject(data, false); } catch (Exception ex) { RuntimeUtil.ReportException(ex); } }
0
11. Example
Project: Florence
Source File: PlotControl.cs
Source File: PlotControl.cs
public void CopyDataToClipboard() { System.Text.StringBuilder sb = new System.Text.StringBuilder(); for (int i=0; i<this.InteractivePlotSurface2D.Drawables.Count; ++i) { IPlot plot = this.InteractivePlotSurface2D.Drawables[i] as IPlot; if (plot != null) { Axis xAxis = this.InteractivePlotSurface2D.WhichXAxis( plot ); Axis yAxis = this.InteractivePlotSurface2D.WhichYAxis( plot ); RectangleD region = new RectangleD( xAxis.WorldMin, yAxis.WorldMin, xAxis.WorldMax - xAxis.WorldMin, yAxis.WorldMax - yAxis.WorldMin ); plot.WriteData( sb, region, true ); } } Clipboard.SetDataObject( sb.ToString(), true ); }
0
12. Example
Project: QTTabBar
Source File: QTTabBarClass.cs
Source File: QTTabBarClass.cs
internal static void SetStringClipboard(string str) { try { Clipboard.SetDataObject(str, true); if(!QTUtility.CheckConfig(Settings.DisableSound)) { SystemSounds.Asterisk.Play(); } } catch { SystemSounds.Hand.Play(); } }
0
13. Example
Project: ZedGraph
Source File: ZedGraphControl.ContextMenu.cs
Source File: ZedGraphControl.ContextMenu.cs
private void ClipboardCopyThread() { Clipboard.SetDataObject( ImageRender(), true ); }
0
14. Example
Project: Zydeo
Source File: ClipboardHelper.cs
Source File: ClipboardHelper.cs
public static void CopyToClipboard(string html, string plainText) { var dataObject = CreateDataObject(html, plainText); Clipboard.SetDataObject(dataObject, true); }
0
15. Example
Project: ClearCanvas
Source File: CannedTextSummaryComponentControl.cs
Source File: CannedTextSummaryComponentControl.cs
private void _component_CopyCannedTextRequested(object sender, EventArgs e) { string fullCannedText = _component.GetFullCannedText(); if (!string.IsNullOrEmpty(fullCannedText)) Clipboard.SetDataObject(fullCannedText, true); }
0
16. Example
Project: AzureKeyVaultExplorer
Source File: PropertyObject.cs
Source File: PropertyObject.cs
public void CopyToClipboard(bool showToast) { var dataObj = GetClipboardValue(); if (null != dataObj) { Clipboard.SetDataObject(dataObj, true); Utils.ClearCliboard(Settings.Default.CopyToClipboardTimeToLive, Microsoft.Vault.Library.Utils.CalculateMd5(dataObj.GetText())); if (showToast) { Utils.ShowToast($"{(_contentType.IsCertificate() ? "Certificate" : "Secret")} {Name} copied to clipboard"); } } }
0
17. Example
Project: SeleniumBasic
Source File: Image.cs
Source File: Image.cs
public IRange ToExcel(object target = null, bool autoDispose = true) { IRange range = ExcelExt.GetRange(target); Clipboard.SetDataObject(_bitmap, false); range.Worksheet.Paste(range, _bitmap); Clipboard.Clear(); if (autoDispose) _bitmap.Dispose(); return range; }
0
18. Example
Project: AutomateThePlanet
Source File: ClipBoardManager.cs
Source File: ClipBoardManager.cs
public static void CopyToClipboard(T objectToCopy) { var format = DataFormats.GetFormat(typeof(T).FullName); IDataObject dataObj = new DataObject(); dataObj.SetData(format.Name, false, objectToCopy); Clipboard.SetDataObject(dataObj, false); }
0
19. Example
Project: AutomateThePlanet
Source File: ClipBoardManager.cs
Source File: ClipBoardManager.cs
public static void CopyToClipboard(T objectToCopy) { // register my custom data format with Windows or get it if it's already registered DataFormats.Format format = DataFormats.GetFormat(typeof(T).FullName); // now copy to clipboard IDataObject dataObj = new DataObject(); dataObj.SetData(format.Name, false, objectToCopy); Clipboard.SetDataObject(dataObj, false); }
0
20. Example
Project: tfsprod
Source File: MergeWIControl.cs
Source File: MergeWIControl.cs
private void toolDClipboard_Click(object sender, EventArgs e) { string res = String.Format("Changeset={0}, WorkItem={1}, Date={2}, ServerPath={3}", ClickedItem.ChangesetID, ClickedItem.WorkitemID, ClickedItem.date, ClickedItem.sourcePath); Clipboard.Clear(); Clipboard.SetDataObject(res, true); }
0
21. Example
Project: mwinapi
Source File: ClipboardEntry.cs
Source File: ClipboardEntry.cs
internal void CopyToClipboard() { if (empty) { Clipboard.Clear(); } else { DataObject o = new DataObject(); foreach (KeyValuePair<string, object> p in entries) { o.SetData(p.Key, false, p.Value); } Clipboard.SetDataObject(o, true); } }
0
22. Example
Project: nHydrate
Source File: DebugConsole.cs
Source File: DebugConsole.cs
private void OutputView_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e) { if(e.Modifiers == Keys.Control && e.KeyCode == Keys.C) { var clipboardText = new StringBuilder(); foreach(ListViewItem lvi in OutputView.SelectedItems) { clipboardText.Append(lvi.SubItems[2].Text).Append("\r\n"); } Clipboard.SetDataObject(clipboardText.ToString(), true); } }
0
23. Example
Project: OpenLiveWriter
Source File: DiagnosticsConsole.cs
Source File: DiagnosticsConsole.cs
private void Copy() { // Instantiate the data object. DataObject dataObject = new DataObject(); // Set a Text format with the selected entries string. dataObject.SetData(DataFormats.Text, SelectedEntriesString()); // Finally, set the data object on the clipboard. Clipboard.SetDataObject(dataObject, true); }
0
24. Example
Project: openHistorian
Source File: PlotSurface2D.cs
Source File: PlotSurface2D.cs
public void CopyToClipboard() { System.Drawing.Bitmap b = new System.Drawing.Bitmap(this.Width, this.Height); Graphics g = Graphics.FromImage(b); g.Clear(Color.White); this.Draw(g, new Rectangle(0, 0, b.Width - 1, b.Height - 1)); Clipboard.SetDataObject(b, true); }
0
25. Example
Project: tfsprod
Source File: MergeWIControl.cs
Source File: MergeWIControl.cs
private void ctxMenuChangesets_ItemClicked(object sender, ToolStripItemClickedEventArgs e) {/n ..... /n //View Source file for more details /n }
0
26. Example
Project: Florence
Source File: PlotControl.cs
Source File: PlotControl.cs
public void CopyToClipboard() { System.Drawing.Bitmap b = new System.Drawing.Bitmap( this.Width, this.Height ); System.Drawing.Graphics g = Graphics.FromImage( b ); g.Clear(Color.White); this.Draw( g, new Rectangle( 0, 0, b.Width-1, b.Height-1 ) ); Clipboard.SetDataObject( b, true ); }
0
27. Example
Project: ShareX
Source File: ClipboardHelper.cs
Source File: ClipboardHelper.cs
private static void SetDataObject(IDataObject ido, bool copy) { lock (clipboardL/n ..... /n //View Source file for more details /n }
0
28. Example
Project: ShareX
Source File: ClipboardHelper.cs
Source File: ClipboardHelper.cs
private static void SetDataObject(IDataObject ido, bool copy) { lock (clipboardL/n ..... /n //View Source file for more details /n }
0
29. Example
Project: Cropper
Source File: ClipboardFormat.cs
Source File: ClipboardFormat.cs
protected override void ImageCaptured(object sender, ImageCapturedEventArgs e) { /n ..... /n //View Source file for more details /n }
0
30. Example
Project: WsdlUI
Source File: TextAreaClipboardHandler.cs
Source File: TextAreaClipboardHandler.cs
static void SafeSetClipboard(object dataObject) { // Work around ExternalException bug. (SD2-426) // Best reproducable inside Virtual PC. int version = unchecked(++SafeSetClipboardDataVersion); try { Clipboard.SetDataObject(dataObject, true); } catch (ExternalException) { Timer timer = new Timer(); timer.Interval = 100; timer.Tick += delegate { timer.Stop(); timer.Dispose(); if (SafeSetClipboardDataVersion == version) { try { Clipboard.SetDataObject(dataObject, true, 10, 50); } catch (ExternalException) { } } }; timer.Start(); } }
0
31. Example
Project: tesvsnip
Source File: MainView.cs
Source File: MainView.cs
internal static void SetClipboardData(object value) { if (Settings.Default.UseWindowsClipboard) { var cloneable = value as ICloneable; if (cloneable != null) { var ido = new DataObject(); var srFormat = value.GetType().FullName; ido.SetData(srFormat, cloneable.Clone()); ido.SetData("TESVSnip", srFormat); System.Windows.Forms.Clipboard.Clear(); System.Windows.Forms.Clipboard.SetDataObject(ido, true); } } else { s_clipboard = value; } }
0
32. Example
Project: falloutsnip
Source File: MainView.Selection.cs
Source File: MainView.Selection.cs
internal static void SetClipboardData(object value) { if (Settings.Default.UseWindowsClipboard) { var cloneable = value as ICloneable; if (cloneable != null) { var ido = new DataObject(); var srFormat = value.GetType().FullName; ido.SetData(srFormat, cloneable.Clone()); ido.SetData("FalloutSnip", srFormat); System.Windows.Forms.Clipboard.Clear(); System.Windows.Forms.Clipboard.SetDataObject(ido, true); } } else { s_clipboard = value; } }
0
33. Example
Project: Pyramid
Source File: TextAreaClipboardHandler.cs
Source File: TextAreaClipboardHandler.cs
static void SafeSetClipboard(object dataObject) { // Work around ExternalException bug. (SD2-426) // Best reproducable inside Virtual PC. int version = unchecked(++SafeSetClipboardDataVersion); try { Clipboard.SetDataObject(dataObject, true); } catch (ExternalException) { Timer timer = new Timer(); timer.Interval = 100; timer.Tick += delegate { timer.Stop(); timer.Dispose(); if (SafeSetClipboardDataVersion == version) { try { Clipboard.SetDataObject(dataObject, true, 10, 50); } catch (ExternalException) { } } }; timer.Start(); } }
0
34. Example
Project: fdotoolbox
Source File: ClipboardWrapper.cs
Source File: ClipboardWrapper.cs
static void SafeSetClipboard(object dataObject) { // Work around ExternalException bug. (SD2-426) // Best reproducable inside Virtual PC. int version = unchecked(++SafeSetClipboardDataVersion); try { Clipboard.SetDataObject(dataObject, true); } catch (ExternalException) { Timer timer = new Timer(); timer.Interval = 100; timer.Tick += delegate { timer.Stop(); timer.Dispose(); if (SafeSetClipboardDataVersion == version) { try { Clipboard.SetDataObject(dataObject, true, 10, 50); } catch (ExternalException) { } } }; timer.Start(); } }
0
35. Example
Project: fdotoolbox
Source File: TextAreaClipboardHandler.cs
Source File: TextAreaClipboardHandler.cs
static void SafeSetClipboard(object dataObject) { // Work around ExternalException bug. (SD2-426) // Best reproducable inside Virtual PC. int version = unchecked(++SafeSetClipboardDataVersion); try { Clipboard.SetDataObject(dataObject, true); } catch (ExternalException) { Timer timer = new Timer(); timer.Interval = 100; timer.Tick += delegate { timer.Stop(); timer.Dispose(); if (SafeSetClipboardDataVersion == version) { try { Clipboard.SetDataObject(dataObject, true, 10, 50); } catch (ExternalException) { } } }; timer.Start(); } }
0
36. Example
Project: ecsharp
Source File: TextAreaClipboardHandler.cs
Source File: TextAreaClipboardHandler.cs
static void SafeSetClipboard(object dataObject) { // Work around ExternalException bug. (SD2-426) // Best reproducable inside Virtual PC. int version = unchecked(++SafeSetClipboardDataVersion); try { Clipboard.SetDataObject(dataObject, true); } catch (ExternalException) { Timer timer = new Timer(); timer.Interval = 100; timer.Tick += delegate { timer.Stop(); timer.Dispose(); if (SafeSetClipboardDataVersion == version) { try { Clipboard.SetDataObject(dataObject, true, 10, 50); } catch (ExternalException) { } } }; timer.Start(); } }
0
37. Example
Project: ATF
Source File: DefaultTabCommands.cs
Source File: DefaultTabCommands.cs
public virtual void DoCommand(object commandTag) { switch ((Command)commandTag) { case Command.CloseCurrentTab: Close(ControlRegistry.ActiveControl); break; case Command.CloseOtherTabs: CloseOthers(ControlRegistry.ActiveControl); break; case Command.CopyFullPath: Clipboard.SetDataObject(GetDocumentPath(ControlRegistry.ActiveControl), true); break; case Command.OpenContainingFolder: // Open in Explorer and select the file. http://support.microsoft.com/kb/314853 System.Diagnostics.Process.Start("explorer.exe", "/e,/select," + GetDocumentPath(ControlRegistry.ActiveControl)); break; } }
0
38. Example
Project: log2console
Source File: TextAreaClipboardHandler.cs
Source File: TextAreaClipboardHandler.cs
static void SafeSetClipboard(object dataObject) { // Work around ExternalException bug. (SD2-426) // Best reproducable inside Virtual PC. int version = unchecked(++SafeSetClipboardDataVersion); try { Clipboard.SetDataObject(dataObject, true); } catch (ExternalException) { Timer timer = new Timer(); timer.Interval = 100; timer.Tick += delegate { timer.Stop(); timer.Dispose(); if (SafeSetClipboardDataVersion == version) { try { Clipboard.SetDataObject(dataObject, true, 10, 50); } catch (ExternalException) { } } }; timer.Start(); } }
0
39. Example
Project: justdecompile-plugins
Source File: TextAreaClipboardHandler.cs
Source File: TextAreaClipboardHandler.cs
static void SafeSetClipboard(object dataObject) { // Work around ExternalException bug. (SD2-426) // Best reproducable inside Virtual PC. int version = unchecked(++SafeSetClipboardDataVersion); try { Clipboard.SetDataObject(dataObject, true); } catch (ExternalException) { Timer timer = new Timer(); timer.Interval = 100; timer.Tick += delegate { timer.Stop(); timer.Dispose(); if (SafeSetClipboardDataVersion == version) { try { Clipboard.SetDataObject(dataObject, true, 10, 50); } catch (ExternalException) { } } }; timer.Start(); } }
0
40. Example
Project: justdecompile-plugins
Source File: TextAreaClipboardHandler.cs
Source File: TextAreaClipboardHandler.cs
static void SafeSetClipboard(object dataObject) { // Work around ExternalException bug. (SD2-426) // Best reproducable inside Virtual PC. int version = unchecked(++SafeSetClipboardDataVersion); try { Clipboard.SetDataObject(dataObject, true); } catch (ExternalException) { Timer timer = new Timer(); timer.Interval = 100; timer.Tick += delegate { timer.Stop(); timer.Dispose(); if (SafeSetClipboardDataVersion == version) { try { Clipboard.SetDataObject(dataObject, true, 10, 50); } catch (ExternalException) { } } }; timer.Start(); } }
0
41. Example
Project: SquareOne
Source File: TextAreaClipboardHandler.cs
Source File: TextAreaClipboardHandler.cs
static void SafeSetClipboard(object dataObject) { // Work around ExternalException bug. (SD2-426) // Best reproducible inside Virtual PC. int version = unchecked(++_safeSetClipboardDataVersion); try { Clipboard.SetDataObject(dataObject, true); } catch (ExternalException) { Timer timer = new Timer(); timer.Interval = 100; timer.Tick += delegate { timer.Stop(); timer.Dispose(); if (_safeSetClipboardDataVersion == version) { try { Clipboard.SetDataObject(dataObject, true, 10, 50); } catch (ExternalException) { } } }; timer.Start(); } }
0
42. Example
Project: duality
Source File: ProjectFolderView.cs
Source File: ProjectFolderView.cs
protected void ClipboardCutNodes(IEnumerable<TreeNodeAdv> nodes) { DataObject data = new DataObject(); this.AppendNodesToData(data, nodes); Clipboard.SetDataObject(data, true); byte[] moveEffect = new byte[] {2, 0, 0, 0}; MemoryStream dropEffect = new MemoryStream(); dropEffect.Write(moveEffect, 0, moveEffect.Length); data.SetData("Preferred DropEffect", dropEffect); Clipboard.Clear(); Clipboard.SetDataObject(data); }
0
43. Example
Project: tesvsnip
Source File: HexBox.cs
Source File: HexBox.cs
public void Copy() { if (!CanCopy()) return; // put bytes into buffer var buffer = new byte[_selectionLength]; int id = -1; for (long i = _bytePos; i < _bytePos + _selectionLength; i++) { id++; buffer[id] = _byteProvider.ReadByte(i); } var da = new DataObject(); // set string buffer clipbard data string sBuffer = Encoding.Instance.GetString(buffer, 0, buffer.Length); da.SetData(typeof (string), sBuffer); //set memorystream (BinaryData) clipboard data var ms = new MemoryStream(buffer, 0, buffer.Length, false, true); da.SetData("BinaryData", ms); Clipboard.SetDataObject(da, true); UpdateCaret(); ScrollByteIntoView(); Invalidate(); }
0
44. Example
Project: falloutsnip
Source File: HexBox.cs
Source File: HexBox.cs
public void Copy() { if (!CanCopy()) return; // put bytes into buffer var buffer = new byte[_selectionLength]; int id = -1; for (long i = _bytePos; i < _bytePos + _selectionLength; i++) { id++; buffer[id] = _byteProvider.ReadByte(i); } var da = new DataObject(); // set string buffer clipbard data string sBuffer = Encoding.Instance.GetString(buffer, 0, buffer.Length); da.SetData(typeof (string), sBuffer); //set memorystream (BinaryData) clipboard data var ms = new MemoryStream(buffer, 0, buffer.Length, false, true); da.SetData("BinaryData", ms); Clipboard.SetDataObject(da, true); UpdateCaret(); ScrollByteIntoView(); Invalidate(); }
0
45. Example
Project: ImageGlass
Source File: frmMain.cs
Source File: frmMain.cs
private void CutFile() { try { if (GlobalSetting.IsImageError || !File.Exists(GlobalSetting.ImageList.GetFileName(GlobalSetting.CurrentIndex))) { return; } } catch { return; } GlobalSetting.StringClipboard = new StringCollection(); GlobalSetting.StringClipboard.Add(GlobalSetting.ImageList.GetFileName(GlobalSetting.CurrentIndex)); byte[] moveEffect = new byte[] { 2, 0, 0, 0 }; MemoryStream dropEffect = new MemoryStream(); dropEffect.Write(moveEffect, 0, moveEffect.Length); DataObject data = new DataObject(); data.SetFileDropList(GlobalSetting.StringClipboard); data.SetData("Preferred DropEffect", dropEffect); Clipboard.Clear(); Clipboard.SetDataObject(data, true); DisplayTextMessage( string.Format(GlobalSetting.LangPack.Items["frmMain._CutFileText"], GlobalSetting.StringClipboard.Count), 1000); }
0
46. Example
Project: ImageGlass
Source File: frmMain.cs
Source File: frmMain.cs
private void CutMultiFiles() { try { if (GlobalSetting.IsImageError || !File.Exists(GlobalSetting.ImageList.GetFileName(GlobalSetting.CurrentIndex))) { return; } } catch { return; } //get filename string filename = GlobalSetting.ImageList.GetFileName(GlobalSetting.CurrentIndex); //exit if duplicated filename if (GlobalSetting.StringClipboard.IndexOf(filename) != -1) { return; } //add filename to clipboard GlobalSetting.StringClipboard.Add(filename); byte[] moveEffect = new byte[] { 2, 0, 0, 0 }; MemoryStream dropEffect = new MemoryStream(); dropEffect.Write(moveEffect, 0, moveEffect.Length); DataObject data = new DataObject(); data.SetFileDropList(GlobalSetting.StringClipboard); data.SetData("Preferred DropEffect", dropEffect); Clipboard.Clear(); Clipboard.SetDataObject(data, true); DisplayTextMessage( string.Format(GlobalSetting.LangPack.Items["frmMain._CutFileText"], GlobalSetting.StringClipboard.Count), 1000); }
0
47. Example
Project: AzureKeyVaultExplorer
Source File: Utils.cs
Source File: Utils.cs
public static void ClipboardSetHyperlink(string link, string name) { // HTML format which works fine with any Office product const string html = @"Version:0.9 StartHTML:<<<<<<<1 EndHTML:<<<<<<<2 StartFragment:<<<<<<<3 EndFragment:<<<<<<<4 SourceURL: {0} <html> <body> <!--StartFragment--> <a href='{0}'>{1}</a> <!--EndFragment--> </body> </html>"; var dataObj = new DataObject("Preferred DropEffect", DragDropEffects.Move); // "Cut" file to clipboard dataObj.SetData(DataFormats.Text, link); dataObj.SetData(DataFormats.UnicodeText, link); // Add HTML format and .URL as a file dataObj.SetData(DataFormats.Html, string.Format(html, link, name)); var tempPath = Path.Combine(Path.GetTempPath(), name + ContentType.KeyVaultLink.ToExtension()); File.WriteAllText(tempPath, $"[InternetShortcut]\r\nURL={link}\r\nIconIndex=47\r\nIconFile=%SystemRoot%\\system32\\SHELL32.dll"); var sc = new StringCollection(); sc.Add(tempPath); dataObj.SetFileDropList(sc); Clipboard.SetDataObject(dataObj, true); }
0
48. Example
Project: tesvsnip
Source File: Program.cs
Source File: Program.cs
public static void CurrentDomainUnhandledException(object sender, UnhandledExceptionEventArgs e) { try { Exception ex = (Exception)e.ExceptionObject; // Since we can't prevent the app from terminating, log this to the event log. if (!EventLog.SourceExists("ThreadException")) { EventLog.CreateEventSource("ThreadException", "Application"); } string errMsg = "Message: " + ex.Message + Environment.NewLine + Environment.NewLine + "StackTrace: " + ex.StackTrace + Environment.NewLine + Environment.NewLine + "Source: " + ex.Source + Environment.NewLine + Environment.NewLine + "GetType: " + ex.GetType().ToString(); Clipboard.SetDataObject(errMsg, true); // Create an EventLog instance and assign its source. EventLog myLog = new EventLog(); myLog.Source = "ThreadException"; myLog.WriteEntry(errMsg ); MessageBox.Show(errMsg, "Fatal Error", MessageBoxButtons.OK, MessageBoxIcon.Stop); } finally { Application.Exit(); } }
0
49. Example
Project: tesvsnip
Source File: Program.cs
Source File: Program.cs
public static void ApplicationThreadException(object sender, System.Threading.ThreadExceptionEventAr/n ..... /n //View Source file for more details /n }
0
50. Example
Project: falloutsnip
Source File: Program.cs
Source File: Program.cs
public static void CurrentDomainUnhandledException(object sender, UnhandledExceptionEventArgs e) { try { Exception ex = (Exception)e.ExceptionObject; // Since we can't prevent the app from terminating, log this to the event log. if (!EventLog.SourceExists("ThreadException")) { EventLog.CreateEventSource("ThreadException", "Application"); } string errMsg = "Message: " + ex.Message + Environment.NewLine + Environment.NewLine + "StackTrace: " + ex.StackTrace + Environment.NewLine + Environment.NewLine + "Source: " + ex.Source + Environment.NewLine + Environment.NewLine + "GetType: " + ex.GetType().ToString(); Clipboard.SetDataObject(errMsg, true); // Create an EventLog instance and assign its source. EventLog myLog = new EventLog(); myLog.Source = "ThreadException"; myLog.WriteEntry(errMsg ); MessageBox.Show(errMsg, "Fatal Error", MessageBoxButtons.OK, MessageBoxIcon.Stop); } finally { Application.Exit(); } }