Example #1
4
        private void ComputeCompleted(object sender, AsyncCompletedEventArgs<Empty> e)
        {
            _calibrationForm.Close();

            if(e.Error != null)
            {
                _calibrationResult = null;
            }
            else
            {
                _calibrationResult = _tracker.GetCalibration();
            }
        }
    public void Close(AsyncCompletedEventArgs e)
    {
        if (e.Error != null)
        {
            MessageBox.Show(e.Error.Message);
        }

        Destroy();
    }
 private static void OnDownloadFileComplete(object sender, AsyncCompletedEventArgs e)
 {
     var filename = e.UserState.ToString();
     var tempPath = Path.Combine(TempFolder, filename);
     if (e.Cancelled == false && e.Error == null)
     {
         Directory.Move(tempPath, Path.Combine(CacheFolder, filename));
     } else
     {
         // attempt to remove partially downloaded file
         File.Delete(filename);
     }
 }
Example #4
1
 public static void MailSendCompleted(
     object sender, AsyncCompletedEventArgs e)
 {
     MailMessage m = e.UserState as MailMessage;
     if (e.Cancelled)
     {
         Debug.Write("Email to " + m.To + " was cancelled.");
     }
     if (e.Error != null)
     {
         Debug.Write("Email to " + m.To + " failed.");
         Debug.Write(e.Error.ToString());
     }
     else
         Debug.Write("Message sent.");
 }
Example #5
1
 public void download_DownloadFileCompleted(object sender, AsyncCompletedEventArgs e)
 {
     string path = System.IO.Path.GetTempPath();
     XmlDocument current = new XmlDocument();
     current.Load(Environment.CurrentDirectory + @"\Info.xml");
     XmlNodeList pro = current.GetElementsByTagName("ProgramName");
     XmlNodeList update = current.GetElementsByTagName("updatexml");
     string prog = pro[0].InnerText;
     string updateurl = update[0].InnerText;
     XmlDocument updater = new XmlDocument();
     updater.Load(updateurl);
     XmlNodeList load = updater.GetElementsByTagName("InstallerNAME");
     string installer = load[0].InnerText;
     MessageDialog complete = new MessageDialog(this,DialogFlags.NoSeparator,MessageType.Warning,ButtonsType.Ok,"Update has been downloaded sucessfully. Please Close all instances of " + prog + " while update is in session.");
     System.Diagnostics.Process.Start(path + installer);
     Application.Quit();
 }
    void client_SendCompleted(object sender, AsyncCompletedEventArgs e)
    {
        MailMessage mail = (MailMessage)e.UserState;
        string subject = mail.Subject;

        if (e.Cancelled)
        {
            string cancelled = string.Format("[{0}] Send canceled.", subject);
            lblMessage.Text = cancelled;
        }
        if (e.Error != null)
        {
            string error = String.Format("[{0}] {1}", subject, e.Error.ToString());
            lblMessage.Text = error;
        }
        else
        {
            lblMessage.Text = "Message sent.";
        }
        mailSent = true;
    }
Example #7
1
    private static void SendCompletedCallback(object sender, AsyncCompletedEventArgs e, string RegisterationOrSubscriptionId, string RegisterationOrSubscription)
    {
        // Get the unique identifier for this asynchronous operation.
        String token = (string)e.UserState;

        if (e.Cancelled)
        {
            Console.WriteLine("[{0}] Send canceled.", token);
            XLSLogGenerator.WriteCSVLogForMailStatus(RegisterationOrSubscription, RegisterationOrSubscriptionId, "Send canceled", token);
        }
        if (e.Error != null)
        {
            Console.WriteLine("[{0}] {1}", token, e.Error.ToString());
            XLSLogGenerator.WriteCSVLogForMailStatus(RegisterationOrSubscription, RegisterationOrSubscriptionId, "Error Detail " + e.Error.ToString(), token);
        }
        else
        {
            Console.WriteLine("Message sent.");
            XLSLogGenerator.WriteCSVLogForMailStatus(RegisterationOrSubscription, RegisterationOrSubscriptionId, "Message sent", token);
        }
        mailSent = true;

        //CSVLogGenerator.WriteCSVLogForTesting("EMail Status", RegisterationOrSubscriptionId, token, Convert.ToString(mailSent));
    }
    private void Completed(object sender, AsyncCompletedEventArgs e)
    {
        downloadCompleted_ = true;

          		if(e.Cancelled)
            downloadTimeout_ = true;
    }
Example #9
0
    /// <summary>
    /// Raises the SendCompleted event after the send is completed.
    /// </summary>
    /// <param name="e">Provides data for async SendCompleted event</param>
    protected override void OnSendCompleted(AsyncCompletedEventArgs e)
    {
        base.OnSendCompleted(e);

        string detail = "Received callback from asynchronosu dispatch";

        EventLogProvider.LogInformation("CMSCustom", "MyCustomEmailProvider", detail);
    }
Example #10
0
 void wc_DownloadFileCompleted(object sender, AsyncCompletedEventArgs e)
 {
     MessageBox.Show("File downloaded");
 }
Example #11
0
 private void client_DownloadFileCompleted(object sender, AsyncCompletedEventArgs e)
 {
     MessageBox.Show("Download Finished");
     (sender as CustomWebClient).Dispose();
 }
Example #12
0
    private void _smptpClient_SendCompleted(object sender, AsyncCompletedEventArgs e)
    {
        if (e.Error != null)
        {
            try
            {

                VCM_Mail _vcmMail = new VCM_Mail(-1);
                _vcmMail.From = System.Configuration.ConfigurationManager.AppSettings["FromEmail"].ToString();
                _vcmMail.To = System.Configuration.ConfigurationManager.AppSettings["FromEmail"].ToString();

                _vcmMail.SendAsync = true;
                _vcmMail.Subject = "Mail has not been sent " + _mailSubject;

                _vcmMail.Body = "<div style=\"font-size:8pt;font-family:Verdana\">Dear Broker,<br/><br/> Mail has not been sent to " + _mailTo + " users for below session " +
               "<table>"+
               "<tr><td style=\"FONT-SIZE: 8pt; FONT-FAMILY: Verdana;\">" + _mailSubject + " </td></tr>"+
               "<tr><td style=\"FONT-SIZE: 8pt; FONT-FAMILY: Verdana;\">SYSTEM RUNNING ON : " + System.Configuration.ConfigurationManager.AppSettings["SystemRunningOn"].ToUpper() + " </td></tr>" +
               "<tr><td style=\"FONT-SIZE: 8pt; FONT-FAMILY: Verdana;\">ERROR MESSAGE : " + e.Error.Message + " </td></tr>"+
               "<tr><td style=\"FONT-SIZE: 8pt; FONT-FAMILY: Verdana;\">ERROR INNEREXCEPTION : " + e.Error.InnerException + " </td></tr>"+
               "<tr><td style=\"FONT-SIZE: 8pt; FONT-FAMILY: Verdana;\">ERROR STAKETRACE : " + e.Error.StackTrace + " </td></tr>"+
               "<tr><td>&nbsp; </br></br> </td></tr>"+
               "<tr><td style=\"FONT-SIZE: 8pt; FONT-FAMILY: Verdana;\">--Mail Signature--</td></tr>"+
               "</table> " +
                "<br/><br/> ";

                _vcmMail.IsBodyHtml = true;
                _vcmMail.SendMail();
                _vcmMail = null;

                LogUtility.Error("VCM_Mail.cs", "_smptpClient_SendCompleted()", e.Error.Message, e.Error);
            }
            catch (Exception ex)
            {
                LogUtility.Error("VCM_Mail.cs", "_smptpClient_SendCompleted()", ex.Message, ex);
            }
        }
        else if (e.Cancelled)
        {
            LogUtility.Info("VCM_Mail.cs", "_smptpClient_SendCompleted()", "The asynchronous operation has been cancelled.");
        }
    }
Example #13
0
 private void smtpClient_SendCompleted(object sender, AsyncCompletedEventArgs e)
 {
 }
Example #14
0
 private static void MailDeliveryComplete(object sender, AsyncCompletedEventArgs e)
 {
     callbackCalled = true;
     updatedEvent.Set();
 }
    void DownloadFileCompleted( object sender, AsyncCompletedEventArgs end )
    {
        if ( downloading == true )
        {

            if ( end.Cancelled == true )
            {
                File.Delete ( startupManager.tempPath + downloadingSong.name + "." + downloadingSong.format );
            } else {

                if ( File.Exists ( startupManager.downloadedPath + downloadingSong.name + "." + downloadingSong.format ))
                    File.Delete ( startupManager.downloadedPath + downloadingSong.name + "." + downloadingSong.format );

                File.Move ( startupManager.tempPath + downloadingSong.name + "." + downloadingSong.format, startupManager.downloadedPath + downloadingSong.name + "." + downloadingSong.format );

                musicViewer.forceRefresh = true;
            }

            songInfoOwner = null;
            currentDownloadPercentage = "";
            showSongInformation = false;
            downloading = false;
        }
    }
Example #16
0
        private void OnTaskCompleted(object operationState)
        {
            AsyncCompletedEventArgs e = operationState as AsyncCompletedEventArgs;

            this.OnTaskCompleted(e);
        }
Example #17
0
 static void DoneDownloading(object sender, AsyncCompletedEventArgs e)
 {
     Install();
 }
Example #18
0
 private void pictureBox1_LoadCompleted(object sender, AsyncCompletedEventArgs e)
 {
     LoadCompleted = true;
 }
Example #19
0
 private void FileDownloadComplete(object sender, AsyncCompletedEventArgs e)
 {
     MessageBox.Show("Downlaod Completed");
 }
Example #20
0
 private void Client_DownloadFileCompleted(object sender, AsyncCompletedEventArgs e)
 {
     //Gereksiz
 }
Example #21
0
 private void StopDownload(object sender, AsyncCompletedEventArgs e)
 {
     Stop();
     doCallbackAction("stop");
 }
Example #22
0
 /// <summary>
 ///     Raises the <see cref="DownloadCompleted"/> event.
 /// </summary>
 /// <param name="e">
 ///     An <see cref="AsyncCompletedEventArgs"/> containing the data for the event.
 /// </param>
 protected virtual void OnDownloadCompleted(AsyncCompletedEventArgs e)
 {
     EventHandler<AsyncCompletedEventArgs> downloadCompletedEvent = DownloadCompleted;
     if (downloadCompletedEvent != null)
     {
         downloadCompletedEvent(this, e);
     }
 }
Example #23
0
 private void wc_DownloadFileCompleted(object sender, AsyncCompletedEventArgs e)
 {
     System.Windows.Forms.MessageBox.Show("Download complete");
 }
        private void WebClientOnDownloadFileCompleted(object sender, AsyncCompletedEventArgs asyncCompletedEventArgs)
        {
            if (asyncCompletedEventArgs.Cancelled)
            {
                return;
            }

            if (asyncCompletedEventArgs.Error != null)
            {
                MessageBox.Show(asyncCompletedEventArgs.Error.Message, asyncCompletedEventArgs.Error.GetType().ToString(), MessageBoxButtons.OK,
                                MessageBoxIcon.Error);
                _webClient = null;
                Close();
                return;
            }

            if (!string.IsNullOrEmpty(AutoUpdater.Checksum))
            {
                if (!CompareChecksum(_tempFile, AutoUpdater.Checksum))
                {
                    _webClient = null;
                    Close();
                    return;
                }
            }

            string fileName;
            string contentDisposition = _webClient.ResponseHeaders["Content-Disposition"] ?? string.Empty;

            if (string.IsNullOrEmpty(contentDisposition))
            {
                fileName = Path.GetFileName(_webClient.ResponseUri.LocalPath);
            }
            else
            {
                fileName = TryToFindFileName(contentDisposition, "filename=");
                if (string.IsNullOrEmpty(fileName))
                {
                    fileName = TryToFindFileName(contentDisposition, "filename*=UTF-8''");
                }
            }
            var tempPath = Path.Combine(string.IsNullOrEmpty(AutoUpdater.DownloadPath) ? Path.GetTempPath() : AutoUpdater.DownloadPath, fileName);

            try
            {
                if (File.Exists(tempPath))
                {
                    File.Delete(tempPath);
                }
                File.Move(_tempFile, tempPath);
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message, e.GetType().ToString(), MessageBoxButtons.OK, MessageBoxIcon.Error);
                _webClient = null;
                Close();
                return;
            }

            var processStartInfo = new ProcessStartInfo
            {
                FileName        = tempPath,
                UseShellExecute = true,
                Arguments       = AutoUpdater.InstallerArgs.Replace("%path%", Path.GetDirectoryName(Process.GetCurrentProcess().MainModule.FileName))
            };

            var extension = Path.GetExtension(tempPath);

            if (extension.ToLower().Equals(".zip"))
            {
                string installerPath = Path.Combine(Path.GetDirectoryName(tempPath), "ZipExtractor.exe");
                File.WriteAllBytes(installerPath, Resources.ZipExtractor);
                processStartInfo = new ProcessStartInfo
                {
                    FileName        = installerPath,
                    UseShellExecute = true,
                    Arguments       = $"\"{tempPath}\" \"{Process.GetCurrentProcess().MainModule.FileName}\""
                };
                if (AutoUpdater.RunUpdateAsAdmin)
                {
                    processStartInfo.Verb = "runas";
                }
            }

            try
            {
                Process.Start(processStartInfo);
            }
            catch (Win32Exception exception)
            {
                _webClient = null;
                if (exception.NativeErrorCode != 1223)
                {
                    throw;
                }
            }

            Close();
        }
Example #25
0
 private void rarcom(object sender, AsyncCompletedEventArgs e)
 {
     //giải nen winrar
     ZipFile.ExtractToDirectory(rarsave, rarpath);
     kiemtra();
 }
Example #26
0
 private void webClient_DownloadFileCompleted(object sender, AsyncCompletedEventArgs e)
 {
     this.IsRunning = false;
 }
Example #27
0
 private void Sequence1_LoadCompleted(object sender, AsyncCompletedEventArgs e)
 {
     Set_Sequence(sequence1);
 }
Example #28
0
 void client_DownloadFileCompleted(object sender, AsyncCompletedEventArgs e)
 {
     OnDownloadComplete?.Invoke(tempFile);
 }
Example #29
0
        void wc_DownloadFileCompleted(object sender, AsyncCompletedEventArgs e)
        {
            if (e.Error != null || e.Cancelled)
            {
                DownloadFileCompleted(this, e);
            }
            else
            {
                if (_mode == 0)
                {
                    if (new System.IO.FileInfo(_file).Length < 100 * 1024)
                    {
                        string text = System.IO.File.ReadAllText(_file);
                        int    html = text.IndexOf("<html", StringComparison.InvariantCultureIgnoreCase);
                        if (html >= 0 && html < 100)
                        {
                            int ilink = text.IndexOf("\"uc-download-link\"", StringComparison.InvariantCultureIgnoreCase);
                            if (ilink > 0)
                            {
                                int href = text.IndexOf("href=\"", ilink, StringComparison.InvariantCultureIgnoreCase);
                                if (href > 0)
                                {
                                    int hrefend = text.IndexOf('"', href + 6);
                                    if (hrefend > 0)
                                    {
                                        string url = text.Substring(href + 6, hrefend - href - 6).Replace("&amp;", "&");
                                        if (url.IndexOf("://") < 0)
                                        {
                                            url = new Uri(_url).GetLeftPart(UriPartial.Authority) + url;
                                        }
                                        System.Diagnostics.Debug.WriteLine("GDrive: redirecting to " + url);
                                        System.Diagnostics.Debug.WriteLine("GDrive: {0} cookies set", _cookies.Count);
                                        var wc = new WebClientEx(_cookies);
                                        wc.DownloadFileCompleted   += new AsyncCompletedEventHandler(wc_DownloadFileCompleted);
                                        wc.DownloadProgressChanged += new DownloadProgressChangedEventHandler(wc_DownloadProgressChanged);
                                        System.IO.File.Delete(_file);
                                        wc.Headers.Add("Referer", _url);
                                        wc.DownloadFileAsync(new Uri(url), _file, _state);
                                        _mode      = 1;
                                        _webClient = wc;
                                        return;
                                    }
                                }
                            }

                            int    tstart = text.IndexOf("<title>", StringComparison.InvariantCultureIgnoreCase);
                            int    tend   = text.IndexOf("</title>", StringComparison.InvariantCultureIgnoreCase);
                            string err    = "Couldn't parse data";
                            if (tstart > 0 && tend > 0)
                            {
                                err = text.Substring(tstart + 7, tend - tstart - 7);
                            }

                            //If we get here, it went wrong
                            System.IO.File.Delete(_file);
                            DownloadFileCompleted(this, new AsyncCompletedEventArgs(new Exception(err), false, _state));
                        }
                        else
                        {
                            DownloadFileCompleted(this, e);
                        }
                    }
                    else
                    {
                        DownloadFileCompleted(this, e);
                    }
                }
                else
                {
                    DownloadFileCompleted(this, e);
                }
            }
        }
 private void Completed(object sender, AsyncCompletedEventArgs e)
 {
     MessageBox.Show("Download completed!");
 }
Example #31
0
        // Token: 0x06000005 RID: 5 RVA: 0x00003C20 File Offset: 0x00001E20
        private void dlClient_DownloadFileCompleted(object sender, AsyncCompletedEventArgs e)
        {
            this.dlClient.Dispose();
            this.SUpdate("更新をチェックしています...");
            if (e.Error != null)
            {
                MessageBox.Show("更新できませんでした。" + Environment.NewLine + e.Error.Message, "アップデートエラー", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                base.DialogResult = DialogResult.Abort;
                base.Close();
                return;
            }
            this.ud = UpdateData.ParseXML(this.tempfile);
            File.Delete(this.tempfile);
            if (this.ud.DefVersion <= Global.definition.CheckVersion)
            {
                MessageBox.Show("最新版を利用しています。更新の必要はありません。", "更新結果", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                base.DialogResult = DialogResult.Abort;
                base.Close();
                return;
            }
            if (this.ud.RequireLower > Global.definition.CheckVersion)
            {
                MessageBox.Show("このバージョンからの更新は、自動アップデートでは対応していません。" + Environment.NewLine + "公式サイトから手動で更新してください。", "自動更新非対応", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                base.DialogResult = DialogResult.Abort;
                base.Close();
                return;
            }
            if (MessageBox.Show(string.Concat(new string[]
            {
                "バージョン",
                this.ud.Name.ToString(),
                "がリリースされています。",
                Environment.NewLine,
                "ダウンロードしてインストールしてもよろしいですか?"
            }), Global.definition.AppName + "の更新", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
            {
                base.DialogResult = DialogResult.Abort;
                base.Close();
                return;
            }
            this.progressBar1.Value = 0;
            this.SUpdate("パッケージをダウンロードしています...[1/2]");
            this.dlClient = new WebClient();
            this.dlClient.Headers.Add("User-Agent", string.Concat(new string[]
            {
                Global.definition.AppName,
                " - ",
                Global.definition.AppNameFull,
                "/",
                Global.definition.Version,
                "(compatible; MSIE 6.0/7.0; Windows XP/Vista)"
            }));
            this.dlClient.DownloadProgressChanged += this.dlClient_DownloadProgressChanged;
            this.dlClient.DownloadFileCompleted   += this.dlClient_DownloadFileCompleted2;
            while (this.TemporaryFolder == null || Directory.Exists(this.TemporaryFolder))
            {
                this.TemporaryFolder = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName());
            }
            Directory.CreateDirectory(this.TemporaryFolder);
            this.tempfile = Path.Combine(this.TemporaryFolder, Path.GetFileName(this.ud.Update.Replace('/', '\\')));
            Uri address = new Uri(this.ud.Update);

            try
            {
                this.dlClient.DownloadFileAsync(address, this.tempfile);
            }
            catch (Exception ex)
            {
                MessageBox.Show("更新できませんでした。" + Environment.NewLine + ex.Message, "アップデートエラー", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                base.DialogResult = DialogResult.Abort;
                base.Close();
            }
        }
        /// <summary>
        /// OnDownloadCompleted event handler
        /// </summary>
        /// <param name="sender">Sender object</param>
        /// <param name="args">AsyncCompletedEventArgs instance</param>
        protected void OnDownloadCompleted(object sender, AsyncCompletedEventArgs args)
        {
            var webClient = sender as DownloadWebClient;

            if (webClient == null)
            {
                this.logger.Warn("Wrong sender in OnDownloadCompleted: Actual:{0} Expected:{1}", sender.GetType(), typeof(DownloadWebClient));
                InvokeDownloadCompleted(CompletedState.Failed, this.localFileName);
                return;
            }

            if (args.Cancelled)
            {
                this.logger.Debug("Download cancelled. Source: {0} Destination: {1}", this.fileSource, this.localFileName);
                DeleteDownloadedFile();

                InvokeDownloadCompleted(CompletedState.Canceled, this.localFileName);
                this.readyToDownload.Set();
            }
            else if (args.Error != null)
            {
                if (this.isFallback)
                {
                    DeleteDownloadedFile();
                }

                ////We may have NameResolutionFailure on internet connectivity problem.
                ////We don't use DnsFallbackResolver if we successfully started downloading, and then got internet problem.
                ////If we change [this.fileSource] here - we lose downloaded chunk in Cache (i.e. we create a new Cache item for new [this.fileSource]
                if (this.attemptNumber == 1 && DnsFallbackResolver != null && IsNameResolutionFailure(args.Error))
                {
                    var newFileSource = DnsFallbackResolver.Resolve(this.fileSource);
                    if (newFileSource != null)
                    {
                        this.fileSource = newFileSource;
                        this.logger.Debug("Download failed in case of DNS resolve error. Retry downloading with new source: {0}.", this.fileSource);
                        AttemptDownload();
                        return;
                    }
                }

                this.logger.Debug("Download failed. Source: {0} Destination: {1} Error: {2}", this.fileSource, this.localFileName, args.Error);

                if (!AttemptDownload())
                {
                    InvokeDownloadCompleted(CompletedState.Failed, null, args.Error);
                    this.readyToDownload.Set();
                }
            }
            else
            {
                if (this.useFileNameFromServer)
                {
                    this.localFileName = ApplyNewFileName(this.localFileName, webClient.GetOriginalFileNameFromDownload());
                }

                this.logger.Debug("Download completed. Source: {0} Destination: {1}", this.fileSource, this.localFileName);
                if (UseCaching)
                {
                    this.downloadCache.Add(this.fileSource, this.localFileName, webClient.ResponseHeaders);
                }

                ////we may have the destination file not immediately closed after downloading
                WaitFileClosed(this.localFileName, TimeSpan.FromSeconds(3));

                InvokeDownloadCompleted(CompletedState.Succeeded, this.localFileName, null);
                this.readyToDownload.Set();
            }
        }
Example #33
0
 private static void SendCompletedCallback(object sender, AsyncCompletedEventArgs e)
 {
     Core.Log.Debug(e.Error);
 }
Example #34
0
 private void wcNus_DownloadFileCompleted(object sender, AsyncCompletedEventArgs e)
 {
     isdownloading = false;
 }
Example #35
0
        private void DownloadDbCompleto(string nomedoBanco, string urlDownload, string caminhoPastaSalvarDownload, AsyncCompletedEventArgs e)
        {
            sw.Reset();

            if (e.Cancelled == true)
            {
                MensagemLog("Download do banco " + nomedoBanco + " cancelado!!", true);
            }
            else
            {
                MensagemLog("Download do banco " + nomedoBanco + " Finalizado!!", true);
            }


            AlterarTextLabel(lblVelocidadeDownload, "0 kb/s");
            AlterarTextLabel(lblPorcentagemDownload, "0%");
            AlterarTextLabel(lblTamanhoBanco, "0MB");
            AlterarStatusDownloadDbProcentagem(0);
            DownloadBancosSelecionados(urlDownload, caminhoPastaSalvarDownload);
        }
 /// <summary>
 /// Raises the SendCompleted event after the send is completed.
 /// </summary>
 /// <param name="e">Provides data for the async SendCompleted event</param>
 protected override void OnSendCompleted(AsyncCompletedEventArgs e)
 {
     base.OnSendCompleted(e);
 }
Example #37
0
 private void loadingGif_LoadCompleted(object sender, AsyncCompletedEventArgs e)
 {
 }
Example #38
0
 private void Client_DownloadFileCompleted(object sender, AsyncCompletedEventArgs e)
 {
     lock (_lock)
     {
         if (e == null)
         {
             logger.Info($"LOCAL FILE FOUND");
         }
         else
         {
             logger.Info($"]");
         }
         string FileName = ((WebClient)sender).QueryString["file"];
         Console.WriteLine($"Downloading {FileName} complete");
         if (Path.GetExtension(FileName) == ".png")
         {
             ImageFilePath = FileName;
             if (!JSONLoaded)
             {
                 ImageLoaded = true;
             }
             else
             {
                 ImageLoaded = true;
                 if (key == ImageExtractorKey.Goods)
                 {
                     GoodImageList            = SplitGoodImage(JSONFilePath, ImageFilePath);
                     GoodImageList.ImageSize  = new System.Drawing.Size(CropSize.w, CropSize.h);
                     GoodImageList.ColorDepth = ColorDepth.Depth32Bit;
                 }
                 else
                 {
                     UnitImageLise            = SplitUnitImage(JSONFilePath, ImageFilePath);
                     UnitImageLise.ImageSize  = new System.Drawing.Size(CropSize.w, CropSize.h);
                     UnitImageLise.ColorDepth = ColorDepth.Depth32Bit;
                 }
             }
         }
         else if (Path.GetExtension(FileName) == ".json")
         {
             JSONFilePath = FileName;
             if (!ImageLoaded)
             {
                 JSONLoaded = true;
             }
             else
             {
                 JSONLoaded = true;
                 if (key == ImageExtractorKey.Goods)
                 {
                     GoodImageList            = SplitGoodImage(JSONFilePath, ImageFilePath);
                     GoodImageList.ImageSize  = new System.Drawing.Size(CropSize.w, CropSize.h);
                     GoodImageList.ColorDepth = ColorDepth.Depth32Bit;
                 }
                 else
                 {
                     UnitImageLise            = SplitUnitImage(JSONFilePath, ImageFilePath);
                     UnitImageLise.ImageSize  = new System.Drawing.Size(CropSize.w, CropSize.h);
                     UnitImageLise.ColorDepth = ColorDepth.Depth32Bit;
                 }
             }
         }
     }
 }
Example #39
0
 //异步发送邮件的发送结果
 public static void SendCompletedCallback(object sender, AsyncCompletedEventArgs e)
 {
 }
Example #40
0
 private void wcAsyncCompletedEventHandler(object sender, AsyncCompletedEventArgs e)
 {
     btnDownload.Text  = "Download";
     barProgress.Value = 0;
 }
 void DownloadFileCompleted(object sender, AsyncCompletedEventArgs end)
 {
     currentDownloadPercentage = "0%";
     currentlyDownloading = false;
     showDownloadInfo = false;
 }
Example #42
0
 /// <summary>
 /// Callback for message sent
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 public void OnMessageSent(object sender, AsyncCompletedEventArgs e)
 {
     DialogueBox message_success = Instantiate(MessageSuccessPanel).GetComponent<DialogueBox>();
     message_success.NewDialogue("Feedback Sent!", 2.0f);
 }
Example #43
0
		static void SendMailAsyncCompletedHandler (TaskCompletionSource<object> source, AsyncCompletedEventArgs e, SendCompletedEventHandler handler, SmtpClient client)
		{
			if ((object) handler != e.UserState)
				return;

			client.SendCompleted -= handler;

			if (e.Error != null) {
				source.SetException (e.Error);
				return;
			}

			if (e.Cancelled) {
				source.SetCanceled ();
				return;
			}

			source.SetResult (null);
		}
Example #44
0
        private void PointCompleted(object sender, AsyncCompletedEventArgs<Empty> e)
        {
            _calibrationForm.ClearCalibrationPoint();

            StartNextOrFinish();
        }
 void DownloadFileCompleted(object sender, AsyncCompletedEventArgs end)
 {
     guitext.text = "Download Finished! Uncompressing!";
 }
Example #46
0
 private void Wc_DownloadFileCompleted(object sender, AsyncCompletedEventArgs e)
 {
 }
Example #47
0
 private void StopDownload(object sender, AsyncCompletedEventArgs e)
 {
     Stop();
 }
Example #48
0
 void wc_DownloadFileCompleted(object sender, AsyncCompletedEventArgs e)
 {
     Finish();
 }
Example #49
0
 private void DownloadFileCompletedEventHandler(object sender, AsyncCompletedEventArgs e)
 {
     DownloadFileCompleted(this, e);
 }
Example #50
0
		protected void OnSendCompleted (AsyncCompletedEventArgs e)
		{
			try {
				if (SendCompleted != null)
					SendCompleted (this, e);
			} finally {
				worker = null;
				user_async_state = null;
			}
		}
Example #51
0
 void client_DownloadFileCompleted(object sender, AsyncCompletedEventArgs e)
 {
     TextResult.Text += " Download completed. \n";
 }
    void client_DownloadFileCompleted(object sender, AsyncCompletedEventArgs e)
    {
        richTextBox1.Text += dot + "Download finished. Verifying...\n";
        if (_update.md5.ToLower() == GetMD5HashFromFile(@"update.zip").ToLower()) {
            richTextBox1.Text += dot + "OK! Extracting...\n";

            Directory.CreateDirectory(@"update/");

            using (ZipFile zip = ZipFile.Read(@"update.zip")) {
                foreach (ZipEntry f in zip) {
                    f.Extract(@"update/", true);
                }
            }

            richTextBox1.Text += dot + "Extracted. Please click the \"Install update\" button.\n";

            button_download.Enabled = true;
            button_download.Text = "Install update";
            _install = true;
        } else {
            richTextBox1.Text += dot + "Invalid checksum. Installation cancelled.";
        }
    }
Example #53
0
 static void service_ReverseStringCompleted(object sender, AsyncCompletedEventArgs<string> e)
 {
     Console.WriteLine(e.Result);
 }