public MainWindow() { InitializeComponent(); _instance = this; // initialize web client _webClient = new WebClient(); _webClient.DownloadStringCompleted += WebClientDownloadStringCompleted; // add event handlers annoCanvas.OnCurrentObjectChanged += UpdateUIFromObject; annoCanvas.OnStatusMessageChanged += StatusMessageChanged; annoCanvas.OnLoadedFileChanged += LoadedFileChanged; //Get a reference an instance of Localization.MainWindow, so we can call UpdateLanguage() in the SelectedLanguage setter DependencyObject dependencyObject = LogicalTreeHelper.FindLogicalNode(this, "Menu"); mainWindowLocalization = (Localization.MainWindow)((Menu)dependencyObject).DataContext; //If language is not recognized, bring up the language selection screen if (!Localization.Localization.LanguageCodeMap.ContainsKey(Settings.Default.SelectedLanguage)) { Welcome w = new Welcome(); w.ShowDialog(); } else { SelectedLanguage = Settings.Default.SelectedLanguage; } foreach (MenuItem item in LanguageMenu.Items) { if (item.Header.ToString() == SelectedLanguage) { item.IsChecked = true; } } }