using System.ComponentModel; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Text.RegularExpressions; using System.Windows; using System.Windows.Controls; using System.Windows.Input; using System.Windows.Interop; using System.Windows.Navigation; namespace unison { public partial class Settings : Window { public static string GetVersion => Assembly.GetEntryAssembly().GetCustomAttribute().InformationalVersion; public static string GetLicense { get { try { StreamReader Reader = new("LICENSE"); string file = ""; file += Reader.ReadToEnd(); return file; } catch (IOException e) { return e.Message; } } } HotkeyHandler _hotkeys = (HotkeyHandler)Application.Current.Properties["hotkeys"]; public Settings() { InitHwnd(); InitializeComponent(); DataContext = this; WindowState = WindowState.Minimized; Initialize(); } void Initialize() { MpdHost.Text = Properties.Settings.Default.mpd_host; MpdPort.Text = Properties.Settings.Default.mpd_port.ToString(); //MpdPassword.Text = Properties.Settings.Default.mpd_password; SnapcastStartup.IsChecked = Properties.Settings.Default.snapcast_startup; SnapcastWindow.IsChecked = Properties.Settings.Default.snapcast_window; SnapcastPath.Text = Properties.Settings.Default.snapcast_path; SnapcastPort.Text = Properties.Settings.Default.snapcast_port.ToString(); VolumeOffset.Text = Properties.Settings.Default.volume_offset.ToString(); InitializeShortcuts(); } void InitializeShortcuts() { System.Collections.Generic.IEnumerable stackPanelCollection = RebindKeyWrapper.Children.OfType(); StackPanel[] stackPanelList = stackPanelCollection.ToArray(); // Default state for (int i = 0; i < stackPanelList.Length; i++) { ComboBox[] comboBoxList = stackPanelList[i].Children.OfType().ToArray(); foreach (ComboBox comboBox in comboBoxList) // default status (for reset) { comboBox.FontWeight = FontWeights.Light; comboBox.SelectedItem = "None"; } TextBlock textBlock = (TextBlock)stackPanelList[i].Children.OfType