コード例 #1
0
        /// <summary>
        /// Runs the AutoUpdater application 
        /// </summary>
        public void runNewUpdater()
        {
            UpdateRoutine fileFetcher = new UpdateRoutine();
            CancellationTokenSource fileFetcher_cancelationToken = new CancellationTokenSource();
            Task fileFetcherTask = Task.Factory.StartNew(() => fileFetcher.fetchFile(fileFetcher_cancelationToken));

            // Check if the user wants to cancle
            while (!cancleFileFetcher(fileFetcher));

            // Stop the file fetcher
            fileFetcher_cancelationToken.Cancel();
            UserInterface.WriteToConsole("Canceling current process, please wait...");
            while (!fileFetcher.download_finished) { }// Wait for the file fetcher to finish
            UserInterface.WriteToConsole("Process terminated.");
            restart();
        }