コード例 #1
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            COPYING.Visibility             = Visibility.Hidden;
            DownloadGrid.Visibility        = Visibility.Hidden;
            InstallSettingsGrid.Visibility = Visibility.Hidden;
            FinishedGrid.Visibility        = Visibility.Hidden;

            gridShowOrder.Add(GridPanel.Main, MainGrid);
            gridShowOrder.Add(GridPanel.copying, COPYING);
            gridShowOrder.Add(GridPanel.InstallConf, InstallSettingsGrid);
            gridShowOrder.Add(GridPanel.Download, DownloadGrid);
            gridShowOrder.Add(GridPanel.Finished, FinishedGrid);

            if (System.IO.Path.GetDirectoryName(Process.GetCurrentProcess().MainModule.FileName) != INSTALL_PATH)
            {
                UninstallButton.IsEnabled = false;
            }

            if (GitHubReleaseFetcher.CreateGitHubClient() == null)
            {
                MessageBox.Show("Impossible de se connecter à GitHub" + Environment.NewLine + "Verifier que votre PC est connecté à Internet", "Connecting to GitHub", MessageBoxButton.OK, MessageBoxImage.Error); ShowMain();
            }
            else
            {
                GitHubReleaseFetcher.FindLatestRelease(() => { button.IsEnabled = true; });
            }
        }
コード例 #2
0
        private async void StartInstall(GitHubReleaseFetcher.DownloadableFiles[] downloadableFiles)
        {
            Install install = new Install(PROGRAMS_PATH, INSTALL_PATH, TEMP_PATH, DL_FILE_NAME, UNINSTALLBAT_PATH);

            install.PreInstall();


            foreach (GitHubReleaseFetcher.DownloadableFiles downloadable in downloadableFiles)
            {
                dlLbl.Content = "Téléchargement de " + downloadable;
                string       url    = GitHubReleaseFetcher.GetReleaseAssetUrl(downloadable);
                DownloadFile dlFile = new DownloadFile();
                dlFile.onProgressChanged += (object sender, DownloadProgressChangedEventArgs e) => { DownLoadProgress.Value = e.ProgressPercentage; };
                // need to change the DL_FILE_NAME
                Task  t = dlFile.DownloadFromUrl(new Uri(url), System.IO.Path.Combine(TEMP_PATH, downloadable.ToString()), null);
                await t;
            }
            install.InstallApp(downloadableFiles, () => { ShowNextGrid(); });
        }