Beispiel #1
0
        public MainPageViewModel()
        {
            _twitchService         = App.Current?.Container?.Resolve <ITwitchService>();
            _suaveKeysService      = App.Current?.Container?.Resolve <ISuaveKeysService>();
            CommandLog             = "";
            SuaveKeysSignInCommand = new Command(async() =>
            {
                var signInResult    = await _suaveKeysService.StartSignInAsync();
                IsLinkedToSuaveKeys = signInResult?.ResultType == ResultType.Ok;
            });
            TwitchSignInCommand = new Command(async() =>
            {
                var signInResult = await _twitchService.StartSignInAsync();
                IsLinkedToTwitch = signInResult?.ResultType == ResultType.Ok;
            });
            ToggleStartCommand = new Command(async() =>
            {
                var startResult = await _twitchService.ToggleListeningAsync(Channel);
                if (startResult?.ResultType == ResultType.Ok)
                {
                    IsListening = !IsListening;
                }
            });

            _twitchService.OnCommandReceived += TwitchService_OnCommandReceived;
        }
 public MainPageViewModel()
 {
     _suaveKeysService      = App.Current?.Container?.Resolve <ISuaveKeysService>();
     CommandLog             = "";
     SuaveKeysSignInCommand = new AsyncCommand(async() =>
     {
         var signInResult          = await _suaveKeysService.StartSignInAsync();
         SuaveKeysSignInVisibility = signInResult?.ResultType == ResultType.Ok ? Visibility.Visible : Visibility.Collapsed;
     });
     ToggleStartCommand = new AsyncCommand(async() =>
     {
         if (!GraphicsCaptureSession.IsSupported())
         {
             Error = "This device does not support the capture requirements";
             return;
         }
         if (!_isRecording)
         {
             await SetupEncoding();
         }
         else
         {
             Stop();
             Cleanup();
         }
     });
 }