private void RelhaxWindow_Loaded(object sender, RoutedEventArgs e) { //get client paths List <string> clientPaths = RegistryUtils.AutoFindWoTDirectoryList(); //get windowComponent WindowColorset developerSelectionColorset = UISettings.CurrentTheme.WindowColorsets[typeof(WoTClientSelection)]; //load selections into stackpanel bool firstOne = true; foreach (string path in clientPaths) { RadioButton selectionButton = new RadioButton() { Content = path, Tag = path, IsChecked = firstOne, Style = (Style)Application.Current.Resources["RelhaxRadioButtonStyle"] }; ClientSelectionsStackPanel.Children.Add(selectionButton); firstOne = false; UISettings.ApplyThemeToRootComponent(selectionButton, developerSelectionColorset.ComponentColorsets != null, developerSelectionColorset, true); } }
private void RelhaxTaskReporter_Loaded(object sender, RoutedEventArgs e) { if (LoadedAfterApply) { WindowColorset advancedColorset = null; if (UISettings.CurrentTheme.WindowColorsets != null && UISettings.CurrentTheme.WindowColorsets.ContainsKey(typeof(AdvancedProgress))) { advancedColorset = UISettings.CurrentTheme.WindowColorsets[typeof(AdvancedProgress)]; } UISettings.ApplyThemeToRootComponent(this, false, advancedColorset); } }
private async void OnApplicationLoading(object sender, RoutedEventArgs e) { DeveloperSelectionsContinueButton.IsEnabled = false; //download and parse xml document string selectionsXMlString = string.Empty; using (client = new WebClient()) { try { selectionsXMlString = await client.DownloadStringTaskAsync(ApplicationConstants.SelectionsRoot + ApplicationConstants.SelectionsXml); } catch (Exception ex) { Logging.Exception(ex.ToString()); MessageBox.Show(Translations.GetTranslatedString("failedToParseSelections")); Close(); return; } } XmlDocument doc = XmlUtils.LoadXmlDocument(selectionsXMlString, XmlLoadType.FromString); if (doc == null) { MessageBox.Show(Translations.GetTranslatedString("failedToParseSelections")); Close(); return; } //make sure the selection file has selection objects XmlNodeList selectionsList = XmlUtils.GetXmlNodesFromXPath(doc, "//selections/selection"); if (selectionsList == null || selectionsList.Count == 0) { Logging.Error("selectionsList is null or count is 0 after download"); MessageBox.Show(Translations.GetTranslatedString("failedToParseSelections")); Close(); return; } //get windowComponent WindowColorset developerSelectionColorset = UISettings.CurrentTheme.WindowColorsets[typeof(DeveloperSelectionsViewer)]; //load selections into stackpanel bool firstOne = true; foreach (XmlNode node in selectionsList) { RadioButton selectionButton = new RadioButton() { Content = node.Attributes["displayName"], Tag = node.InnerText, IsChecked = firstOne, Style = (Style)Application.Current.Resources["RelhaxRadioButtonStyle"] }; DeveloperSelectionsStackPanel.Children.Add(selectionButton); firstOne = false; UISettings.ApplyThemeToRootComponent(selectionButton, developerSelectionColorset.ComponentColorsets != null, developerSelectionColorset, true); } //enable the button to select them DeveloperSelectionsContinueButton.IsEnabled = true; }