private void BtOpen_Click(object sender, RoutedEventArgs e) { var d = new OpenFileDialog { Filter = "Settings files (*.xml)|*.xml", }; if (d.ShowDialog() == true) { try { Globals.Settings = SettingsUtils.GetSettingsFromFile(d.FileName); DataContext = Globals.Settings; _fileName = d.FileName; FileExclusions.Clear(); var filetext = string.Empty; foreach (var file in Globals.Settings.RestartChecks.PendingFileNameExclusions) { if (!string.IsNullOrEmpty(file)) { filetext += file + Environment.NewLine; } } if (!string.IsNullOrEmpty(filetext)) { FileExclusions.Text = filetext.TrimEnd(Environment.NewLine.ToCharArray()); } Logger.Log($"User '{Environment.UserName}' Opened settings file '{_fileName}'", LogType.Info); } catch (Exception ex) { Logger.Log($"Failed to load file '{_fileName}', Exception: '{ex.Message}'", LogType.Error); } } }