public ActionResult Play( [FromRoute, Required] string sessionId, [FromQuery, Required] PlayCommand playCommand, [FromQuery, Required, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] Guid[] itemIds, [FromQuery] long?startPositionTicks, [FromQuery] string?mediaSourceId, [FromQuery] int?audioStreamIndex, [FromQuery] int?subtitleStreamIndex, [FromQuery] int?startIndex) { var playRequest = new PlayRequest { ItemIds = itemIds, StartPositionTicks = startPositionTicks, PlayCommand = playCommand, MediaSourceId = mediaSourceId, AudioStreamIndex = audioStreamIndex, SubtitleStreamIndex = subtitleStreamIndex, StartIndex = startIndex }; _sessionManager.SendPlayCommand( RequestHelpers.GetSession(_sessionManager, _authContext, Request).Id, sessionId, playRequest, CancellationToken.None); return(NoContent()); }
protected SoundPlayerViewModelBase(string displayName, string groupName) { DisplayName = displayName; GroupName = groupName; IsWave = groupName == SoundMachineViewModel.GenWaveGroup; var isPlayingChanged = this.WhenAnyValue(x => x.IsPlaying); var canPlay = isPlayingChanged.Select(isPlaying => !isPlaying); var canStop = isPlayingChanged.Select(IsPlaying => IsPlaying); canPlay.ToProperty(this, nameof(IsLoopedEnabled), out _isLoopedEnabled) .DisposeWith(Disposables); PlayCommand = ReactiveCommand.Create(ExecutePlay, canPlay); StopCommand = ReactiveCommand.Create(ExecuteStop, canStop); PlayCommand.ObserveOn(RxApp.MainThreadScheduler) .Do(_ => IsPlaying = true) .Subscribe(); StopCommand.ObserveOn(RxApp.MainThreadScheduler) .Do(_ => IsPlaying = false) .Subscribe(); this.WhenAnyValue(x => x.Duration, x => x.IsPlaying, x => x.IsLooped, (duration, isPlaying, isLooped) => (duration, isPlaying, isLooped)) .Where(x => x.duration > 0 && x.isPlaying && !x.isLooped) .Select(x => Observable.Timer(TimeSpan.FromSeconds(x.duration))) .Switch() .ObserveOn(RxApp.MainThreadScheduler) .Subscribe(_ => IsPlaying = false) .DisposeWith(Disposables); }
/// <summary> /// Add a play command to the stack of commands /// </summary> public void InvokePlayCommand() { PlayCommand cmd = new PlayCommand(Context); CommandsStack.Push(cmd); //Update(); }
public void AssignPlayer(MediaElement Player, Window Window) { _player = Player; _window = Window; _player.MediaOpened += (S, E) => { From = TimeSpan.Zero; if (_player.NaturalDuration.HasTimeSpan) { To = End = _player.NaturalDuration.TimeSpan; } else { To = End = TimeSpan.Zero; } PlaybackPosition = From; PlayCommand.RaiseCanExecuteChanged(true); TrimCommand.RaiseCanExecuteChanged(true); }; _timer.Start(); }
private void RaiseButtonsCommandsCanExecuteChanged() { RaisePropertyChanged(nameof(AreButtonsEnabled)); PlayCommand.RaiseCanExecuteChanged(); PauseCommand.RaiseCanExecuteChanged(); StopCommand.RaiseCanExecuteChanged(); }
private void UpdateCommands() { PlayCommand.OnCanExecuteChanged(); PauseCommand.OnCanExecuteChanged(); StopCommand.OnCanExecuteChanged(); RestartCommand.OnCanExecuteChanged(); CaptureImageCommand.OnCanExecuteChanged(); }
public ControlBarVM(FGM m) : base(m) { PauseTheFlight = new PauseCommand(PauseThread); PlayTheFlight = new PlayCommand(ContinueRunning); IncreaseTheSpeed = new PlusCommand(IncreaseSpeed); DecreaseTheSpeed = new MinusCommand(DecreaseSpeed); StopTheFlight = new StopCommand(StopFlight); }
private void HandlePlaySongMessage(Message message) { if (message.Payload is Mediafile song) { message.HandledStatus = MessageHandledStatus.HandledCompleted; PlayCommand.Execute(song); } }
public MainWindowViewModel() { Zero = settingModel.ToReactivePropertyAsSynchronized(x => x.Zero); One = settingModel.ToReactivePropertyAsSynchronized(x => x.One); Two = settingModel.ToReactivePropertyAsSynchronized(x => x.Two); Three = settingModel.ToReactivePropertyAsSynchronized(x => x.Three); Four = settingModel.ToReactivePropertyAsSynchronized(x => x.Four); Five = settingModel.ToReactivePropertyAsSynchronized(x => x.Five); Six = settingModel.ToReactivePropertyAsSynchronized(x => x.Six); Seven = settingModel.ToReactivePropertyAsSynchronized(x => x.Seven); Eight = settingModel.ToReactivePropertyAsSynchronized(x => x.Eight); Nine = settingModel.ToReactivePropertyAsSynchronized(x => x.Nine); Ten = settingModel.ToReactivePropertyAsSynchronized(x => x.Ten); Eleven = settingModel.ToReactivePropertyAsSynchronized(x => x.Eleven); Twelve = settingModel.ToReactivePropertyAsSynchronized(x => x.Twelve); Thirteen = settingModel.ToReactivePropertyAsSynchronized(x => x.Thirteen); Fourteen = settingModel.ToReactivePropertyAsSynchronized(x => x.Fourteen); Fifteen = settingModel.ToReactivePropertyAsSynchronized(x => x.Fifteen); Sixteen = settingModel.ToReactivePropertyAsSynchronized(x => x.Sixteen); Seventeen = settingModel.ToReactivePropertyAsSynchronized(x => x.Seventeen); Eighteen = settingModel.ToReactivePropertyAsSynchronized(x => x.Eighteen); Nineteen = settingModel.ToReactivePropertyAsSynchronized(x => x.Nineteen); Twenty = settingModel.ToReactivePropertyAsSynchronized(x => x.Twenty); Twentyone = settingModel.ToReactivePropertyAsSynchronized(x => x.Twentyone); Twentytwo = settingModel.ToReactivePropertyAsSynchronized(x => x.Twentytwo); Twentythree = settingModel.ToReactivePropertyAsSynchronized(x => x.Twentythree); OpenFileCommand.Subscribe(x => ButtonAction(x)); PlayCommand.Subscribe(x => PlayAction(x)); StartCommand.Subscribe(_ => StartAction()); StopCommand.Subscribe(_ => StopAction()); }
private void RaiseCommandCanExecuteChanged() { PlayCommand.RaiseCanExecuteChanged(); PauseCommand.RaiseCanExecuteChanged(); StopCommand.RaiseCanExecuteChanged(); NextCommand.RaiseCanExecuteChanged(); PreviousCommand.RaiseCanExecuteChanged(); RaisePropertyChanged(nameof(CurrentMedia)); }
public void AddResFactory(IResourceFactory factory, CommandManager cmdMgr) { resFactories.Add(factory); // register factory command node var playCommand = new PlayCommand(factory.FactoryFor, cmdResPrepath + factory.SubCommandName); cmdMgr.RegisterCommand(playCommand.Command); }
public void AddFactory(IPlaylistFactory factory) { factories.Add(factory); // register factory command node var playCommand = new PlayCommand(factory.FactoryFor); CommandNode.AddCommand(factory.SubCommandName, playCommand.Command); }
public void AddListFactory(IPlaylistFactory factory, CommandManager cmdMgr) { listFactories.Add(factory); // register factory command node var playCommand = new PlayCommand(factory.FactoryFor, cmdListPrepath + factory.SubCommandName); cmdMgr.RegisterCommand(playCommand.Command); }
/** * 初期化 */ public DBViewModel(DxxDBViewerWindow owner) : base(owner) { RefreshCommand.Subscribe(RefreshDB); RetryDownloadCommand.Subscribe(RetryDownload); PlayCommand.Subscribe(ShowPlayer); DeleteAndBlockCommand.Subscribe(DeleteAndBlock); ResetAndDownloadCommand.Subscribe(ResetAndDownload); PlayList = new DBPlayList(this); DxxDBStorage.Instance.DBUpdated += OnDBUpdated; }
public void OnPlayCommand(object obj) { _points.Clear(); Manager.Manager.JoueurEnCours.Intructions.Clear(); Manager.Manager.JoueurEnCours.Intructions.AddRange(Programme); DisplayMode = DisplayModeEnum.EXECUTE; CurrentExecutingProgram = 0; PlayCommand.RaiseCanExecuteChanged(); Manager.ExecuterProgramme(); }
/// <summary> /// Plays this instance. /// </summary> public void Play() { if (PlayCommand?.CanExecute(null) == true) { PlayCommand?.Execute(null); MediaState = MediaState.Playing; OnMediaStateChanged(); } }
public void Create() { var log = A.Fake <ILogger>(); var radio = A.Fake <IRadio>(); var stationProvider = A.Fake <IStationProvider>(); var provider = A.Fake <IConfigurationProvider>(); var command = new PlayCommand(log, s => { }, stationProvider, provider, radio); Assert.NotNull(command); }
public void Play(PlayCommand play) { var validator = new PlayCommandValidator(this); validator.ValidateAndThrow(play); var place = Board[play.Row, play.Column]; var card = CurrentPlayer.Cards.Find(play.CardId); place.PutCard(CurrentPlayer, card); }
private void UpdateCommands() { RemoveSelectedVideoCommand.RaiseCanExecuteChanged(); AddMarkerCommand.RaiseCanExecuteChanged(); RemoveSelectedMarkerCommand.RaiseCanExecuteChanged(); PlayCommand.RaiseCanExecuteChanged(); PauseCommand.RaiseCanExecuteChanged(); StopCommand.RaiseCanExecuteChanged(); Plus5Command.RaiseCanExecuteChanged(); Minus5Command.RaiseCanExecuteChanged(); }
public VocalizedViewModel(TextToSpeech textToSpeech, IAudioPlayer audioPlayer, ISettingsService settingsService) { TextToSpeech = textToSpeech; AudioPlayer = audioPlayer; AudioPlayer.OutputDevice = settingsService.settings.generalSettings.AudioOutDevice; AudioPlayer.AudioFile = TextToSpeech.AudioFile; this.settingsService = settingsService; settings = settingsService.settings; PlayCmd = new PlayCommand(this); StopCmd = new StopCommand(this); PauseCmd = new PauseCommand(this); }
/// <summary> /// Updates UI bound to play/pause properties. /// </summary> private void UpdateViews() { OnPropertyChanged("IsPaused"); OnPropertyChanged("IsShowingPauseDisplay"); OnPropertyChanged("IsPauseButtonVisible"); UpdateClockView(); PlayCommand.RaiseCanExecuteChanged(); PauseCommand.RaiseCanExecuteChanged(); GameViewModel.MoveCommand.RaiseCanExecuteChanged(); GameViewModel.UndoCommand.RaiseCanExecuteChanged(); GameViewModel.RedoCommand.RaiseCanExecuteChanged(); }
public VideoPackItemViewModel(SimulationSeed simulationSeed, Action <Simulation> onPlay) { Video = simulationSeed.Video; Duration = simulationSeed.Video.RecordedInterval.Value.Duration.ToTimeSpan(); Date = simulationSeed.Video.RecordedInterval.Value.Start.ToDateTimeOffset(); PlayCommand = ReactiveCommand.CreateFromTask(async() => new Simulation(simulationSeed.Video, await simulationSeed.GetFlight(), simulationSeed.GetPresentationOptions())); PlayCommand.Subscribe(onPlay); isBusy = PlayCommand.IsExecuting.ToProperty(this, x => x.IsBusy); }
public IActionResult Put(Guid gameId, [FromBody] PlayCommand command) { if (!Games.ContainsKey(gameId)) { return(NotFound()); } var game = Games[gameId]; game.Play(command); return(Ok(game)); }
protected async Task Handle(PlayCommand message) { //{"jsonrpc": "2.0", "method": "Player.PlayPause", "params": { "playerid": 1 }, "id": 1} if (_speed != 0) { return; } var cmd = GetKodiCommand("Player.PlayPause", new { playerid = PlayerId.GetValueOrDefault() }); var result = await MessageBroker.QueryService <KodiCommand, JsonRpcResponse>(cmd).ConfigureAwait(false); _speed = await UpdateState(PlaybackState.StateName, _speed, 1.0).ConfigureAwait(false); }
public void CheckName() { var log = A.Fake <ILogger>(); var radio = A.Fake <IRadio>(); var stationProvider = A.Fake <IStationProvider>(); var provider = A.Fake <IConfigurationProvider>(); var command = new PlayCommand(log, s => { }, stationProvider, provider, radio); Assert.Contains("-p", command.Name); Assert.Contains("--play", command.Name); Assert.Contains("Play selected station using {ID} argument", command.Description); }
public MainViewModel() { PatchNotes = "Currently loading the launcher.\n Please wait"; _updateCommand = new UpdateCommand(this); _updateCommand.CanExecuteChanged += _updateCommand_CanExecuteChanged; _playCommand = new PlayCommand(); StartButtonCommand = new SequentialCompositeCommand(new List <ICommand> { _updateCommand, _playCommand }); }
public UserViewModel() { setUserList(); SelectedItem = Users[0]; setSelectedItemImage(SelectedItem.image); AddNewUserCommand = new AddNewUserCommand(this); NextUserCommand = new SelectNextUserCommand(this); PreviousUserCommand = new SelectPreviousUserCommand(this); DeleteUserCommand = new DeleteUserCommand(this); CancelWindowCommand = new CancelMainWindowCommand(this); OpenWindowOnPlayCommand = new PlayCommand(this); SelectCategoryCommand = new SelectCategoryCommand(this); // SetCategoryNameCommand = new SetCategoryNameCommand(this); }
public async Task ExecuteWithNoStation() { var log = A.Fake <ILogger>(); var radio = A.Fake <IRadio>(); var stationProvider = A.Fake <IStationProvider>(); var provider = A.Fake <IConfigurationProvider>(); A.CallTo(() => stationProvider.Search(0)).Returns <Station>(null); var command = new PlayCommand(log, s => { }, stationProvider, provider, radio); var result = await command.Execute(new string[] { "0" }); Assert.Equal(CommandResult.Error, result); }
public static bool Validate(this PlayCommand command, GameState state) { if (state.Combat.Cards.Count < command.CardIndex) { return(false); } var card = state.Combat.Cards[(int)command.CardIndex]; if (card.HasTarget && (!command.MonsterIndex.HasValue || state.Combat.Monsters.Count < command.MonsterIndex.Value)) { return(false); } return(card.IsPlayable); }
void HandlePlaySongMessage(Message message) { if (message.Payload is Mediafile) { var song = message.Payload as Mediafile; if (message != null) { message.HandledStatus = MessageHandledStatus.HandledCompleted; } if (song != null) { PlayCommand.Execute(song); } } }
public virtual void PlayHandler(PlayCommand command) { this.Play(command.Sender as MainGameRootViewModel); }
private async Task<TurnViewModel> ExecutePlayCommand(PlayCommand playCommand) { var playTurnContent = new FormUrlEncodedContent(new[] { new KeyValuePair<string, string>("gameId", playCommand.GameId), new KeyValuePair<string, string>("positionX", playCommand.PositionX.ToString()), new KeyValuePair<string, string>("positionY", playCommand.PositionY.ToString()) }); var response = await this.Requester.HttpClient.PostAsync(PlayEndPoint, playTurnContent); if (!response.IsSuccessStatusCode) { throw ApiException.Create(response); } return response.Content.ReadAsAsync<TurnViewModel>().Result; }
public HandViewModel(BaseGameViewModel mainViewModel) { this.mainViewModel = mainViewModel; this.playCmd = new PlayCommand(this); }
public void SetCommand(PlayCommand playcmd) { this._commandobj = playcmd; }
public virtual void ExecutePlay(PlayCommand command) { command.Sender = MainGameRoot; MainGameRoot.Play.OnNext(command); }
/// <summary> /// Process the game. /// </summary> /// <param name="playBoard">Current play board value.</param> /// <param name="playerMoves">Current player moves.</param> public void ProcessGame(ref char[,] playBoard, ref int playerMoves) { byte rowLenght = (byte)playBoard.GetLength(0); byte columnLenght = (byte)playBoard.GetLength(1); Board boardGenerator = new Board(rowLenght, columnLenght); ScoreBoardFormatter formatter = new ScoreBoardFormatter(); // ILogger fileLogger = new FileLogger("scorebord.txt", formatter); ILogger consoleLogger = new ConsoleLogger(formatter); ScoreBoard scoreBoard = new ScoreBoard(consoleLogger); var printer = PrintingManager.Instance; switch (this.currentCommand) { case "RESTART": IInputCommand restart = new RestartCommand(boardGenerator, printer); restart.Execute(ref playBoard, ref playerMoves); break; case "TOP": IInputCommand topscoreBoard = new TopCommand(scoreBoard, this.topPlayers); topscoreBoard.Execute(ref playBoard, ref playerMoves); break; case "EXIT": break; default: InputCommandValidator validator = new InputCommandValidator(); if (validator.IsValidInputCommand(this.currentCommand)) { IInputCommand play = new PlayCommand(this.currentCommand, this.topPlayers, scoreBoard, boardGenerator, printer); play.Execute(ref playBoard, ref playerMoves); break; } Console.WriteLine("Wrong input ! Try Again ! "); break; } }