public MainWindow() { //suppresses pesky debug errors about invalid ancestor to combobox #if DEBUG System.Diagnostics.PresentationTraceSources.DataBindingSource.Switch.Level = System.Diagnostics.SourceLevels.Critical; #endif int localplayerlevel = 1; DataSetup(); if (manualMode && File.Exists(Path.Combine(appdir, "status.dat"))) { Readers.GameStatusReader statusreader = new Readers.GameStatusReader(Path.Combine(appdir, "status.dat")); if (statusreader.QuestInfo != null && statusreader.QuestInfo.Count != 0) { MessageBoxResult result = MessageBox.Show("Load quest info from previous session?", "Load data?", MessageBoxButton.YesNo); if (result == MessageBoxResult.Yes) { ProcessLastStatus(statusreader.QuestInfo); localplayerlevel = statusreader.PlayerLevel; } } } DataContext = this; InitializeComponent(); PlayerLevel = localplayerlevel; if (Properties.Settings.Default.FirstRun) { Properties.Settings.Default.FirstRun = false; var foo = new SettingsDialog(); foo.ShowDialog(); } SettingsFromConfig(); _currentQuests = new ObservableCollection <QuestViewModel>(); if (!manualMode) { if (Directory.Exists(SaveFolder)) { GetMostRecentSaveFile(); //automatically calls updatequests SetUpFilewatcher(); } else { MessageBox.Show("The tracker has been put into manual mode. If you want to track quests" + " automatically, choose a valid folder in the settings."); manualMode = true; Properties.Settings.Default.ManualMode = true; } } else { GwentStatusText = "Click to see Gwent cards"; UpdateQuests(); } _currentQuests.Sort(); RaisePropertyChanged("CurrentQuests"); InfoMessage = ""; System.Windows.Threading.DispatcherTimer autosaveTimer = new System.Windows.Threading.DispatcherTimer( TimeSpan.FromSeconds(120), System.Windows.Threading.DispatcherPriority.Background, new EventHandler(DoAutoSave), Application.Current.Dispatcher); autosaveTimer.Start(); SeekNextUndone(); MyMapControl.Map.Viewport.Resolution = 20000; SearchBox.NextItemButton.Click += NextItemButton_Click; SearchBox.PrevItemButton.Click += PrevItemButton_Click; SearchBox.CloseSearchButton.Click += CloseSearchButton_Click; CommandBindings.Add(new CommandBinding(ApplicationCommands.Find, FindExecuted, FindCanExecute)); }