/// <summary> /// Load settings from ini-file. /// </summary> /// <returns></returns> private bool LoadSettings() { for (int j = 0; j < Enum.GetValues(typeof(Modifier)).Length; j++) { for (int i = 1; i < 10; i++) { Playback_Item item = Configuration.Instance.Playback_Items.Find(f => f.Number == j * 9 + i); Playback_Items.Add(item); } } if (Available_Devices.Any(d => d.Name == Configuration.Instance.Playback_Device1)) { Playback_Devices[0] = Available_Devices.First(d => d.Name == Configuration.Instance.Playback_Device1); } if (Available_Devices.Any(d => d.Name == Configuration.Instance.Playback_Device2)) { Playback_Devices[1] = Available_Devices.First(d => d.Name == Configuration.Instance.Playback_Device2); } Playback_Volumes[0] = Configuration.Instance.Playback_Volume1; Playback_Volumes[1] = Configuration.Instance.Playback_Volume2; return(true); }
/// <summary> /// Event triggered when a playback item is double-clicked. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void PlaybackItem_DoubleClick(object sender, MouseButtonEventArgs e) { //Check for double-click. if (e.ClickCount < 2) { return; } //Find the specified playback item. Playback_Item item = (sender as Border).Tag as Playback_Item; //Open a new edit window. EditWindow window = new EditWindow(item); window.Closed += (object s, EventArgs args) => { Configuration.Instance.Save(); }; //Show the edit window. window.Show(); }
public EditWindow(Playback_Item item) { InitializeComponent(); //Set the window title to something descriptive. Title = $"Edit [{(item.Modifier == Modifier.Numpad ? string.Empty : $"{item.Modifier} + ")}Numpad {(item.Number - 1) % 9 + 1}]";