/ src / Ryujinx / UI / Views / Settings / SettingsSystemView.axaml.cs
SettingsSystemView.axaml.cs
 1  using Avalonia.Controls;
 2  using Ryujinx.Ava.UI.ViewModels;
 3  using TimeZone = Ryujinx.Ava.UI.Models.TimeZone;
 4  
 5  namespace Ryujinx.Ava.UI.Views.Settings
 6  {
 7      public partial class SettingsSystemView : UserControl
 8      {
 9          public SettingsViewModel ViewModel;
10  
11          public SettingsSystemView()
12          {
13              InitializeComponent();
14          }
15  
16          private void TimeZoneBox_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
17          {
18              if (e.AddedItems != null && e.AddedItems.Count > 0)
19              {
20                  if (e.AddedItems[0] is TimeZone timeZone)
21                  {
22                      e.Handled = true;
23  
24                      ViewModel.ValidateAndSetTimeZone(timeZone.Location);
25                  }
26              }
27          }
28  
29          private void TimeZoneBox_OnTextChanged(object sender, TextChangedEventArgs e)
30          {
31              if (sender is AutoCompleteBox box && box.SelectedItem is TimeZone timeZone)
32              {
33                  ViewModel.ValidateAndSetTimeZone(timeZone.Location);
34              }
35          }
36      }
37  }