private void SaveOverlayItem(OverlayItem overlay_item, bool editing_item) { if (!editing_item) { OverlayItem temp_item = new OverlayItem(); temp_item.HotKey = overlay_item.HotKey; temp_item.ImagePath = overlay_item.ImagePath; temp_item.PlayVisible = overlay_item.PlayVisible; temp_item.SoundPath = overlay_item.SoundPath; temp_item.SoundVolume = overlay_item.SoundVolume; temp_item.StopVisible = overlay_item.StopVisible; temp_item.DisplayDuration = overlay_item.DisplayDuration; // Save the overlay item to the xml file. settings_manager.SaveOverlayItem(temp_item); // Add the new OverlayItem. AddOverlayItem(temp_item); } else { // Update the editied OverlayItem. OverlayListBoxItem temp_overlay_list_box_item = (OverlayListBoxItem)overlay_lv.SelectedItem; temp_overlay_list_box_item.PopulateOverlayItem(overlay_item); // Resave the overlay list. settings_manager.SaveOverlayItems(OverlayListBoxItems); // Reset the hotkey bindings. RestGlobalHotkeys(); } // Show the home screen. DisplayStartingScreen(); }
private void PlaySound_Click(object sender, RoutedEventArgs e) { Button tempButton = (Button)sender; OverlayListBoxItem temp_overlay_list_box_item = (OverlayListBoxItem)tempButton.DataContext; // Perfrom the same action as the pressed hotkey. ExecuteOverlayItem(temp_overlay_list_box_item.OverlayItemData.HotKeyID); }
private void DisplayStop(OverlayListBoxItem overlay_list_box_item) { // Hide the play button. overlay_list_box_item.PlayVisible = Visibility.Collapsed; // Show the stop button. overlay_list_box_item.StopVisible = Visibility.Visible; }
private void EditButton_Click(object sender, RoutedEventArgs e) { // Get the selected OverlayItem. OverlayListBoxItem temp_overlay_list_box_item = (OverlayListBoxItem)overlay_lv.SelectedItem; OverlayItem temp_overlay_item = temp_overlay_list_box_item.OverlayItemData; // Bind the sored OverlayItem to the AddOverlayItem dialog. add_overlay_item_container.DataContext = temp_overlay_item; // Show the add item screen. DisplayItemScreen("Edit Item"); }
private void DeleteButton_Click(object sender, RoutedEventArgs e) { // Get the selected OverlayItem. OverlayListBoxItem temp_overlay_list_box_item = (OverlayListBoxItem)overlay_lv.SelectedItem; // Remove OverlayItem OverlayListBoxItems.Remove(temp_overlay_list_box_item); // Resave the overlay list. settings_manager.SaveOverlayItems(OverlayListBoxItems); // Reset the hotkey bindings. RestGlobalHotkeys(); }
private void AddOverlayItem(OverlayItem overlay_item) { // Register the hotkey with the global listner. global_hotkey_listner.RegisterGlobalHotkey(overlay_item); OverlayListBoxItem temp_overlay_list_box_item = new OverlayListBoxItem(); temp_overlay_list_box_item.PopulateOverlayItem(overlay_item); // Add the OverlayItem to the list of displayed items. OverlayListBoxItems.Add(temp_overlay_list_box_item); // Show Play Button DisplayPlay(temp_overlay_list_box_item); }