private void LoadUserSettingsInfo() { LogChanges("Loading user settings.", LogType.Info); try { var currentUserSettings = new BoUserSettings().LoadCurrentUserSettings(); if (currentUserSettings == null) { LogChanges("No user settings were found. Generating default user settings.", LogType.Info); currentUserSettings = _appConfigurator.GenerateInitialUserSettings(); } userSettings = currentUserSettings; selectedUserextensionList = new ObservableCollection <DtoFileInfo>(userSettings.SelectedFileExtensionList); SetAllButtonsEnabledState(true); Dispatcher.Invoke(new Action(() => { ListExtensions.ItemsSource = selectedUserextensionList; SetServiceLabels(); })); } catch { LogChanges("Failed to load user settings.", LogType.Error); } LogChanges("End", LogType.Info); }
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(); }