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 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); }