Merge f79cff8daa
into 87f238be60
This commit is contained in:
commit
82747d798a
4 changed files with 22 additions and 29 deletions
|
@ -17,7 +17,7 @@ namespace Ryujinx.Ava.UI.Helpers
|
|||
}
|
||||
|
||||
var timeZone = (TimeZone)value;
|
||||
return string.Format("{0} {1} {2}", timeZone.UtcDifference, timeZone.Location, timeZone.Abbreviation);
|
||||
return timeZone.ToString();
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
namespace Ryujinx.Ava.UI.Models
|
||||
{
|
||||
internal class TimeZone
|
||||
public class TimeZone
|
||||
{
|
||||
public TimeZone(string utcDifference, string location, string abbreviation)
|
||||
{
|
||||
|
@ -9,6 +9,21 @@ namespace Ryujinx.Ava.UI.Models
|
|||
Abbreviation = abbreviation;
|
||||
}
|
||||
|
||||
public string ToString()
|
||||
{
|
||||
// Prettifies location strings eg:
|
||||
// "America/Costa_Rica" -> "Costa Rica"
|
||||
var location = Location.Replace("_", " ");
|
||||
|
||||
if (location.Contains("/"))
|
||||
{
|
||||
var parts = location.Split("/");
|
||||
location = parts[1];
|
||||
}
|
||||
|
||||
return $"{UtcDifference} - {location}";
|
||||
}
|
||||
|
||||
public string UtcDifference { get; set; }
|
||||
public string Location { get; set; }
|
||||
public string Abbreviation { get; set; }
|
||||
|
|
|
@ -273,24 +273,17 @@ namespace Ryujinx.Ava.UI.ViewModels
|
|||
}
|
||||
}
|
||||
|
||||
public SettingsViewModel(VirtualFileSystem virtualFileSystem, ContentManager contentManager) : this()
|
||||
public SettingsViewModel(VirtualFileSystem virtualFileSystem, ContentManager contentManager)
|
||||
{
|
||||
_virtualFileSystem = virtualFileSystem;
|
||||
_contentManager = contentManager;
|
||||
if (Program.PreviewerDetached)
|
||||
{
|
||||
Task.Run(LoadTimeZones);
|
||||
}
|
||||
}
|
||||
|
||||
public SettingsViewModel()
|
||||
{
|
||||
GameDirectories = new AvaloniaList<string>();
|
||||
TimeZones = new AvaloniaList<TimeZone>();
|
||||
AvailableGpus = new ObservableCollection<ComboBoxItem>();
|
||||
_validTzRegions = new List<string>();
|
||||
_networkInterfaces = new Dictionary<string, string>();
|
||||
|
||||
LoadTimeZones();
|
||||
|
||||
Task.Run(CheckSoundBackends);
|
||||
Task.Run(PopulateNetworkInterfaces);
|
||||
|
||||
|
@ -346,7 +339,7 @@ namespace Ryujinx.Ava.UI.ViewModels
|
|||
Dispatcher.UIThread.Post(() => OnPropertyChanged(nameof(PreferredGpuIndex)));
|
||||
}
|
||||
|
||||
public async Task LoadTimeZones()
|
||||
public void LoadTimeZones()
|
||||
{
|
||||
_timeZoneContentManager = new TimeZoneContentManager();
|
||||
|
||||
|
@ -359,15 +352,9 @@ namespace Ryujinx.Ava.UI.ViewModels
|
|||
|
||||
string abbr2 = abbr.StartsWith('+') || abbr.StartsWith('-') ? string.Empty : abbr;
|
||||
|
||||
await Dispatcher.UIThread.InvokeAsync(() =>
|
||||
{
|
||||
TimeZones.Add(new TimeZone($"UTC{hours:+0#;-0#;+00}:{minutes:D2}", location, abbr2));
|
||||
|
||||
_validTzRegions.Add(location);
|
||||
});
|
||||
TimeZones.Add(new TimeZone($"UTC{hours:+0#;-0#;+00}:{minutes:D2}", location, abbr2));
|
||||
}
|
||||
|
||||
Dispatcher.UIThread.Post(() => OnPropertyChanged(nameof(TimeZone)));
|
||||
}
|
||||
|
||||
private async Task PopulateNetworkInterfaces()
|
||||
|
|
|
@ -26,15 +26,6 @@ namespace Ryujinx.Ava.UI.Windows
|
|||
Load();
|
||||
}
|
||||
|
||||
public SettingsWindow()
|
||||
{
|
||||
ViewModel = new SettingsViewModel();
|
||||
DataContext = ViewModel;
|
||||
|
||||
InitializeComponent();
|
||||
Load();
|
||||
}
|
||||
|
||||
public void SaveSettings()
|
||||
{
|
||||
InputPage.ControllerSettings?.SaveCurrentProfile();
|
||||
|
|
Loading…
Add table
Reference in a new issue