Ejemplo n.º 1
0
        static void Main()
        {
            try
            {
				if (IsAlreadyRunning())
				{
					return;
				}

                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
				
				var mainModel = new MainModel();
				if( mainModel.ShouldRun())
				{
					var mainForm = new MainForm(mainModel);
					mainModel.RunAllJobs();
					Application.Run(mainForm);
				}
            }
            catch (Exception e)
            {
            	Logger.LogError(e);
            }
        }
Ejemplo n.º 2
0
		public MainForm(MainModel model)
			: this()
		{
			_model = model;
			_model.TrayIcon = _trayIcon;
			_presenter = new MainPresenter(this, model, SynchronizationContext.Current);
			_presenter.ConnectEvents();
			this.Closing += (sender, args) => _presenter.DisconnectEvents();
			
            _trayIconTimer = new Timer();
            _trayIconTimer.Interval = 750;
            _trayIconTimer.Tick += OnTrayIconTimerTick;

		    _shutdownTimer = new Timer();
		    _shutdownTimer.Interval = 20000;
            _shutdownTimer.Tick += ShutdownTimerOnTick;

			_progressView = new ProgressView(new ProgressModel(model.UploadManager));
			_processing = true;
			_trayIconTimer.Start();

			Logger.LogInfo("MainForm initialized.");
			if (_trayIcon != null)
				_trayIcon.SetTrayIconVisibility(true);

        }