Exemple #1
0
 public bool AppInstall(AppToInstall app)
 {
     try
     {
         return(InstallApp.Install(App[app]));
     }
     catch (FileNotFoundException e)
     {
         Console.WriteLine(e);
         throw new FileNotFoundException();
     }
 }
Exemple #2
0
        /// <summary>
        /// Gets the file and assign methods to events.
        /// </summary>
        /// <param name="path">Specifies the absolute path where the file will be saved</param>
        /// <param name="app">Enumeration type <see cref="TociApp.Managed.AppToInstall"/> representing applications</param>
        /// <param name="completedDownload">Represents the method that will handle the MethodName<see langword="Completed" /> event of an asynchronous operation.</param>
        /// <param name="progress">Represents the method that will handle the <see cref="E:System.Net.WebClient.DownloadProgressChanged" /> event of a <see cref="T:System.Net.WebClient" /></param>
        /// <exception cref="System.IO.DirectoryNotFoundException">The specified path was not found.</exception>
        public void DownloadFile(string path, AppToInstall app,
                                 AsyncCompletedEventHandler completedDownload = null, DownloadProgressChangedEventHandler progress = null)
        {
            if (String.IsNullOrEmpty(path) && !Directory.Exists(path))
            {
                throw new DirectoryNotFoundException("Directory not found or not exist");
            }
            DownloadFile downloadFile = new DownloadFile();

            App[app].DownloadDirectory = path;

            downloadFile.Progress += progress;
            downloadFile.Complate += completedDownload;
            downloadFile.DwnloadFile(path, App[app]);
        }
Exemple #3
0
        private void DownloadFile(AppToInstall app,
                                  System.ComponentModel.AsyncCompletedEventHandler completedDownload, DownloadProgressChangedEventHandler progress, ProgressBar progressBar)
        {
            using (FolderBrowserDialog folderBrowserDialog = new FolderBrowserDialog()
            {
                SelectedPath = RootPath, ShowNewFolderButton = true
            })
            {
                DialogResult result = folderBrowserDialog.ShowDialog();
                if (result != System.Windows.Forms.DialogResult.OK)
                {
                    return;
                }

                progressBar.Visibility = Visibility.Visible;

                string path = folderBrowserDialog.SelectedPath;

                _manage.DownloadFile(path, app, completedDownload, progress);
            }
        }
Exemple #4
0
 private void InstallApp(AppToInstall app)
 {
     try
     {
         if (!_manage.AppInstall(app))
         {
             return;
         }
         if (app is AppToInstall.JoinMe)
         {
             RunJoinMeApp.IsEnabled = true;
         }
         else if (app is AppToInstall.Mumble)
         {
             RunMumbleApp.IsEnabled = true;
         }
     }
     catch (FileNotFoundException exception)
     {
         Console.WriteLine(exception);
         MessageBox.Show(exception.Message);
     }
 }
Exemple #5
0
 public void RunApplication(AppToInstall app)
 {
     InstallApp.RunApp(App[app]);
 }
Exemple #6
0
 /// <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]));
 }