public void DebugService(string[] args)
 {
     if (!_appStartupConfigurator.TestAppOnStartUp(true))
     {
         throw new Exception("App Startup Test Failed.");
     }
     _userSettings = new BoUserSettings().LoadCurrentUserSettings();
     if (_userSettings?.ServiceInfo == null)
     {
         throw new Exception("Couldn't start the service without any user settings saved.");
     }
     _timer = new Timer {
         Interval = _userSettings.ServiceInfo.Interval * 3600000
     };
     _timer.Elapsed += Timer_Elapsed;
     _timer.Enabled  = true;
 }
示例#2
0
        public MainWindow()
        {
            _fileManager            = new FileManager();
            _windowsRegistryManager = new WindowsRegistryManager();
            _boFileInfo             = new BoFileInfo();
            _windowsServiceManager  = new WindowsServiceManager();
            _boUserSettings         = new BoUserSettings();
            var args = Environment.GetCommandLineArgs();

            if (args.Length > 1)
            {
                ProcessCommandFromWindowsContextMenu(args[1]);
            }
            InitializeComponent();
            _fileManager.LogDelegate            = LogChanges;
            _windowsRegistryManager.LogDelegate = LogChanges;
            _appConfigurator.LogDelegate        = LogChanges;
            _windowsServiceManager.LogDelegate  = LogChanges;
            AutoUpdater.Start("http://seekurity.com/Appcast.xml");
            var backgroundWorker = new BackgroundWorker();

            SetAllButtonsEnabledState(false);
            _timerTxtServiceUpdater = new Timer {
                Interval = 60000
            };
            _timerTxtServiceUpdater.Tick   += _timerTxtServiceUpdater_Tick;
            _timerTxtServiceUpdater.Enabled = true;
            backgroundWorker.DoWork        += (s, eventArgs) =>
            {
                _appConfigurator.TestAppOnStartUp();
                LoadUserSettingsInfo();

                logList = new ObservableCollection <DtoLog>(_boLog.GetList());
                Dispatcher.Invoke(new Action(() => dataGridLogs.ItemsSource = logList));
            };

            backgroundWorker.RunWorkerAsync();
        }