public void Dispose()
        {
            this._timer.Stop();
            var ms = this._timer.ElapsedMilliseconds;

            LogToFile.LogMessageToFile(string.Format("{0} - Elapsed Milliseconds: {1}", this._message, ms));

            // log the performance timing with the Logging library of your choice
            // Example:
            // Logger.Write(
            //     string.Format("{0} - Elapsed Milliseconds: {1}", this._message, ms)
            // );
        }
Beispiel #2
0
        public ExceptionMessageBox(Exception e, string userExceptionMessage)
        {
            if (e == null)
            {
                return;
            }

            InitializeComponent();

            this.userExceptionMessage = userExceptionMessage;
            textBox1.Text             = userExceptionMessage;

            TreeViewItem treeViewItem = new TreeViewItem();

            treeViewItem.Header = "Exception";
            treeViewItem.ExpandSubtree();
            buildTreeLayer(e, treeViewItem);
            treeView1.Items.Add(treeViewItem);

            LogToFile.LogMessageToFile("------- Start Exception --------");
            if (e.InnerException != null)
            {
                LogToFile.LogMessageToFile(e.InnerException.ToString());
            }
            if (e.Message != null)
            {
                LogToFile.LogMessageToFile(e.Message);
            }
            if (e.Source != null)
            {
                LogToFile.LogMessageToFile(e.Source);
            }
            if (e.StackTrace != null)
            {
                LogToFile.LogMessageToFile(e.StackTrace);
            }
            if (e.TargetSite != null)
            {
                LogToFile.LogMessageToFile(e.TargetSite.ToString());
            }
            LogToFile.LogMessageToFile("------- End Exception --------");
        }