![]() |
Sylloge
A C# helper library
|
00001 00002 00003 00004 00005 00006 00007 00008 00009 00010 00011 00012 00013 00014 00015 00016 00018 using System; 00019 using System.Collections.Generic; 00020 using System.ComponentModel; 00021 using System.Data; 00022 using System.Drawing; 00023 using System.Text; 00024 using System.Windows.Forms; 00025 00026 namespace Sylloge 00027 { 00028 namespace Forms 00029 { 00030 public partial class Exception : System.Windows.Forms.Form 00031 { 00035 public Exception() 00036 { 00037 this.InitializeComponent(); 00038 } 00039 00043 public string Caption 00044 { 00045 set 00046 { 00047 this.Text = value; 00048 } 00049 } 00050 00054 public string DisplayMessage 00055 { 00056 get 00057 { 00058 return this.c_LabelError.Text; 00059 } 00060 set 00061 { 00062 this.c_LabelError.Text = value; 00063 } 00064 } 00065 00069 public string Stack 00070 { 00071 get 00072 { 00073 return this.c_TextBoxStack.Text; 00074 } 00075 set 00076 { 00077 this.c_TextBoxStack.Text = value; 00078 } 00079 } 00080 00081 private void c_LinkLabelSave_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) 00082 { 00083 System.Windows.Forms.SaveFileDialog fd = new System.Windows.Forms.SaveFileDialog(); 00084 fd.AddExtension = true; 00085 fd.AutoUpgradeEnabled = true; 00086 fd.DefaultExt = ".txt"; 00087 fd.Filter = "Text Files|*.txt|Log Files|*.log|All Files|*.*"; 00088 fd.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Desktop); 00089 fd.OverwritePrompt = true; 00090 fd.RestoreDirectory = true; 00091 fd.Title = "Save Error Report"; 00092 if (fd.ShowDialog() == DialogResult.OK) { 00093 System.IO.StreamWriter fout = new System.IO.StreamWriter(fd.FileName); 00094 string msg = DateTime.Now + " - " + this.c_LabelError.Text + Environment.NewLine + this.c_TextBoxStack.Text; 00095 fout.Write(msg); 00096 fout.Close(); 00097 fout.Dispose(); 00098 fout = null; 00099 } 00100 } 00101 } 00102 } 00103 }