diff options
author | Isaac Marovitz <42140194+IsaacMarovitz@users.noreply.github.com> | 2023-01-06 18:35:21 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-07 00:35:21 +0100 |
commit | 38519f3b9ade223983f7529f9b4f4b857c60f42b (patch) | |
tree | a041ee4171f61417b75dd6a7a204d6d150f60ecb /Ryujinx.Ava/UI/Views/Settings/SettingsSystemView.axaml.cs | |
parent | 7f27aabbd0501b32e4918384c0a50fd0b7f357fe (diff) |
Ava GUI: `SettingsWindow` Refactor (#4177)1.1.513
* Fix redundancies
* Add back elses
* Settings Refactor
* Fix Disposal functions
* Use `ReflectionBinding` instead of redundant funcs
* Ac_K suggestions
* Update Ryujinx.Ava/UI/ViewModels/SettingsViewModel.cs
Co-authored-by: Ac_K <Acoustik666@gmail.com>
* Update locale keys
* Update Ryujinx.Ava/UI/Windows/SettingsWindow.axaml.cs
Co-authored-by: TSRBerry <20988865+TSRBerry@users.noreply.github.com>
* Update Ryujinx.Ava/UI/Views/Settings/SettingsSystemView.axaml.cs
Co-authored-by: TSRBerry <20988865+TSRBerry@users.noreply.github.com>
* Update Ryujinx.Ava/UI/Views/Settings/SettingsSystemView.axaml.cs
Co-authored-by: TSRBerry <20988865+TSRBerry@users.noreply.github.com>
* Update Ryujinx.Ava/UI/Windows/SettingsWindow.axaml.cs
Co-authored-by: TSRBerry <20988865+TSRBerry@users.noreply.github.com>
* Use block-scoped namespaces
* Fix typo
* Make `TimeZone` internal again
Co-authored-by: Ac_K <Acoustik666@gmail.com>
Co-authored-by: TSRBerry <20988865+TSRBerry@users.noreply.github.com>
Diffstat (limited to 'Ryujinx.Ava/UI/Views/Settings/SettingsSystemView.axaml.cs')
-rw-r--r-- | Ryujinx.Ava/UI/Views/Settings/SettingsSystemView.axaml.cs | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/Ryujinx.Ava/UI/Views/Settings/SettingsSystemView.axaml.cs b/Ryujinx.Ava/UI/Views/Settings/SettingsSystemView.axaml.cs new file mode 100644 index 00000000..d2ea59de --- /dev/null +++ b/Ryujinx.Ava/UI/Views/Settings/SettingsSystemView.axaml.cs @@ -0,0 +1,52 @@ +using Avalonia.Controls; +using Avalonia.Data; +using Avalonia.Data.Converters; +using Ryujinx.Ava.UI.ViewModels; +using System; +using System.Linq; +using TimeZone = Ryujinx.Ava.UI.Models.TimeZone; + +namespace Ryujinx.Ava.UI.Views.Settings +{ + public partial class SettingsSystemView : UserControl + { + public SettingsViewModel ViewModel; + + public SettingsSystemView() + { + InitializeComponent(); + + FuncMultiValueConverter<string, string> converter = new(parts => string.Format("{0} {1} {2}", parts.ToArray()).Trim()); + MultiBinding tzMultiBinding = new() { Converter = converter }; + + tzMultiBinding.Bindings.Add(new Binding("UtcDifference")); + tzMultiBinding.Bindings.Add(new Binding("Location")); + tzMultiBinding.Bindings.Add(new Binding("Abbreviation")); + + TimeZoneBox.ValueMemberBinding = tzMultiBinding; + } + + private void TimeZoneBox_OnSelectionChanged(object sender, SelectionChangedEventArgs e) + { + if (e.AddedItems != null && e.AddedItems.Count > 0) + { + if (e.AddedItems[0] is TimeZone timeZone) + { + e.Handled = true; + + ViewModel.ValidateAndSetTimeZone(timeZone.Location); + } + } + } + + private void TimeZoneBox_OnTextChanged(object sender, EventArgs e) + { + if (sender is AutoCompleteBox box && box.SelectedItem is TimeZone timeZone) + { + { + ViewModel.ValidateAndSetTimeZone(timeZone.Location); + } + } + } + } +}
\ No newline at end of file |