Ejemplo n.º 1
0
    static void Main()
    {
        SingleInstanceManager manager = new SingleInstanceManager();

        //manager.Run(new[] { "test" });
        manager.Run(Environment.GetCommandLineArgs());
    }
        public static void Main(string[] args)
        {
            //Create our new single-instance manager
            SingleInstanceManager manager = new SingleInstanceManager();

            manager.Run(args);
        }
Ejemplo n.º 3
0
 static void Main()
 {
     Application.EnableVisualStyles();
     Application.SetCompatibleTextRenderingDefault(false);
     //Application.Run(new MainForm());
     SingleInstanceManager manager = new SingleInstanceManager();//单实例管理器
     manager.Run(new string[] { });
 }
Ejemplo n.º 4
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            //Application.Run(new MainForm());
            SingleInstanceManager manager = new SingleInstanceManager();//单实例管理器

            manager.Run(new string[] { });
        }
Ejemplo n.º 5
0
        public static void Main(string[] args)
        {
#if DEBUG
            RunApp(new ReadOnlyCollection <string>(args));
#else
            SingleInstanceManager singleInstanceApp = new SingleInstanceManager();
            singleInstanceApp.Run(args);
#endif
        }
Ejemplo n.º 6
0
        static void Main()
        {
            try
            {
                //处理未捕获的异常
                Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);
                //处理UI线程异常
                Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException);
                //处理非UI线程异常
                AppDomain.CurrentDomain.UnhandledException += new System.UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);

                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                SingleInstanceManager manager = new SingleInstanceManager();//单实例管理器

                manager.Run(new string[] { });
            }
            catch (Exception ex)
            {
                string str         = "";
                string strDateInfo = "出现应用程序未处理的异常:" + DateTime.Now.ToString() + "\r\n";
                if (ex != null)
                {
                    str = string.Format(strDateInfo + "异常类型:{0}\r\n异常消息:{1}\r\n异常信息:{2}\r\n",
                                        ex.GetType().Name, ex.Message, ex.StackTrace);
                }
                else
                {
                    str = string.Format("应用程序线程错误:{0}", ex);
                }

                writeLog(str);

                ErrorCollection EC = new ErrorCollection(1);
                EC.ShowDialog();

                //MessageBox.Show("发生致命错误,程序即将关闭,请及时联系作者!", "系统错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Process.GetCurrentProcess().Kill();
            }

            //Application.Run(new frmMain()); //屏蔽掉了以前的加载头
        }
        /// <summary>
        /// Runs this application by launching the specified form.
        /// </summary>
        /// <param name="form">The application's main form.</param>
        public void Run(System.Windows.Forms.Form form)
        {
            if (form == null)
            {
                throw new ArgumentNullException("form");
            }

            if (applicationType != ThisApplicationType.WindowsFormsApplication)
            {
                throw new ApplicationException(string.Format("Bad application type: {0}; should be {1}",
                                                             applicationType, ThisApplicationType.WindowsFormsApplication));
            }

            if (IsSingleInstance)
            {
                SingleInstanceManager.Run(form);
            }
            else
            {
                System.Windows.Forms.Application.Run(form);
            }
        }
Ejemplo n.º 8
0
 public static void Main(string[] args)
 {
     SingleInstanceManager manager = new SingleInstanceManager();
     manager.Run(args);
 }
Ejemplo n.º 9
0
    public static void Main(string[] args)
    {
        SingleInstanceManager manager = new SingleInstanceManager();

        manager.Run(args);
    }
Ejemplo n.º 10
0
 public static void Main(string[] args)
 {
     SingleInstanceManager SingleInsctancMgr = new SingleInstanceManager();
     SingleInsctancMgr.Run(args);
 }
Ejemplo n.º 11
0
        static void Main()
        {
            try
            {
                //处理未捕获的异常
                Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);
                //处理UI线程异常
                Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException);
                //处理非UI线程异常
                AppDomain.CurrentDomain.UnhandledException += new System.UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);

                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                SingleInstanceManager manager = new SingleInstanceManager();//单实例管理器

                manager.Run(new string[] { });
            }
            catch (Exception ex)
            {
                string str = "";
                string strDateInfo = "出现应用程序未处理的异常:" + DateTime.Now.ToString() + "\r\n";
                if (ex != null)
                {
                    str = string.Format(strDateInfo + "异常类型:{0}\r\n异常消息:{1}\r\n异常信息:{2}\r\n",
                         ex.GetType().Name, ex.Message, ex.StackTrace);
                }
                else
                {
                    str = string.Format("应用程序线程错误:{0}", ex);
                }

                writeLog(str);

                ErrorCollection EC = new ErrorCollection(1);
                EC.ShowDialog();

                //MessageBox.Show("发生致命错误,程序即将关闭,请及时联系作者!", "系统错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Process.GetCurrentProcess().Kill();
            }

            //Application.Run(new frmMain()); //屏蔽掉了以前的加载头
        }
Ejemplo n.º 12
0
    static void Main()
    {
        SingleInstanceManager manager = new SingleInstanceManager();

        manager.Run(new[] { "teste" });
    }
Ejemplo n.º 13
0
        public static void Main(string[] args)
        {
            var wrapper = new SingleInstanceManager <App>();

            wrapper.Run(args);
        }