示例#1
0
        public static void Log(object obj, IMEventArgs args)
        {
#if DEBUG
            if (pr == null)
            {
                pr = new Progress();
                pr.Show();
            }
            pr._UpdateConsole(obj, args);
#endif

            // write to file
            if (!System.IO.Directory.Exists("C:\\TEMP\\"))
            {
                System.IO.Directory.CreateDirectory("C:\\TEMP\\");
            }

            if (!File.Exists("C:\\TEMP\\log_FirstToolWin.txt"))
            {
                File.Create("C:\\TEMP\\log_FirstToolWin.txt");
            }

            System.IO.File.AppendAllText("C:\\TEMP\\log_FirstToolWin.txt", args.Message);
        }
示例#2
0
文件: Progress.cs 项目: LorenzG/Viz3D
 internal void _UpdateConsole(object obj, IMEventArgs args)
 {
     if (InvokeRequired)
     {
         Invoke((MethodInvoker)(() =>
         {
             this.rtb_Progress.AppendText(DateTime.Now.ToString("yy/MM/dd HH:mm:ss") + " - " + args.Message + Environment.NewLine);
             this.rtb_Progress.SelectionStart = this.rtb_Progress.Text.Length;
             this.rtb_Progress.ScrollToCaret();
         }));
     }
     else
     {
         try
         {
             this.rtb_Progress.AppendText(DateTime.Now.ToString("yy/MM/dd HH:mm:ss") + " - " + args.Message + Environment.NewLine);
             this.rtb_Progress.SelectionStart = this.rtb_Progress.Text.Length;
             this.rtb_Progress.ScrollToCaret();
         }
         catch (Exception)
         {
         }
     }
 }