public MainWindow() { // Add handler for unhandled exception AppDomain.CurrentDomain.UnhandledException += AppDomain_UnhandledException; // Load user and system configuration Depot.LoadSystemConfiguration(); Depot.LoadUserConfiguration(); // Load language if (Depot.Language != null && Depot.Language != "") { try { ResourceDictionary lang = (ResourceDictionary)Application.LoadComponent(new Uri(@"assets/lang/" + Depot.Language + ".xaml", UriKind.Relative)); if (Resources.MergedDictionaries.Count > 0) { Resources.MergedDictionaries.Clear(); } Resources.MergedDictionaries.Add(lang); } catch { } } // Initialize component InitializeComponent(); // Set properties for controls RenderOptions.SetBitmapScalingMode(bdStage1, BitmapScalingMode.HighQuality); RenderOptions.SetBitmapScalingMode(bdStage2, BitmapScalingMode.HighQuality); RenderOptions.SetBitmapScalingMode(bdShiftStage, BitmapScalingMode.HighQuality); // Add handler for global member Depot.AlwaysOnTopChanged += new AlwaysOnTopChangedEventHandler(AlwaysOnTopChanged); Depot.LanguageChanged += new LanguageChangedEventHandler(LanguageChanged); Depot.ScheduleChanged += new ContentChangedEventHandler(ScheduleChanged); Depot.ScheduleUpdated += new ContentUpdatedEventHandler(ScheduleUpdated); Depot.ScheduleFailed += new ContentFailedEventHandler(ScheduleFailed); Depot.ShiftChanged += new ContentChangedEventHandler(ShiftChanged); Depot.ShiftUpdated += new ContentUpdatedEventHandler(ShiftUpdated); Depot.ShiftFailed += new ContentFailedEventHandler(ShiftFailed); Depot.BattleChanged += new ContentChangedEventHandler(BattleChanged); Depot.BattleFound += new ContentFoundEventHandler(BattleFound); Depot.BattleUpdated += new ContentUpdatedEventHandler(BattleUpdated); Depot.BattleFailed += new ContentFailedEventHandler(BattleFailed); Depot.BattleNotifying += new ContentNotifyingHandler(BattleNotifying); Depot.JobChanged += new ContentChangedEventHandler(JobChanged); Depot.JobFound += new ContentFoundEventHandler(JobFound); Depot.JobUpdated += new ContentUpdatedEventHandler(JobUpdated); Depot.JobFailed += new ContentFailedEventHandler(JobFailed); Depot.JobNotifying += new ContentNotifyingHandler(JobNotifying); Depot.CookieUpdated += new CookieUpdatedEventHandler(CookieUpdated); // Prepare windows scheduleWindow = new ScheduleWindow(); scheduleWindow.Opacity = 0; scheduleWindow.Visibility = Visibility.Hidden; shiftWindow = new ShiftWindow(); shiftWindow.Opacity = 0; shiftWindow.Visibility = Visibility.Hidden; battleWindow = new BattleWindow(); battleWindow.Opacity = 0; battleWindow.Visibility = Visibility.Hidden; jobWindow = new JobWindow(); jobWindow.Opacity = 0; jobWindow.Visibility = Visibility.Hidden; settingsWindow = new SettingsWindow(); settingsWindow.Opacity = 0; settingsWindow.Visibility = Visibility.Hidden; // Create timers tmSchedule = new DispatcherTimer(); tmSchedule.Tick += new EventHandler((object source, EventArgs e) => { Depot.GetSchedule(); }); tmSchedule.Interval = new TimeSpan(0, 0, 15); tmShift = new DispatcherTimer(); tmShift.Tick += new EventHandler((object source, EventArgs e) => { Depot.GetShift(); }); tmShift.Interval = new TimeSpan(0, 0, 15); tmBattle = new DispatcherTimer(); tmBattle.Tick += new EventHandler((object source, EventArgs e) => { if (battleWindow.Visibility == Visibility.Hidden) { Depot.GetLastBattle(); } }); tmBattle.Interval = new TimeSpan(0, 0, 30); tmJob = new DispatcherTimer(); tmJob.Tick += new EventHandler((object source, EventArgs e) => { if (jobWindow.Visibility == Visibility.Hidden) { Depot.GetLastJob(); } }); tmJob.Interval = new TimeSpan(0, 0, 30); // Initialize notification NotificationHelper.InitializeNotification(); }