Exemple #1
0
        static void Main()
        {
            try
            {
                //Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);
                //Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException);
                //AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);

                XTrace.UseWinForm();

                if (XConfig.Current.LastUpdate.Date < DateTime.Now.Date)
                {
                    XConfig.Current.LastUpdate = DateTime.Now;

                    var au = new AutoUpdate();
                    au.UpdateAsync();
                }
                String ProcessHelper = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "NewLife.ProcessHelper.exe");
                if (File.Exists(ProcessHelper))
                {
                    File.Delete(ProcessHelper);
                }

                new TimerX(s => Runtime.ReleaseMemory(), null, 5000, 10000);
            }
            catch (Exception ex)
            {
                XTrace.WriteException(ex);
            }

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new FrmMain());
        }
Exemple #2
0
        static void Main()
        {
            XTrace.UseWinForm();

            StringHelper.EnableSpeechTip = XConfig.Current.SpeechTip;

            //// 参数启动
            //var args = Environment.GetCommandLineArgs();
            //if (args != null && args.Length > 1)
            //{
            //    try
            //    {
            //        StartWithParameter(args);
            //    }
            //    catch (Exception ex)
            //    {
            //        XTrace.WriteException(ex);
            //    }
            //    return;
            //}

            //if (!Runtime.Mono) new TimerX(s => Runtime.ReleaseMemory(), null, 60000, 60000) { Async = true };

            if (XConfig.Current.IsNew)
            {
                "学无先后达者为师,欢迎使用新生命码神工具!".SpeechTip();
            }

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new FrmMDI());
        }
Exemple #3
0
        static void Main()
        {
#if NET5_0_OR_GREATER
            XTrace2.UseWinForm();
            Application.SetHighDpiMode(HighDpiMode.SystemAware);
#else
            XTrace.UseWinForm();
#endif
            MachineInfo.RegisterAsync();

#if !NET4
            StartClient();
#endif

            StringHelper.EnableSpeechTip = XConfig.Current.SpeechTip;

            if (XConfig.Current.IsNew)
            {
                "学无先后达者为师,欢迎使用新生命码神工具!".SpeechTip();
            }

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new FrmMDI());
        }
Exemple #4
0
        static void Main()
        {
            XTrace.UseWinForm();

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new FrmMain());
        }
Exemple #5
0
        static void Main()
        {
            XTrace.UseWinForm();

            // 降低进程优先级,避免卡死电脑
            Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.BelowNormal;

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new FrmMain());
        }
Exemple #6
0
        static void Main()
        {
            XTrace.UseWinForm();

            StringHelper.EnableSpeechTip = XConfig.Current.SpeechTip;

            // 参数启动
            var args = Environment.GetCommandLineArgs();

            if (args != null && args.Length > 1)
            {
                try
                {
                    StartWithParameter(args);
                }
                catch (Exception ex)
                {
                    XTrace.WriteException(ex);
                }
                return;
            }

            try
            {
                Update(true);

                if (!Runtime.Mono)
                {
                    new TimerX(s => Runtime.ReleaseMemory(), null, 5000, 10000);
                }
            }
            catch (Exception ex)
            {
                XTrace.WriteException(ex);
            }

            if (XConfig.Current.IsNew)
            {
                "学无先后达者为师,欢迎使用新生命超级码神工具!".SpeechTip();
            }

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new FrmMDI());

            // 此时执行自动更新
            var up = _upgrade;

            if (up != null)
            {
                _upgrade = null;
                up.Update();
            }
        }
Exemple #7
0
        protected override void OnStartup(StartupEventArgs e)
        {
#if NET45
            XTrace.UseWinForm();
#endif

            StartClient();

            StringHelper.EnableSpeechTip = Setting.Current.SpeechTip;

            if (Setting.Current.IsNew)
            {
                "学无先后达者为师,欢迎使用新生命码神工具!".SpeechTip();
            }

            base.OnStartup(e);
        }
Exemple #8
0
        static void Main()
        {
            XTrace.UseWinForm();

            // 参数启动
            var args = Environment.GetCommandLineArgs();

            if (args != null && args.Length > 1)
            {
                try
                {
                    StartWithParameter(args);
                }
                catch (Exception ex)
                {
                    XTrace.WriteException(ex);
                }
                return;
            }

            try
            {
                Update(true);

                new TimerX(s => Runtime.ReleaseMemory(), null, 5000, 10000);
            }
            catch (Exception ex)
            {
                XTrace.WriteException(ex);
            }

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new FrmMDI());

            // 此时执行自动更新
            var up = _upgrade;

            if (up != null)
            {
                _upgrade = null;
                up.Update();
            }
        }
Exemple #9
0
        static void Main()
        {
#if NC30
            XTrace2.UseWinForm();
#else
            XTrace.UseWinForm();
#endif

            StringHelper.EnableSpeechTip = XConfig.Current.SpeechTip;

            if (XConfig.Current.IsNew)
            {
                "学无先后达者为师,欢迎使用新生命码神工具!".SpeechTip();
            }

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new FrmMDI());
        }
Exemple #10
0
        static void Main()
        {
            XTrace.UseWinForm();

            try
            {
                if (!Runtime.Mono)
                {
                    new TimerX(s => Runtime.ReleaseMemory(), null, 5000, 10000);
                }
            }
            catch (Exception ex)
            {
                XTrace.WriteException(ex);
            }

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new FrmMain());
        }
Exemple #11
0
        static void Main()
        {
            XTrace.UseWinForm();

            var args = Environment.GetCommandLineArgs();

            if (args.Length > 1)
            {
                if (args[1].ToLower() == "-s")  //启动服务
                {
                    var ServicesToRun = new ServiceBase[] { new XProxySvc() };
                    try
                    {
                        ServiceBase.Run(ServicesToRun);
                    }
                    catch (Exception ex)
                    {
                        XTrace.WriteLine(ex.ToString());
                        Console.WriteLine(ex.ToString());
                    }
                    return;
                }
                else if (args[1].ToLower() == "-i") //安装服务
                {
                    Install(true);
                    return;
                }
                else if (args[1].ToLower() == "-u") //卸载服务
                {
                    Install(false);
                    return;
                }
            }

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new FrmMain());
        }