コード例 #1
0
 private void RunUpdateProcess()
 {
     LoggingService.LogInfo("Product update application initialized and ready to run");
     InstallApp.Reveal();
     InstallApp.Run();
     LoggingService.LogInfo("Product update application process completed");
 }
コード例 #2
0
        private async Task <DialogTurnResult> multipleAppsStepAsync(WaterfallStepContext stepContext, CancellationToken cancellationToken)
        {
            // Check to see if user selected app when there are multiple applications to pick from
            if (stepContext.Values.ContainsKey("AppSelected"))
            {
                names.Clear();
            }
            else
            {
                names = await this.getAppsAsync(stepContext.Values["AppName"].ToString());
            }

            // If multiple apps returned then need to prompt user for which one to select
            if (names.Count > 1)
            {
                int choice = (int)stepContext.Result;

                if (choice <= names.Count && choice > 0)
                {
                    //minus because index zero base
                    stepContext.Values["AppName"]     = names[choice - 1];
                    stepContext.Values["AppSelected"] = true;
                    return(await stepContext.PromptAsync("promptText", new PromptOptions { Prompt = MessageFactory.Text($"What is the name of the machine to install?") }, cancellationToken));
                }
                else
                {
                    return(await stepContext.PromptAsync("promptNumber", new PromptOptions { Prompt = MessageFactory.Text($"Invalid response. Please reply 1 - {names.Count()} to indicate your choice.") }, cancellationToken));
                }
            }
            else
            {
                // Proceed with saving entry into database
                var machineName = (string)stepContext.Result;

                Models.InstallApp install = new InstallApp();
                install.AppName     = (string)stepContext.Values["AppName"];
                install.MachineName = machineName;
                stepContext.Values["MachineName"] = machineName;

                //TODO: Save to database
                using (var db = new ContosoHelpdeskContext())
                {
                    db.InstallApps.Add(install);
                    db.SaveChanges();
                }

                logger.Info("InstallAppDialog: AppName = " + install.AppName + "; MachineName = " + install.MachineName);

                await stepContext.Context.SendActivityAsync($"Great, your request to install {install.AppName} on {install.MachineName} has been scheduled.");

                return(await stepContext.EndDialogAsync());
            }
        }
コード例 #3
0
ファイル: Manage.cs プロジェクト: warrior888/toci_teachers
 public bool AppInstall(AppToInstall app)
 {
     try
     {
         return(InstallApp.Install(App[app]));
     }
     catch (FileNotFoundException e)
     {
         Console.WriteLine(e);
         throw new FileNotFoundException();
     }
 }
コード例 #4
0
        private async Task machineNameAsync(DialogContext context)
        {
            //finally we should have the machine name on which to install the app
            var message     = context.Context.Activity;
            var machinename = message.Text;

            var install = new InstallApp()
            {
                AppName     = context.ActiveDialog.State["AppName"] as string,
                MachineName = message.Text
            };

            //TODO: Save to database
            using (var db = new ContosoHelpdeskContext())
            {
                db.InstallApps.Add(install);
                db.SaveChanges();
            }

            await context.PostAsync($"Great, your request to install {install.AppName} on {install.MachineName} has been scheduled.");
        }
コード例 #5
0
        private async Task <DialogTurnResult> SubmitRequestAsync(
            WaterfallStepContext stepContext,
            CancellationToken cancellationToken = default(CancellationToken))
        {
            InstallApp install = default(InstallApp);

            if (stepContext.Reason != DialogReason.CancelCalled)
            {
                // Get the tracking info and add the machine name.
                install             = stepContext.Values[InstallInfo] as InstallApp;
                install.MachineName = stepContext.Context.Activity.Text;

                //TODO: Save to this information to the database.
            }

            await stepContext.Context.SendActivityAsync(
                $"Great, your request to install {install.AppName} on {install.MachineName} has been scheduled.",
                cancellationToken : cancellationToken);

            return(await stepContext.EndDialogAsync(null, cancellationToken));
        }
コード例 #6
0
ファイル: Manage.cs プロジェクト: warrior888/toci_teachers
 public void RunApplication(AppToInstall app)
 {
     InstallApp.RunApp(App[app]);
 }
コード例 #7
0
ファイル: Manage.cs プロジェクト: warrior888/toci_teachers
 /// <summary>
 /// Check that the application is installed on the host.
 /// </summary>
 /// <param name="app">Enumeration type <see cref="TociApp.Managed.AppToInstall"/> representing applications.</param>
 /// <returns>Return true if application is installed, otherwise false.</returns>
 public bool AppIsIntaled(AppToInstall app)
 {
     return(InstallApp.IsAppInstalled(App[app]));
 }