Beispiel #1
0
        /// <summary>
        /// Release created console.
        /// If the app has already a console then leave it.
        /// </summary>
        public static void ReleaseConsole()
        {
            if (Released)
            {
                return;
            }

            if (bGuiConsole)
            {
                if (!bGuiDisposed)
                {
                    guiConsole.Dispose();
                    bGuiDisposed = true;
                }
                else
                {
                    MessageBox.Show("GUI Console is already disposed.", Prefix);
                }

                return;
            }

            CuiConsole.ReleaseConsole();
            _bReleased = true;
        }
Beispiel #2
0
 /// <summary>
 /// Try to create a console for current proc.
 /// </summary>
 /// <returns>false if current proc has already a console.[Like a console app]</returns>
 private static bool CreateCuiConsole(string title)
 {
     try
     {
         CuiConsole.CreateConsole(title);
         return(true);
     }
     catch (Exception ex)
     {
         preErrMsg.Enqueue(ex.Message);
         return(false);
     }
     finally
     {
         System.Console.Clear();
         System.Console.WriteLine(UserDefinedStr.sAuthor);
         System.Console.WriteLine(UserDefinedStr.sHelperCpr);
         System.Console.WriteLine(UserDefinedStr.sLibCpr);
         System.Console.WriteLine("");
     }
 }