• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# ComponentModel.AsyncCompletedEventArgs类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中System.ComponentModel.AsyncCompletedEventArgs的典型用法代码示例。如果您正苦于以下问题:C# AsyncCompletedEventArgs类的具体用法?C# AsyncCompletedEventArgs怎么用?C# AsyncCompletedEventArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



AsyncCompletedEventArgs类属于System.ComponentModel命名空间,在下文中一共展示了AsyncCompletedEventArgs类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: OnLoadCompleted

 protected virtual void OnLoadCompleted(AsyncCompletedEventArgs e)
 {
     if (LoadCompleted != null)
     {
         LoadCompleted(this, e);
     }
 }
开发者ID:qucc,项目名称:ImageDownloader,代码行数:7,代码来源:FileDownloader.cs


示例2: Build

 public DecisionArgs Build(AsyncCompletedEventArgs eventArgs)
 {
     return new DecisionArgs
     {
         EventArgsOfWebClient = eventArgs
     };
 }
开发者ID:oxscar93,项目名称:Projects-C-,代码行数:7,代码来源:DecisionsArgsBuilder.cs


示例3: _webClient_DownloadFileCompleted

 void _webClient_DownloadFileCompleted(object sender, AsyncCompletedEventArgs e)
 {
     Audio audio = e.UserState as Audio;
     string filePath = String.Format("{0}.mp3", audio.ToString());
     TagLib.File tagFile = TagLib.File.Create(filePath);
     string artistName = tagFile.Tag.FirstAlbumArtist == null ? "Unknown artist" : tagFile.Tag.FirstAlbumArtist;
     string albumName = tagFile.Tag.Album == null ? "Unknown album" : tagFile.Tag.Album;
     string title = tagFile.Tag.Title == null ? "Unknown title" : tagFile.Tag.Title;
     var artist = _artists.FirstOrDefault(g => g.Name.ToLower() == artistName.ToLower());
     if (artist == null)
     {
         artist = new Artist(artistName);
         _artists.Add(artist);
     }
     var album = artist.Albums.FirstOrDefault(g => g.Name.ToLower() == albumName.ToLower());
     if (album == null)
     {
         album = new Album(albumName);
         artist.Albums.Add(album);
     }
     var song = album.Songs.FirstOrDefault(g => g.Name.ToLower() == title.ToLower());
     if (song == null)
     {
         song = new Song(title, filePath);
         album.Songs.Add(song);
     }
 }
开发者ID:bebecap,项目名称:VkDownloader,代码行数:27,代码来源:AudioWindow.cs


示例4: ClientDownloadFileCompleted

 private void ClientDownloadFileCompleted(object sender, AsyncCompletedEventArgs e)
 {
     m_downloaded = true;
     if (e.Cancelled)
         m_error = true;
     Program.Frm.SetProgress(100);
 }
开发者ID:Buttys,项目名称:YgoUpdater,代码行数:7,代码来源:Updater.cs


示例5: HasError

 protected bool HasError(AsyncCompletedEventArgs args)
 {
     var hasError = args.Error != null;
     if (hasError)
         OnNewSystemMessage(args.Error.Message);
     return hasError;
 }
开发者ID:usemam,项目名称:SilverlightChat,代码行数:7,代码来源:ChatModelBase.cs


示例6: HandleCompletion

 /// MONO completely lacks SmtpClient.SendAsync, so this is a copy -----------------------------------------------------------------------------
 /// <summary>
 /// 
 /// </summary>
 /// <param name="tcs"></param>
 /// <param name="e"></param>
 /// <param name="handler"></param>
 /// <param name="client"></param>
 static void HandleCompletion(TaskCompletionSource<object> tcs, AsyncCompletedEventArgs e, SendCompletedEventHandler handler, SmtpClient client)
 {
     if (e.UserState == tcs)
     {
         try
         {
             client.SendCompleted -= handler;
         }
         finally
         {
             if (e.Error != null)
             {
                 tcs.TrySetException(e.Error);
             }
             else if (!e.Cancelled)
             {
                 tcs.TrySetResult(null);
             }
             else
             {
                 tcs.TrySetCanceled();
             }
         }
     }
 }
开发者ID:sfinder,项目名称:metaexchange,代码行数:33,代码来源:Email.cs


示例7: client_DownloadFileCompleted

 private void client_DownloadFileCompleted(object sender, AsyncCompletedEventArgs e)
 {
     lbl_status.Text = "Status: Completed";
     Thread.Sleep(500);
     Process.Start("R2_Compiler_conf_gui.exe");
     Application.Exit();
 }
开发者ID:whit33r,项目名称:Compile_Configuration_GUI,代码行数:7,代码来源:Update.cs


示例8: client_DownloadFileCompleted

        private void client_DownloadFileCompleted(object sender, AsyncCompletedEventArgs e)
        {
            string rootDir = Path.GetDirectoryName(this.FilePath);
            string unzipFolder = Path.Combine(rootDir, this.NewVersion);
            if (Directory.Exists(unzipFolder))
            {
                Directory.Delete(unzipFolder, true);
            }
            Directory.CreateDirectory(unzipFolder);
            ZipHelp.UnZip(this.FilePath, unzipFolder);

            string sourceFolder = "";
            var files = Directory.EnumerateFiles(unzipFolder, Config.MainExe, SearchOption.AllDirectories);
            if (files != null && files.Count() == 1)
            {
                var targetFileName = files.FirstOrDefault();
                sourceFolder = Path.GetDirectoryName(targetFileName);
            }

            string targetDir = Environment.CurrentDirectory;
            foreach (var process in Process.GetProcessesByName("CKGen"))
            {
                process.Kill();
            }

            RenameAllFile(targetDir);
            //copy 
            ProcessXcopy(sourceFolder, targetDir);

            Process.Start(Path.Combine(Environment.CurrentDirectory, Config.MainExe));

            this.Close();
        }
开发者ID:zhh007,项目名称:CKGen,代码行数:33,代码来源:Form1.cs


示例9: BeginDownload

		public void BeginDownload(RemoteFileInfo fileInfo, string destPath)
		{
			try
			{
				var localFileInfo = new FileInfo(destPath);
				if (localFileInfo.Exists)
				{
					if (Sha1VerifyFile(destPath, fileInfo.Sha1Hash))
					{
						var newEvt = new AsyncCompletedEventArgs(null, false, null);
						DownloadFileCompleted(this, newEvt);
						return; //already have the file with correct contents on disk
					}
				}
			}
			catch (Exception ex)
			{
				var newEvt = new AsyncCompletedEventArgs(ex, false, null);
				DownloadFileCompleted(this, newEvt);
				return; //something failed when trying to hash file
			}

			if (_wc != null)
			{
				_wc.CancelAsync();
				_wc.Dispose();
				_wc = null;
			}

			_wc = new CustomWebClient(Timeout);
			_wc.DownloadProgressChanged += (sender, evt) => { DownloadProgressChanged(sender, evt); };
			_wc.DownloadFileCompleted += (sender, evt) =>
			{
				using (var wc = (WebClient) sender)
				{
					if (evt.Cancelled || evt.Error != null)
					{
						DownloadFileCompleted(sender, evt);
						return;
					}

					try
					{
						if (!Sha1VerifyFile(destPath, fileInfo.Sha1Hash))
							throw new Exception("Hash mismatch after download");
					}
					catch (Exception ex)
					{
						var newEvt = new AsyncCompletedEventArgs(ex, false, evt.UserState);
						DownloadFileCompleted(sender, newEvt);
						return;
					}

					DownloadFileCompleted(sender, evt);
				}
				_wc = null;
			};

			_wc.DownloadFileAsync(new Uri(fileInfo.Url), destPath);
		}
开发者ID:rajkosto,项目名称:DayZeroLauncher,代码行数:60,代码来源:HashWebClient.cs


示例10: ClientDownloadFileCompleted

        /// <summary>
        /// Callback by the web client class when the download finish (completed or cancelled)
        /// </summary>
        void ClientDownloadFileCompleted(object sender, AsyncCompletedEventArgs e)
        {
            Thread.Sleep(1500);     // A short pause for a better visual flow

            inProgress.Set();
            isCompleted = !e.Cancelled;
        }
开发者ID:splintor,项目名称:GitForce,代码行数:10,代码来源:FormDownload.cs


示例11: wc_DownloadFileCompleted

 void wc_DownloadFileCompleted(object sender, AsyncCompletedEventArgs e)
 {
   if (e.Error != null || e.Cancelled)
   {
     Trace.TraceError("{0} failed {1}", Name, e.Error);
     Finish(false);
   }
   else
   {
     Trace.TraceInformation("{0} Completed - {1}", Name, Utils.PrintByteLength(Length));
     try
     {
       File.Delete(targetFilePath);
     }
     catch {}
     try
     {
       File.Move(tempFilePath, targetFilePath);
     }
     catch
     {
       Trace.TraceError("Error moving file from {0} to {0}", tempFilePath, targetFilePath);
       Finish(false);
       return;
     }
     Finish(true);
   }
 }
开发者ID:GoogleFrog,项目名称:Zero-K-Infrastructure,代码行数:28,代码来源:WebFileDownload.cs


示例12: Completed2

 private void Completed2(object sender, AsyncCompletedEventArgs e)
 {
     File.Copy(savePath + "/cs_bg_champions.png", savePath + "/login.swf", true);
     //MessageBox.Show("Download completed!");
     this.Hide();
     MessageBox.Show("Download completed." + Environment.NewLine + Environment.NewLine + "To enable music, you may need to click on \"Disable Menu Animations\".", "Info", MessageBoxButtons.OK, MessageBoxIcon.Information);
 }
开发者ID:ssimunic,项目名称:loginscreen-changer,代码行数:7,代码来源:Form2.cs


示例13: wc_DownloadFileCompleted

 void wc_DownloadFileCompleted(object sender, AsyncCompletedEventArgs e)
 {
     if (e.Error != null&&!e.Cancelled)
     {
         //下载出错
         label2.Text = e.Error.Message;
         CancleBtn.Text = "关闭";
         //File.Delete(Application.StartupPath + "/" + DownloadInfo.FileDirectory + "/" + DownloadInfo.FileName);
     }
     else
     {
         if (!e.Cancelled)
         {
             label2.Text = "下载完成";
             CancleBtn.Text = "关闭";
             Process proc = new Process();
             proc.StartInfo.FileName = Application.StartupPath + "/" + DownloadInfo.FileDirectory + "/" + DownloadInfo.FileName;
             proc.StartInfo.Arguments = "";
             proc.Start();
             if (CloseCheckBox.Checked)
             {
                 this.Close();
             }
         }
         else
         {
             //用户取消了下载
             File.Delete(Application.StartupPath + "/" + DownloadInfo.FileDirectory + "/" + DownloadInfo.FileName);
             this.Close();
         }
     }
 }
开发者ID:GuardAngelY,项目名称:wowitemmaker,代码行数:32,代码来源:Downloader.cs


示例14: Completed

 private void Completed(object sender, AsyncCompletedEventArgs e)
 {
     progressBar.Visibility = System.Windows.Visibility.Hidden;
     Feedback.Text = "Download completed";
     Feedback.Visibility = System.Windows.Visibility.Visible;
     Process.Start(downloadedFile);
 }
开发者ID:thorthur,项目名称:drugabuse_interface,代码行数:7,代码来源:HomePage.xaml.cs


示例15: DownloadFileAsync_should_be_callable_indirectly

        public void DownloadFileAsync_should_be_callable_indirectly()
        {
            using (new IndirectionsContext())
            {
                // Arrange
                var called = false;
                var notCalled = true;
                var handler = default(AsyncCompletedEventHandler);
                handler = (sender, e) => called = true;
                PULWebClient.AddDownloadFileCompletedAsyncCompletedEventHandler().Body = (@this, value) => handler += value;
                PULWebClient.RemoveDownloadFileCompletedAsyncCompletedEventHandler().Body = (@this, value) => handler -= value;
                PULWebClient.DownloadFileAsyncUri().Body = (@this, address) =>
                {
                    var e = new AsyncCompletedEventArgs(null, false, null);
                    handler(@this, e);
                };

                
                // Act
                var client = new ULWebClient();
                client.DownloadFileAsync(new Uri("http://google.co.jp/"));
                client.DownloadFileCompleted += (sender, e) => notCalled = false;

                
                // Assert
                Assert.IsTrue(called);
                Assert.IsTrue(notCalled);
            }
        }
开发者ID:umaranis,项目名称:Prig,代码行数:29,代码来源:PULWebClientTest.cs


示例16: Completed

 //Call completed to run DLR, completed2 for non-DLR pkgs.
 public static void Completed(object sender, AsyncCompletedEventArgs e)
 {
     MessageBox.Show("Download completed!", "File complete");//Tell user
     progressBar.Value = 0;// set back to zero so we know it finished, some ppl are dumb
     table.dlrfinished = true;//dl complete?
     Process.Start((Form1.FilePath1) + (Form1.FilePath2));
 }
开发者ID:sputterfish,项目名称:karma,代码行数:8,代码来源:funcs.cs


示例17: client_DownloadFileCompleted

        void client_DownloadFileCompleted(object sender, AsyncCompletedEventArgs e)
        {
            // install updates
            this.BeginInvoke((MethodInvoker)delegate {
                // Start installer & wait for exit
                statusLabel.Text = "Installing update...";
                progressBar1.Value = 0;
                progressBar1.Style = ProgressBarStyle.Marquee;
                ProcessStartInfo procStart = new ProcessStartInfo("msiexec.exe");
                procStart.Arguments = "/i \""+ InstallerPath + "\" /qr";
                Process p = Process.Start(procStart);
                p.WaitForExit();

                // run installed application & close updater
                statusLabel.Text = "Installation complete!";
                progressBar1.Style = ProgressBarStyle.Blocks;
                progressBar1.Value = 100;

                RegistryKey key = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Stijn Raeymaekers\\Weather Wallpaper");
                string installedExe = key.GetValue("installDirectory") + "WeatherWallpaper.exe";
                Process.Start(installedExe);

                Thread.Sleep(1500);
                Environment.Exit(0);
            });
        }
开发者ID:RStijn,项目名称:Weather-Wallpaper,代码行数:26,代码来源:UpdateForm.cs


示例18: client_DownloadFileCompleted

        private static void client_DownloadFileCompleted(object sender, AsyncCompletedEventArgs e)
        {
            ZipFile.ExtractToDirectory(Path.Combine(Logic.Logic.InstallDirectory, "temp", "LegendaryClient.zip"),
                Logic.Logic.InstallDirectory);

            Logic.Logic.Installed = true;
            Logic.Logic.SwichPage<Finished>();

            Directory.Delete(Path.Combine(Logic.Logic.InstallDirectory, "temp"), true);

            string x = Path.Combine(Logic.Logic.InstallDirectory, "Client", "LC", "Version.Version");
            string l = Path.Combine(Logic.Logic.InstallDirectory, "Client", "LC");
            if (!Directory.Exists(l))
                Directory.CreateDirectory(l);

            if (File.Exists(x))
                return;

            //Write the version to the file
            FileStream y = File.Create(x);
            y.Close();

            var writer = new StreamWriter(x);
            writer.Write(Logic.Logic.Version);
            writer.Close();
        }
开发者ID:SightstoneOfficial,项目名称:SharpInstall,代码行数:26,代码来源:DownloadFiles.xaml.cs


示例19: smtpClient_SendCompleted

        private static void smtpClient_SendCompleted(object sender, AsyncCompletedEventArgs e) {
            // Get the message we sent
            MailMessage mailMessage = (MailMessage)e.UserState;
            MainWindow mainWindow = (MainWindow)Application.Current.MainWindow;

            if (e.Cancelled) {
                // prompt user with "send cancelled" message 
                mainWindow.showDialogue("Send Error", "Send Cancelled!");
            }
            if (e.Error != null) {
                // prompt user with error message 
                mainWindow.showDialogue("Send Error", e.Error.Message);
                System.Console.WriteLine(e.Error.Message);
            }
            else {
                // prompt user with message sent!
                // as we have the message object we can also display who the message
                // was sent to etc 
                mainWindow.showDialogue("Send Success", "Message Send Successfully!");
            }

            // finally dispose of the message
            if (mailMessage != null) {
                mailMessage.Dispose();
            }
                
        }
开发者ID:universal11,项目名称:CampaignReactorClient,代码行数:27,代码来源:CreatePage.xaml.cs


示例20: client_DownloadFileCompleted

        public void client_DownloadFileCompleted(object sender, AsyncCompletedEventArgs e)
        {
            OnExtracting();

            try
            {
                using (ZipFile file = ZipFile.Read(_updateFileName))
                {
                    foreach (ZipEntry entry in file)
                    {
                        // TODO
                        //_dialog.Line3 = entry.FileName;
                        entry.Extract(this.Path, ExtractExistingFileAction.OverwriteSilently);
                        _extractedFiles.Add(entry.FileName);
                    }

                    // TODO
                    //_dialog.Line2 = "Verifying signatures";

                    foreach (ZipEntry entry in file)
                    {
                        if (!entry.FileName.EndsWith(".dll") && !entry.FileName.EndsWith(".exe"))
                            continue;

                        // TODO
                        //_dialog.Line3 = entry.FileName;

                        try
                        {
                            string status;
                            if (!VerifyCertificate(X509Certificate.CreateFromSignedFile(entry.FileName).GetRawCertData(), out status))
                            {
                                OnErrorOccurred(entry.FileName + " does not have a valid signature!\n\n" + status);
                                CleanUp(true);
                                break;
                            }
                        }
                        catch (CryptographicException ex)
                        {

                            OnErrorOccurred(string.Format("A cryptographic exception occurred while trying to verify the signature of: {0}\n{1}\n\nThis probably means that this file doesn't have a valid signature!", entry.FileName, ex.Message));
                            CleanUp(true);
                            break;
                        }
                        catch (Exception ex)
                        {
                            OnErrorOccurred(string.Format("An exception occurred while trying to verify the signature of: {0}\n{1}", entry.FileName, ex.Message));
                            CleanUp(true);
                            break;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                OnErrorOccurred("Could not extract update:\n" + ex.Message);
            }

            OnFinish();
        }
开发者ID:WELL-E,项目名称:Toxy-WPF,代码行数:60,代码来源:Logic.cs



注:本文中的System.ComponentModel.AsyncCompletedEventArgs类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# ComponentModel.AsyncOperation类代码示例发布时间:2022-05-26
下一篇:
C# Compiler.Variable类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap