public static Parser<DoNotAwaitAction> GetParser(
            int indentLevel,
            IAudioService audioService,
            IDelayService delayService,
            ILoggerService loggerService,
            ISpeechService speechService)
        {
            if (indentLevel < 0)
            {
                throw new ArgumentException("indentLevel must be greater than or equal to 0.", "indentLevel");
            }

            audioService.AssertNotNull(nameof(audioService));
            delayService.AssertNotNull(nameof(delayService));
            loggerService.AssertNotNull(nameof(loggerService));
            speechService.AssertNotNull(nameof(speechService));

            return
                from _ in Parse.IgnoreCase("don't")
                from __ in HorizontalWhitespaceParser.Parser.AtLeastOnce()
                from ___ in Parse.IgnoreCase("wait:")
                from ____ in VerticalSeparationParser.Parser.AtLeastOnce()
                from actions in ActionListParser.GetParser(indentLevel + 1, audioService, delayService, loggerService, speechService)
                let child = new SequenceAction(actions)
                select new DoNotAwaitAction(
                    loggerService,
                    child);
        }
Пример #2
0
        public Exercise(ILoggerService loggerService, ISpeechService speechService, string name, int setCount, int repetitionCount, IEnumerable<MatcherWithAction> matchersWithActions)
        {
            loggerService.AssertNotNull(nameof(loggerService));
            speechService.AssertNotNull(nameof(speechService));
            name.AssertNotNull(nameof(name));
            matchersWithActions.AssertNotNull(nameof(matchersWithActions));

            if (setCount < 0)
            {
                throw new ArgumentException("setCount cannot be less than zero.", "setCount");
            }

            if (repetitionCount < 0)
            {
                throw new ArgumentException("repetitionCount cannot be less than zero.", "repetitionCount");
            }

            this.logger = loggerService.GetLogger(this.GetType());
            this.speechService = speechService;
            this.name = name;
            this.setCount = setCount;
            this.repetitionCount = repetitionCount;
            this.matchersWithActions = matchersWithActions.ToImmutableList();

            using (var dummyExecutionContext = new ExecutionContext())
            {
                this.duration = this
                    .GetEventsWithActions(dummyExecutionContext)
                    .SelectMany(x => x.Actions)
                    .Select(x => x.Duration)
                    .DefaultIfEmpty()
                    .Aggregate((running, next) => running + next);
            }
        }
Пример #3
0
        public static Parser<IAction> GetParser(
            int indentLevel,
            IAudioService audioService,
            IDelayService delayService,
            ILoggerService loggerService,
            ISpeechService speechService)
        {
            if (indentLevel < 0)
            {
                throw new ArgumentException("indentLevel must be greater than or equal to 0.", "indentLevel");
            }

            audioService.AssertNotNull(nameof(audioService));
            delayService.AssertNotNull(nameof(delayService));
            loggerService.AssertNotNull(nameof(loggerService));
            speechService.AssertNotNull(nameof(speechService));

            return BreakActionParser.GetParser(delayService, speechService)
                .Or<IAction>(MetronomeActionParser.GetParser(audioService, delayService, loggerService))
                .Or<IAction>(PrepareActionParser.GetParser(delayService, speechService))
                .Or<IAction>(SayActionParser.GetParser(speechService))
                .Or<IAction>(WaitActionParser.GetParser(delayService))
                .Or<IAction>(DoNotAwaitActionParser.GetParser(indentLevel, audioService, delayService, loggerService, speechService))
                .Or<IAction>(ParallelActionParser.GetParser(indentLevel, audioService, delayService, loggerService, speechService))
                .Or<IAction>(SequenceActionParser.GetParser(indentLevel, audioService, delayService, loggerService, speechService));
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="AboutUsViewModel" /> class.
 /// </summary>
 /// <param name="dialogService">The Dialog Service.</param>
 /// <param name="navigationService">The Navigation Service.</param>
 /// <param name="speechService">The Speech Service.</param>
 /// <param name="shareService">The Share Service.</param>
 /// <param name="liveTileService">The Live Tile Service.</param>
 public AboutUsViewModel(IDialogService dialogService, INavigationService navigationService, ISpeechService speechService, IShareService shareService, ILiveTileService liveTileService)
 {
     _dialogService = dialogService;
     _navigationService = navigationService;
     _speechService = speechService;
     _shareService = shareService;
     _liveTileService = liveTileService;
 }
Пример #5
0
        public SayAction(ISpeechService speechService, string speechText)
        {
            Ensure.ArgumentNotNull(speechService, nameof(speechService));
            Ensure.ArgumentNotNull(speechText, nameof(speechText));

            this.speechService = speechService;
            this.speechText = speechText;
        }
Пример #6
0
        public SayAction(ISpeechService speechService, string speechText)
        {
            speechService.AssertNotNull(nameof(speechService));
            speechText.AssertNotNull(nameof(speechText));

            this.speechService = speechService;
            this.speechText = speechText;
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="VideoAlbum_DetailVideosViewModel" /> class.
 /// </summary>
 /// <param name="dialogService">The Dialog Service.</param>
 /// <param name="navigationService">The Navigation Service.</param>
 /// <param name="speechService">The Speech Service.</param>
 /// <param name="shareService">The Share Service.</param>
 /// <param name="liveTileService">The Live Tile Service.</param>
 public VideoAlbum_DetailVideosViewModel(IDialogService dialogService, INavigationService navigationService, ISpeechService speechService, IShareService shareService, ILiveTileService liveTileService)
 {
     _dialogService = dialogService;
     _navigationService = navigationService;
     _speechService = speechService;
     _shareService = shareService;
     _liveTileService = liveTileService;
 }
        public RecipesRecipeDetail1ViewModel(INavigationService _NavigationService, ILiveTileService _LiveTileService, IDialogService _DialogService, IShareService _ShareService, ISpeechService _SpeechService)
        {
            this._NavigationService = _NavigationService;
			this._LiveTileService = _LiveTileService;
			this._DialogService = _DialogService;
			this._ShareService = _ShareService;
			this._SpeechService = _SpeechService;
        }
 public RecipeDetailViewModel(ITileService tileService, IDialogService dialogService,
     IShareService shareService, ISpeechService speechService, INavigationService navigationService)
 {
     _liveTileService = tileService;
     _dialogService = dialogService;
     _shareService = shareService;
     _speechService = speechService;
     _navigationService = navigationService;
 }
        public RecipesRecipesListViewModel(INavigationService _NavigationService, IRecipeDataSource _RecipeDataSource, ILiveTileService _LiveTileService, IDialogService _DialogService, IShareService _ShareService, ISpeechService _SpeechService)
        {
            this._NavigationService = _NavigationService;
			this._RecipeDataSource = _RecipeDataSource;
			this._LiveTileService = _LiveTileService;
			this._DialogService = _DialogService;
			this._ShareService = _ShareService;
			this._SpeechService = _SpeechService;
        }
Пример #11
0
 public ExerciseBuilder()
 {
     this.matchersWithActions = new List<MatcherWithAction>();
     this.loggerService = new LoggerServiceMock(MockBehavior.Loose);
     this.speechService = new SpeechServiceMock(MockBehavior.Loose);
     this.name = "Name";
     this.setCount = 1;
     this.repetitionCount = 1;
 }
        public WaitWithPromptAction(IDelayService delayService, ISpeechService speechService, TimeSpan duration, string promptSpeechText)
        {
            Ensure.ArgumentNotNull(delayService, nameof(delayService));
            Ensure.ArgumentNotNull(speechService, nameof(speechService));
            Ensure.ArgumentNotNull(promptSpeechText, nameof(promptSpeechText));
            Ensure.ArgumentCondition(duration >= TimeSpan.Zero, "duration must be greater than or equal to zero.", nameof(duration));

            this.innerAction = new SequenceAction(GetInnerActions(delayService, speechService, duration, promptSpeechText));
        }
Пример #13
0
        public static Parser<SayAction> GetParser(ISpeechService speechService)
        {
            Ensure.ArgumentNotNull(speechService, nameof(speechService));

            return
                from _ in Parse.IgnoreCase("say")
                from __ in HorizontalWhitespaceParser.Parser.AtLeastOnce()
                from speechText in StringLiteralParser.Parser
                select new SayAction(speechService, speechText);
        }
Пример #14
0
 public void AddSpeechClient(String uri)
 {
    if (_speech == null)
    {
       _speech = new ChannelFactory<ISpeechService>(
       _binding,
       new EndpointAddress(_baseUri.ToString() + uri)
       ).CreateChannel();
    }
 }
Пример #15
0
 public RecipeDetailViewModel(ILiveTileServiceWP8 tileService, IDialogService dialogService,
     INavigationService navigationService,
     IReminderService reminderService, IShareService shareService, ISpeechService speechService)
 {
     _liveTileService = tileService;
     _dialogService = dialogService;
     _navigationService = navigationService;
     _reminderService = reminderService;
     _shareService = shareService;
     _speechService = speechService;
 }
        public WaitWithPromptAction(IDelayService delayService, ISpeechService speechService, TimeSpan duration, string promptSpeechText)
        {
            delayService.AssertNotNull(nameof(delayService));
            speechService.AssertNotNull(nameof(speechService));
            promptSpeechText.AssertNotNull(nameof(promptSpeechText));

            if (duration < TimeSpan.Zero)
            {
                throw new ArgumentException("duration must be greater than or equal to zero.", "duration");
            }

            this.innerAction = new SequenceAction(GetInnerActions(delayService, speechService, duration, promptSpeechText));
        }
        public static IResult<ExercisePrograms> TryParse(
            string input,
            IAudioService audioService,
            IDelayService delayService,
            ILoggerService loggerService,
            ISpeechService speechService)
        {
            input.AssertNotNull(nameof(input));
            audioService.AssertNotNull(nameof(audioService));
            delayService.AssertNotNull(nameof(delayService));
            loggerService.AssertNotNull(nameof(loggerService));
            speechService.AssertNotNull(nameof(speechService));

            return ExerciseProgramsParser.GetParser(audioService, delayService, loggerService, speechService).TryParse(input);
        }
Пример #18
0
        public static IResult<ExercisePrograms> TryParse(
            string input,
            IAudioService audioService,
            IDelayService delayService,
            ILoggerService loggerService,
            ISpeechService speechService)
        {
            Ensure.ArgumentNotNull(input, nameof(input));
            Ensure.ArgumentNotNull(audioService, nameof(audioService));
            Ensure.ArgumentNotNull(delayService, nameof(delayService));
            Ensure.ArgumentNotNull(loggerService, nameof(loggerService));
            Ensure.ArgumentNotNull(speechService, nameof(speechService));

            return ExerciseProgramsParser.GetParser(audioService, delayService, loggerService, speechService).TryParse(input);
        }
        private static IEnumerable<IAction> GetInnerActions(IDelayService delayService, ISpeechService speechService, TimeSpan duration, string promptSpeechText)
        {
            yield return new SayAction(speechService, promptSpeechText);

            if (duration < minimumBreakToIncludeReady)
            {
                yield return new WaitAction(delayService, duration);
            }
            else
            {
                yield return new WaitAction(delayService, duration - minimumBreakToIncludeReady);
                yield return new SayAction(speechService, "ready?");
                yield return new WaitAction(delayService, minimumBreakToIncludeReady);
            }
        }
        public static Parser<ExerciseProgram> GetParser(
                IAudioService audioService,
                IDelayService delayService,
                ILoggerService loggerService,
                ISpeechService speechService)
        {
            audioService.AssertNotNull(nameof(audioService));
            delayService.AssertNotNull(nameof(delayService));
            loggerService.AssertNotNull(nameof(loggerService));
            speechService.AssertNotNull(nameof(speechService));

            return
                from name in HeadingParser.GetParser(1)
                from _ in Parse.WhiteSpace.Many()
                from exercises in ExerciseParser.GetParser(audioService, delayService, loggerService, speechService).DelimitedBy(Parse.WhiteSpace.Many()).Optional()
                select new ExerciseProgram(loggerService, name, exercises.GetOrElse(Enumerable.Empty<Exercise>()));
        }
        public static Parser<ExercisePrograms> GetParser(
            IAudioService audioService,
            IDelayService delayService,
            ILoggerService loggerService,
            ISpeechService speechService)
        {
            Ensure.ArgumentNotNull(audioService, nameof(audioService));
            Ensure.ArgumentNotNull(delayService, nameof(delayService));
            Ensure.ArgumentNotNull(loggerService, nameof(loggerService));
            Ensure.ArgumentNotNull(speechService, nameof(speechService));

            return
                from _ in VerticalSeparationParser.Parser
                from exercisePrograms in ExerciseProgramParser.GetParser(audioService, delayService, loggerService, speechService).DelimitedBy(Parse.WhiteSpace.Many()).Optional()
                from __ in Parse.WhiteSpace.Many().End()
                select new ExercisePrograms(exercisePrograms.GetOrElse(Enumerable.Empty<ExerciseProgram>()));
        }
Пример #22
0
        /// <summary>
        /// Initializes a new instance of the MainViewModel class.
        /// </summary>
        public MainViewModel(IKioskInteractionService interactionService,
                             ISpeechService speechService,
                             IItemInteractionService manipulationService,
                             IConfigurationProvider configurationProvider)
        {
            this.RowWidth = DEPTH_WIDTH;

            _kioskInteractionService = interactionService;
            _kioskInteractionService.KioskStateChanged += _kioskInteractionService_KioskStateChanged;
            _kioskInteractionService.BodyTrackUpdate += _kioskInteractionService_BodyTrackUpdate;

            BodyTrack = new ObservableCollection<double>() { -75, -75, -75, -75, -75, -75 };

            _itemInteractionService = manipulationService;
            _itemInteractionService.ServiceStateChanged += _itemInteractionService_ServiceStateChanged;
            _itemInteractionService.ItemInteraction += _itemInteractionService_ItemInteraction;
            _itemInteractionService.PropertyChanged += _itemInteractionService_PropertyChanged;

            _speechService = speechService;
            _speechService.SpeechRecognized += _speechService_SpeechRecognized;
            _speechService.SpeechRejected += _speechService_SpeechRejected;
            _speechService.StartListening();
            _speechService.Speak("Kiosk Ready");

            Messenger.Default.Register<string>(this, (msg) => {

                if (msg == "SPECIALSTOP")
                {
                    Debug.WriteLine("MVM SPECIALSTOP " + _lastKioskState);
                    this.KioskState = "CloseSpecial";
                }
            });

            this.OpenObjectDetection = new RelayCommand(() =>
            {
                ShowObjectDetectionWindow(true);
            });

            _configurationProvider = configurationProvider;
            _configurationProvider.ConfigurationSettingsChanged += _configurationProvider_ConfigurationSettingsChanged;
            GetConfig();

            // Show Object Detection Window on start up
            ShowObjectDetectionWindow();
        }
        public ExerciseProgramsViewModelBuilder()
        {
            this.audioService = new AudioServiceMock(MockBehavior.Loose);
            this.delayService = new DelayServiceMock(MockBehavior.Loose);
            this.exerciseDocumentService = new ExerciseDocumentServiceMock(MockBehavior.Loose);
            this.loggerService = new LoggerServiceMock(MockBehavior.Loose);
            this.schedulerService = new SchedulerServiceMock(MockBehavior.Loose);
            this.speechService = new SpeechServiceMock(MockBehavior.Loose);
            this.stateService = new StateServiceMock(MockBehavior.Loose);
            this.hostScreen = new ScreenMock(MockBehavior.Loose);
            this.exerciseProgramViewModelFactory =
                model =>
                    new ExerciseProgramViewModelBuilder()
                        .WithModel(model)
                        .Build();

            this.WithCachedDocument(null);
        }
Пример #24
0
        public static Parser<BreakAction> GetParser(
            IDelayService delayService,
            ISpeechService speechService)
        {
            Ensure.ArgumentNotNull(delayService, nameof(delayService));
            Ensure.ArgumentNotNull(speechService, nameof(speechService));

            return
                from _ in Parse.IgnoreCase("break")
                from __ in HorizontalWhitespaceParser.Parser.AtLeastOnce()
                from ___ in Parse.IgnoreCase("for")
                from ____ in HorizontalWhitespaceParser.Parser.AtLeastOnce()
                from duration in TimeSpanParser.Parser
                select new BreakAction(
                    delayService,
                    speechService,
                    duration);
        }
        public static Parser<PrepareAction> GetParser(
            IDelayService delayService,
            ISpeechService speechService)
        {
            delayService.AssertNotNull(nameof(delayService));
            speechService.AssertNotNull(nameof(speechService));

            return
                from _ in Parse.IgnoreCase("prepare")
                from __ in HorizontalWhitespaceParser.Parser.AtLeastOnce()
                from ___ in Parse.IgnoreCase("for")
                from ____ in HorizontalWhitespaceParser.Parser.AtLeastOnce()
                from duration in TimeSpanParser.Parser
                select new PrepareAction(
                    delayService,
                    speechService,
                    duration);
        }
Пример #26
0
        public static Parser<IEnumerable<IAction>> GetParser(
            int indentLevel,
            IAudioService audioService,
            IDelayService delayService,
            ILoggerService loggerService,
            ISpeechService speechService)
        {
            Ensure.ArgumentCondition(indentLevel >= 0, "indentLevel must be greater than or equal to 0.", "indentLevel");
            Ensure.ArgumentNotNull(audioService, nameof(audioService));
            Ensure.ArgumentNotNull(delayService, nameof(delayService));
            Ensure.ArgumentNotNull(loggerService, nameof(loggerService));
            Ensure.ArgumentNotNull(speechService, nameof(speechService));

            return
                (from _ in Parse.String("  ").Or(Parse.String("\t")).Repeat(indentLevel)
                 from __ in Parse.String("* ")
                 from action in ActionParser.GetParser(indentLevel, audioService, delayService, loggerService, speechService).Token(HorizontalWhitespaceParser.Parser)
                 select action).DelimitedBy(NewLineParser.Parser);
        }
        public static Parser<SequenceAction> GetParser(
            int indentLevel,
            IAudioService audioService,
            IDelayService delayService,
            ILoggerService loggerService,
            ISpeechService speechService)
        {
            Ensure.ArgumentCondition(indentLevel >= 0, "indentLevel must be greater than or equal to 0.", "indentLevel");
            Ensure.ArgumentNotNull(audioService, nameof(audioService));
            Ensure.ArgumentNotNull(delayService, nameof(delayService));
            Ensure.ArgumentNotNull(loggerService, nameof(loggerService));
            Ensure.ArgumentNotNull(speechService, nameof(speechService));

            return
                from _ in Parse.IgnoreCase("sequence:")
                from __ in VerticalSeparationParser.Parser.AtLeastOnce()
                from actions in ActionListParser.GetParser(indentLevel + 1, audioService, delayService, loggerService, speechService)
                select new SequenceAction(actions);
        }
Пример #28
0
        public static Parser<IAction> GetParser(
            int indentLevel,
            IAudioService audioService,
            IDelayService delayService,
            ILoggerService loggerService,
            ISpeechService speechService)
        {
            Ensure.ArgumentCondition(indentLevel >= 0, "indentLevel must be greater than or equal to 0.", "indentLevel");
            Ensure.ArgumentNotNull(audioService, nameof(audioService));
            Ensure.ArgumentNotNull(delayService, nameof(delayService));
            Ensure.ArgumentNotNull(loggerService, nameof(loggerService));
            Ensure.ArgumentNotNull(speechService, nameof(speechService));

            return BreakActionParser.GetParser(delayService, speechService)
                .Or<IAction>(MetronomeActionParser.GetParser(audioService, delayService, loggerService))
                .Or<IAction>(PrepareActionParser.GetParser(delayService, speechService))
                .Or<IAction>(SayActionParser.GetParser(speechService))
                .Or<IAction>(WaitActionParser.GetParser(delayService))
                .Or<IAction>(DoNotAwaitActionParser.GetParser(indentLevel, audioService, delayService, loggerService, speechService))
                .Or<IAction>(ParallelActionParser.GetParser(indentLevel, audioService, delayService, loggerService, speechService))
                .Or<IAction>(SequenceActionParser.GetParser(indentLevel, audioService, delayService, loggerService, speechService));
        }
        public static Parser<ParallelAction> GetParser(
            int indentLevel,
            IAudioService audioService,
            IDelayService delayService,
            ILoggerService loggerService,
            ISpeechService speechService)
        {
            if (indentLevel < 0)
            {
                throw new ArgumentException("indentLevel must be greater than or equal to 0.", "indentLevel");
            }

            audioService.AssertNotNull(nameof(audioService));
            delayService.AssertNotNull(nameof(delayService));
            loggerService.AssertNotNull(nameof(loggerService));
            speechService.AssertNotNull(nameof(speechService));

            return
                from _ in Parse.IgnoreCase("parallel:")
                from __ in VerticalSeparationParser.Parser.AtLeastOnce()
                from actions in ActionListParser.GetParser(indentLevel + 1, audioService, delayService, loggerService, speechService)
                select new ParallelAction(actions);
        }
Пример #30
0
 public BreakAction(IDelayService delayService, ISpeechService speechService, TimeSpan duration)
 {
     this.innerAction = new WaitWithPromptAction(delayService, speechService, duration, "break");
 }