示例#1
0
        public void TestGetFunctionFromCommandStringReturnsNullIfNoDesiredActionCanBeDetermined()
        {
            ActionRouter.SetUp();
            const string commandString = "Made you look!";

            Assert.IsNull(ActionRouter.GetFunctionFromCommandString(commandString));
        }
示例#2
0
 public MainPage()
 {
     this.InitializeComponent();
     // hide the main menu
     this.MenuColumn.Width = new GridLength(0);
     ActionRouter.SetUp();
     // prevent the application from closing when the user hits the x button. This will alarms and notifications to still trigger FIXME we will have to figure something out since apps can't be published to the store with a restricted capability
     //SystemNavigationManagerPreview.GetForCurrentView().CloseRequested += CloseHandle;
     Window.Current.SizeChanged += SizeChangedHandler;
 }
示例#3
0
 public MainPage()
 {
     this.InitializeComponent();
     // hide the main menu
     this.MenuColumn.Width = new GridLength(0);
     ActionRouter.SetUp();
     // prevent the application from closing when the user hits the x button. This will alarms and notifications to still trigger
     SystemNavigationManagerPreview.GetForCurrentView().CloseRequested += CloseHandle;
     Window.Current.SizeChanged += SizeChangedHandler;
 }
示例#4
0
        public void TestGetFunctionFromCommandStringReturnsExpectedFunctionWhenShallowFunction()
        {
            // tests that the GetFunctionFromCommandString function still works even if it's not working on a nested Dictionary
            ActionRouter.SetUp();
            const string commandString = "Get the weather for tomorrow";
            Func <string, BobTheDigitalAssistant.Actions.Action> returnedFunction = ActionRouter.GetFunctionFromCommandString(commandString);

            Assert.IsNotNull(returnedFunction);
            WeatherAction returnedAction = (WeatherAction)returnedFunction(commandString);

            Assert.IsNotNull(returnedAction);
        }
示例#5
0
        public void TestGetFunctionFromCommandStringReturnsExpectedFunction()
        {
            // setup the action router
            ActionRouter.SetUp();
            // the command string
            const string commandString = "Set an alarm for 5:30 A.M.";
            Func <string, BobTheDigitalAssistant.Actions.Action> returnedFunction = ActionRouter.GetFunctionFromCommandString(commandString);

            Assert.IsNotNull(returnedFunction);
            AlarmAction returnedAction = (AlarmAction)returnedFunction(commandString);

            // check the alarm action's values
            Assert.AreEqual(AlarmAction.AlarmActionTypes.CREATE, returnedAction.ActionType);
        }
示例#6
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);
            if (!ActionRouter.IsSetup)
            {
                ActionRouter.SetUp();
            }
            // if bob has not been introduced, then introduce him now
            var hasIntroducedBob = StoredProcedures.QuerySettingByName("_ToldUserHowToUseBob");

            if (hasIntroducedBob.GetSelectedOption() != null && hasIntroducedBob.GetSelectedOption().DisplayName == "false")
            {
                this.IntroduceBob();
                hasIntroducedBob.SelectOption("true");
                StoredProcedures.SelectOption(hasIntroducedBob.SettingID, hasIntroducedBob.GetSelectedOption().OptionID);
            }
            AudioPlayer.Start();
            // if the user has elected to have speech recognition turned on, then request for microphone permissions
            this.RequestMicrophoneAcessIfUserWantsVoiceDetection();
        }