diff --git a/TIDALDL-UI/TIDALDL-UI/Pages/MainView.xaml b/TIDALDL-UI/TIDALDL-UI/Pages/MainView.xaml index 44885042..d9466122 100644 --- a/TIDALDL-UI/TIDALDL-UI/Pages/MainView.xaml +++ b/TIDALDL-UI/TIDALDL-UI/Pages/MainView.xaml @@ -25,7 +25,7 @@ - + - + @@ -81,7 +81,7 @@ - + - + + + + + + + diff --git a/TIDALDL-UI/TIDALDL-UI/Pages/MainView.xaml.cs b/TIDALDL-UI/TIDALDL-UI/Pages/MainView.xaml.cs index 97cf493d..89a977da 100644 --- a/TIDALDL-UI/TIDALDL-UI/Pages/MainView.xaml.cs +++ b/TIDALDL-UI/TIDALDL-UI/Pages/MainView.xaml.cs @@ -34,5 +34,6 @@ private void TextBox_PreviewMouseDoubleClick(object sender, MouseButtonEventArgs TextBox ctrl = (TextBox)sender; ctrl.SelectAll(); } + } } diff --git a/TIDALDL-UI/TIDALDL-UI/Pages/MainViewModel.cs b/TIDALDL-UI/TIDALDL-UI/Pages/MainViewModel.cs index 0533d3e3..c5110a92 100644 --- a/TIDALDL-UI/TIDALDL-UI/Pages/MainViewModel.cs +++ b/TIDALDL-UI/TIDALDL-UI/Pages/MainViewModel.cs @@ -14,6 +14,7 @@ using System.Collections.ObjectModel; using System.IO; using ICSharpCode.SharpZipLib.Zip; +using System.Windows.Controls; namespace TIDALDL_UI.Pages { @@ -35,6 +36,14 @@ public class MainViewModel : Screen public BindableCollection ItemList { get; } = new BindableCollection(); public Thread UpdateThread; + /// + /// Combox + /// + public List QualityList { get; set; } + public int SelectQualityIndex { get; set; } + public List ResolutionList { get; set; } + public int SelectResolutionIndex { get; set; } + private IWindowManager Manager; private LoginViewModel VMLogin; private SettingViewModel VMSetting; @@ -62,6 +71,16 @@ public MainViewModel(IWindowManager manager, UpdateThread.IsBackground = true; UpdateThread.Start(); + QualityList = TidalTool.getQualityList(); + SelectQualityIndex = QualityList.IndexOf(Config.Quality().ToUpper()); + if (SelectQualityIndex < 0) + SelectQualityIndex = 0; + + ResolutionList = TidalTool.getResolutionList(); + SelectResolutionIndex = ResolutionList.IndexOf(Config.Resolution().ToUpper()); + if (SelectResolutionIndex < 0) + SelectResolutionIndex = 0; + TidalTool.SetSearchMaxNum(int.Parse(Config.SearchNum())); //test @@ -94,6 +113,16 @@ public void WindowClose() // } //} + public void QualityChanged(object sender, SelectionChangedEventArgs e) + { + Config.Quality(QualityList[SelectQualityIndex].ToLower()); + } + + public void ResolutionChanged(object sender, SelectionChangedEventArgs e) + { + Config.Resolution(ResolutionList[SelectResolutionIndex]); + } + #region Button public async void Search() { @@ -157,9 +186,13 @@ public void Logout() } public void Setting() { + VMSetting.RefreshSetting(); Manager.ShowDialog(VMSetting); string sValue = Config.ThreadNum(); ThreadTool.SetThreadNum(int.Parse(sValue)); + + SelectQualityIndex = QualityList.IndexOf(Config.Quality().ToUpper()); + SelectResolutionIndex = ResolutionList.IndexOf(Config.Resolution().ToUpper()); } public void About() { diff --git a/TIDALDL-UI/TIDALDL-UI/Pages/SettingView.xaml b/TIDALDL-UI/TIDALDL-UI/Pages/SettingView.xaml index f0b4d3a7..dee9c86b 100644 --- a/TIDALDL-UI/TIDALDL-UI/Pages/SettingView.xaml +++ b/TIDALDL-UI/TIDALDL-UI/Pages/SettingView.xaml @@ -38,8 +38,7 @@ - - +