Пример #1
0
        public WebHawkAppContext(bool startMinimized)
        {
            //Initialize Controller & Scheduler
            zCheckIEBrowserMode();

            //Instantiate m_MainForm here. This sets the SynchronizationContext.Current value needed to start the scheduler.
            //When the scheduler is split out of this executable process (to a service or agent application), we won't need to worry about this.
            m_MainForm    = new frmMain();
            this.MainForm = m_MainForm;

            string connectionString = ConfigurationManager.ConnectionStrings["WebHawkDb"].ConnectionString;

            AutomationController = new AutomationController(connectionString);
            SettingsController   = new SettingsController(connectionString);
            SchedulingController = new scheduling.SchedulingController(connectionString);
            Scheduler            = new scheduling.Scheduler(connectionString, new ThreadSynchronizer());
            Scheduler.Start();

            //Set up tray icon
            m_Notify                   = new NotifyIcon();
            m_Notify.Icon              = (System.Drawing.Icon)Properties.Resources.ResourceManager.GetObject("Icon1");
            m_Notify.Text              = "Double-click to open.";
            m_Notify.MouseDoubleClick += new MouseEventHandler(m_Notify_MouseDoubleClick);
            m_Notify.Visible           = true;

            //Show frmMain
            if (startMinimized)
            {
                m_MainForm.WindowState = FormWindowState.Minimized;
            }
            else
            {
                m_MainForm.Show();
            }
        }
Пример #2
0
        protected override void Dispose(bool disposing)
        {
            if (WebHawkAppContext.Scheduler != null)
            {
                WebHawkAppContext.Scheduler.Dispose();
            }

            WebHawkAppContext.AutomationController = null;
            WebHawkAppContext.SettingsController   = null;
            WebHawkAppContext.SchedulingController = null;
            WebHawkAppContext.Scheduler            = null;

            base.Dispose(disposing);
        }