46 lines
1.8 KiB
C#
46 lines
1.8 KiB
C#
|
|
using TeamsISO.Engine.Controller;
|
||
|
|
using TeamsISO.Engine.Domain;
|
||
|
|
|
||
|
|
namespace TeamsISO.App.ViewModels;
|
||
|
|
|
||
|
|
/// <summary>
|
||
|
|
/// Bindings for the global settings panel: framerate, resolution, aspect, audio.
|
||
|
|
/// </summary>
|
||
|
|
public sealed class GlobalSettingsViewModel : ObservableObject
|
||
|
|
{
|
||
|
|
private readonly IIsoController _controller;
|
||
|
|
private TargetFramerate _framerate;
|
||
|
|
private TargetResolution _resolution;
|
||
|
|
private AspectMode _aspect;
|
||
|
|
private AudioMode _audio;
|
||
|
|
|
||
|
|
public GlobalSettingsViewModel(IIsoController controller)
|
||
|
|
{
|
||
|
|
_controller = controller;
|
||
|
|
var current = controller.GlobalSettings;
|
||
|
|
_framerate = current.Framerate;
|
||
|
|
_resolution = current.Resolution;
|
||
|
|
_aspect = current.Aspect;
|
||
|
|
_audio = current.Audio;
|
||
|
|
ApplyCommand = new AsyncRelayCommand(ApplyAsync);
|
||
|
|
}
|
||
|
|
|
||
|
|
public IEnumerable<TargetFramerate> AvailableFramerates => Enum.GetValues<TargetFramerate>();
|
||
|
|
public IEnumerable<TargetResolution> AvailableResolutions => Enum.GetValues<TargetResolution>();
|
||
|
|
public IEnumerable<AspectMode> AvailableAspectModes => Enum.GetValues<AspectMode>();
|
||
|
|
public IEnumerable<AudioMode> AvailableAudioModes => Enum.GetValues<AudioMode>();
|
||
|
|
|
||
|
|
public TargetFramerate Framerate { get => _framerate; set => SetField(ref _framerate, value); }
|
||
|
|
public TargetResolution Resolution { get => _resolution; set => SetField(ref _resolution, value); }
|
||
|
|
public AspectMode Aspect { get => _aspect; set => SetField(ref _aspect, value); }
|
||
|
|
public AudioMode Audio { get => _audio; set => SetField(ref _audio, value); }
|
||
|
|
|
||
|
|
public AsyncRelayCommand ApplyCommand { get; }
|
||
|
|
|
||
|
|
private Task ApplyAsync()
|
||
|
|
{
|
||
|
|
var settings = new FrameProcessingSettings(_framerate, _resolution, _aspect, _audio);
|
||
|
|
return _controller.SetGlobalSettingsAsync(settings, CancellationToken.None);
|
||
|
|
}
|
||
|
|
}
|