コード例 #1
0
        public void StartDownload()
        {
            Status.Content = $"{DownloadingUpdate}...";
            if (string.IsNullOrEmpty(MyStatic.DownloadURL))
            {
                MyStatic.GetSomeData();
            }
            WebClient web = new WebClient();

            web.DownloadDataAsync(new Uri(MyStatic.DownloadURL));
            web.DownloadProgressChanged += new DownloadProgressChangedEventHandler(DownloadProgressChanged);
            web.DownloadDataCompleted   += new DownloadDataCompletedEventHandler(DownloadDataCompleted);
            Process proc = new Process();

            proc.StartInfo.FileName    = "CMD.exe";
            proc.StartInfo.Arguments   = "/c taskkill /f /im " + MyStatic.RunAfterUpdate;
            proc.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
            proc.Start();
            proc.WaitForExit();
        }