public void DisplayThemes() { List <Theme> themeList = ThemeGateway.GetThemesList(); this.ThemeView.ThemeListBox.ClearAllItems(); foreach (Theme theme in themeList) { this.ThemeView.ThemeListBox.AddDisplayTheme(new ThemeDTView(theme.ID, theme.Name)); } if (themeList.Count > 0) { this.ThemeView.ThemeListBox.SetSelectionAt(0); } }
private int GetSelectedThemeID() { List <Theme> themeList = ThemeGateway.GetThemesList(); string selectedTheme = Utility.Settings.UserSettings.Profile.ThemeSelected; int themeID = -1; for (int i = 0; i < themeList.Count; i++) { if (themeList[i].Name == selectedTheme) { themeID = themeList[i].ID; } } return(themeID); }
void ThemeView_OnDeleteTheme(int id) { try { ThemeGateway.DeleteTheme(id); this.ThemeView.LeximListBox.ClearAllItems(); this.ThemeView.DisplayLexim(new LeximDTView(0, 0, string.Empty, null, null), this.ThemeView.Play); this.ThemeView.ThemeListBox.RemoveSelectedItem(); if (this.ThemeView.ThemeListBox.ItemsCount == 0) { this.ThemeView.DisplayTheme(new ThemeDTView(0, string.Empty)); } } catch (Exception ex) { this.HandleException("Could not delete theme", ex); } }
void ThemeView_OnSaveTheme(ThemeDTView themeDT) { try { Theme theme = new Theme(themeDT.ID, themeDT.Name); if (theme.ID == 0) { themeDT.ID = ThemeGateway.AddTheme(theme); this.ThemeView.ThemeListBox.InsertTheme(0, themeDT); this.ThemeView.ThemeListBox.SetSelectionAt(0); this.ThemeView.DisplayLexim(new LeximDTView(0, this.ThemeView.ThemeListBox.SelectedTheme.ID, string.Empty, null, null), this.ThemeView.Play); } else { ThemeGateway.UpdateTheme(new Theme(themeDT.ID, themeDT.Name)); this.ThemeView.ThemeListBox.UpdateTheme(themeDT); } } catch (Exception ex) { this.HandleException("Could not add or update theme ", ex); } }