UI: Button to set emulator time based on system time in settings, under the time settings.

Partially resolves #355. I think that wanted automatic. If automatic functionality is still desired even with this change then that will be considered.
This commit is contained in:
Evan Husted 2024-12-21 19:43:40 -06:00
parent 1f0fa525a3
commit d9fe0da345
3 changed files with 34 additions and 1 deletions

View file

@ -329,7 +329,11 @@ namespace Ryujinx.Ava.UI.ViewModels
}
}
//private DateTimeOffset _currentDate;
//private TimeSpan _currentTime;
public DateTimeOffset CurrentDate { get; set; }
public TimeSpan CurrentTime { get; set; }
internal AvaloniaList<TimeZone> TimeZones { get; set; }
@ -453,6 +457,18 @@ namespace Ryujinx.Ava.UI.ViewModels
Dispatcher.UIThread.Post(() => OnPropertyChanged(nameof(PreferredGpuIndex)));
}
public void MatchSystemTime()
{
var dto = DateTimeOffset.Now;
CurrentDate = new DateTimeOffset(dto.Year, dto.Month, dto.Day, 0, 0, 0, dto.Offset);
CurrentTime = dto.TimeOfDay;
OnPropertyChanged(nameof(CurrentDate));
OnPropertyChanged(nameof(CurrentTime));
}
public async Task LoadTimeZones()
{
_timeZoneContentManager = new TimeZoneContentManager();