예제 #1
0
        static void Main()
        {
            #if DEBUG

            Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                mainWindow = new MainWindow();
                Application.Run(mainWindow);

            #else
            try
            {
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                mainWindow = new MainWindow();
                Application.Run(mainWindow);
            }
            catch (Exception ex)
            {
                //Write ex.Message to a file
                using (StreamWriter outfile = new StreamWriter(@".\error" + DateTime.Now.ToShortDateString() + DateTime.Now.ToShortTimeString() + ".txt"))
                {
                    outfile.Write(ex.Message.ToString());
                }
            }
            #endif
        }
예제 #2
0
 /// <summary>
 /// Checks if the pointer to the main window is null, and sets it to the current instance of the main window if it is.
 /// </summary>
 private static void refreshMainWindow()
 {
     if (mainWindow == null)
     {
         mainWindow = Program.MainWindow;
     }
 }