Exemple #1
0
 public async Task GenericAPICallIntent(IDialogContext context, LuisResult result)
 {
     try
     {
         if (LoginViewModel.CheckIfLoggedIn(context.Activity.Conversation.Id) == true)
         {
             ApplicationUser user = new ApplicationUser();
             user = LoginViewModel.LoggedInAsUser(context.Activity.Conversation.Id);
             if (RegisterTriggerCMDModel.CheckIfTriggerCMDIsRegistered(user) == true)
             {
                 if (!string.IsNullOrEmpty(result.Entities[0].Entity))
                 {
                     var program = new System.Globalization.CultureInfo("en-US", false).TextInfo.ToTitleCase(result.Entities[0].Entity.ToLower());
                     MakeAPICall(user.UserComputerName, user.UserTriggerCMDToken, program, context);
                 }
                 else
                 {
                     await context.PostAsync("This program can't be opened, try another program, or check your spelling");
                 }
             }
             else
             {
                 await context.PostAsync("Please register the TriggerCMD details");
             }
         }
     }
     catch (Exception ex)
     {
         await context.PostAsync($"{ex}");
     }
     context.Wait(this.MessageReceived);
 }
Exemple #2
0
        private async Task ContinueAntiVirus(IDialogContext context, IAwaitable <bool> result)
        {
            bool             isSure          = await result;
            string           response        = isSure ? "We could check for virusses" : "We could restart your computer";
            IMessageActivity messageActivity = context.MakeMessage();

            if (isSure == false)
            {
                if (LoginViewModel.CheckIfLoggedIn(context.Activity.Conversation.Id) == true)
                {
                    ApplicationUser user = new ApplicationUser();
                    user = LoginViewModel.LoggedInAsUser(context.Activity.Conversation.Id);
                    var program = "Antivirus";
                    if (RegisterTriggerCMDModel.CheckIfTriggerCMDIsRegistered(user) == true)
                    {
                        MakeAPICall(user.UserComputerName, user.UserTriggerCMDToken, program, context);
                    }
                    else
                    {
                        await context.PostAsync("You did not sign up with TriggerCMD");
                    }
                }
                else
                {
                    await context.PostAsync("You are not logged in");
                }
            }
            else
            {
                await context.PostAsync("I am sorry there is nothing we can do for you");
            }
        }
Exemple #3
0
 public async Task TurnOnPCIntent(IDialogContext context, LuisResult result)
 {
     try
     {
         if (LoginViewModel.CheckIfLoggedIn(context.Activity.Conversation.Id) == true)
         {
             ApplicationUser user = new ApplicationUser();
             user = LoginViewModel.LoggedInAsUser(context.Activity.Conversation.Id);
             if (RegisterTriggerCMDModel.CheckIfTriggerCMDIsRegistered(user) == true)
             {
                 MakeAPICall("odroid", user.UserTriggerCMDToken, "Wakeup", context);
             }
             else
             {
                 await context.PostAsync("Please register the TriggerCMD details");
             }
         }
     }
     catch (Exception ex)
     {
         await context.PostAsync($"{ex}");
     }
     context.Wait(this.MessageReceived);
 }