From 55fc8d5e4019b7ff24099b3e4deeb0a6672ac523 Mon Sep 17 00:00:00 2001 From: Matt Nadareski Date: Tue, 29 Jun 2021 22:54:50 -0700 Subject: [PATCH] Populate themes to its own helper method --- RedBookPlayer/GUI/SettingsWindow.xaml.cs | 54 +++++++++++++++--------- 1 file changed, 33 insertions(+), 21 deletions(-) diff --git a/RedBookPlayer/GUI/SettingsWindow.xaml.cs b/RedBookPlayer/GUI/SettingsWindow.xaml.cs index f88a3ac..cfe293e 100644 --- a/RedBookPlayer/GUI/SettingsWindow.xaml.cs +++ b/RedBookPlayer/GUI/SettingsWindow.xaml.cs @@ -44,30 +44,42 @@ namespace RedBookPlayer.GUI void InitializeComponent() { AvaloniaXamlLoader.Load(this); - - _themeList = this.FindControl("ThemeList"); - _themeList.SelectionChanged += ThemeList_SelectionChanged; - - List items = new List(); - items.Add("default"); - - if(Directory.Exists("themes/")) - { - foreach(string dir in Directory.EnumerateDirectories("themes/")) - { - string themeName = dir.Split('/')[1]; - - if (!File.Exists($"themes/{themeName}/view.xaml")) - continue; - - items.Add(themeName); - } - } - - _themeList.Items = items; + + PopulateThemes(); this.FindControl