Esempio n. 1
0
        static void Main(string[] args)
        {
            if (!SingleInstance.Start())
            {
                return;
            }

            var appHost = new DefaultAppHost();

            try
            {
                AppInit.Initialize(appHost);

                Log.Information("BitShelter Agent starting");

                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);

                var applicationContext = new CustomApplicationContext();
                Application.Run(applicationContext);

                Log.Information("BitShelter Agent stopping");

                AppInit.Shutdown(appHost);
            }
            catch (Exception ex)
            {
                Log.Fatal(ex, "Unrecoverable exception");
                MessageBox.Show(ex.Message, "Program Terminated Unexpectedly",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            SingleInstance.Stop();
        }
Esempio n. 2
0
        protected override void OnStop()
        {
            try
            {
                AppInit.Shutdown(this);

                Log.Information("BitShelter Service stopping");
            }
            catch (Exception ex)
            {
                Log.Error(ex, "Failed to stop scheduling service");

                // TODO: Handle error
                throw ex;
            }
        }