//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\ // Program.cs For PrintBlaster.PrintForm // App Rev4 2.3.7.28 20-Jan-2018 //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\ // v2.2.6.27alexandrite 20-Jan-2018 // v3.3.5.47 Ready to go forward w/this. // v3.2.4.47 04/09 Near Total Concept! // v3.3.5.49 04/21 Fully Integrated w/PB // v4.3.5.49 22-Apr-2018 Integrated. // v4.3.5.50 Brought Data Mechanism. // Obsoletes mmf2 and mmf3 stuff. // (c) John P. Edwards 20-May-2018 // v4.5.6.54 name & optional no-path // v4.7.1.74 25-Sep-2018 // v4.8.1.78 04-Oct " " Major testing & // tweeking little details, the Devil // is in the Details. Sweat them! // v4.9.4.89 24-Nov-2018 //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\ using System; using System.Threading; //using System.Windows.Forms; // Aliases (shortcuts) //using PrintBlaster.Properties; using APP = System.Windows.Forms.Application; using MyCustomLibrary; namespace PrintBlaster { static class Program { private const string Nm = "PrintBlasterProgramMuter"; private static bool _1St; public static Mutex Muter = new Mutex(false, Nm, out _1St); /// Main entry point for this app. /// [STAThread] static void Main() { if (_1St) { try { APP.EnableVisualStyles(); APP. SetCompatibleTextRenderingDefault (false); APP.Run(new PrintForm1()); } catch (ObjectDisposedException) { // EyeOut ReTest on 1st instance. #region Release version testcode // ^ Cannot access a disposed object // if it wasn't even Initialized. //if (MyToolbox.Testing) // MessageBox.Show(Resources.Err3); #endregion } finally { Muter.Dispose(); } } else Main2();// secondary instance calling. } // All the rest are second instance only. private static void Main2() // ^^^ { try { APP.Run(new PrintForm1( MyToolbox.GetSavedArgs())); } catch (ObjectDisposedException) { // EyeOut ReTest on 2nd instances. #region Release version testcode // ^ Cannot access a disposed object // if it wasn't even Initialized. //if (MyToolbox.Testing) // MessageBox.Show( // string.Format( // "{0} in Blaster Program Main2:\n\n", // "Cannot Dispose of" + // " Disposed Object:\n\n" + // "Msg Shown Only if Testing.\n\n" + // "Error Handled Either Way.")); #endregion } } //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\ } }