private void client_UploadFileCompleted(object sender, UploadFileCompletedEventArgs e) { if (e.Cancelled || e.Error != null) { MessageBox.Show("Error: " + e.Error.Message); _client.UploadCompleted = true; buttonDownload.Enabled = true; buttonUpload.Enabled = true; return; } _client.UploadCompleted = true; buttonDownload.Enabled = true; buttonUpload.Enabled = true; MessageBox.Show("File uploaded"); try { GetFtpContent(_client.GetDirectiories()); } catch (Exception exc) { MessageBox.Show("Error: " + exc.Message); } _client.DownloadCompleted = true; }
private void OnFtpClientUploadCompleted(object sender, UploadFileCompletedEventArgs uploadFileCompletedEventArgs) { _ftpClient.UploadFileCompleted -= OnFtpClientUploadCompleted; SaveButton.IsEnabled = true; ClosePageButton.IsEnabled = true; EditUploadingStatusPanel.Visibility = Visibility.Collapsed; if (_editMode == EditMode.News) { var attachmetnsTable = ((DataView)AttachmentsItemsControl.ItemsSource).Table; var newRow = attachmetnsTable.NewRow(); newRow["AttachmentName"] = _renamedNewNewsAttachments.Last().OriginalName; newRow["IsEdited"] = false; newRow["AddNeeded"] = true; attachmetnsTable.Rows.Add(newRow); UploadNewAttachmentsInQueue(); } else { var commentAttachmetnsTable = ((DataView)AttachmentsItemsControl.ItemsSource).Table; var newRow = commentAttachmetnsTable.NewRow(); newRow["CommentAttachmentName"] = _renamedNewCommentAttachments.Last().OriginalName; newRow["IsEdited"] = false; newRow["AddNeeded"] = true; commentAttachmetnsTable.Rows.Add(newRow); UploadNewCommentAttachmentsInQueue(); } }
private void Wc_UploadFileCompleted(object sender, UploadFileCompletedEventArgs e) { try { //상태바를 갱신 pbUpdProgress.Value = this.g_dProgressValue; //마지막 파일의 다운로드 완료, 에러가 없으면 메세지 표시하고 , 시스템을 기동한다. if (this.g_isSuccess && e.Error == null) { // 배포가 완료되었습니다. this.BaseClass.MsgInfo("CMPT_DEPLOY"); this.Close(); } else if (e.Error != null) { this.BaseClass.MsgError(e.Error.Message, BaseEnumClass.CodeMessage.MESSAGE); this.Close(); } } catch (Exception err) { this.BaseClass.Error(err); this.Close(); } }
private void UploadFileCallback(Object sender, UploadFileCompletedEventArgs e) { string reply = System.Text.Encoding.ASCII.GetString(e.Result); JsonObject json = JsonConvert.DeserializeObject <JsonObject>(reply); if (json.error == null) { if (json.updateDialog != "false") { DialogResult result = MessageBox.Show(this, "Your CensusPlusClassic addon is outdated. Do you wanna open the download website with the latest version " + json.updateDialog + "?", "CensusUploader", MessageBoxButtons.YesNo, MessageBoxIcon.Information); if (result == DialogResult.Yes) { System.Diagnostics.Process.Start("https://github.com/christophrus/CensusPlusClassic/releases/latest"); } } stats["charsInserted"] = json.charstats.inserted + Convert.ToInt32(stats["charsInserted"]); stats["charsUpdated"] = json.charstats.updated + Convert.ToInt32(stats["charsUpdated"]); stats["timesInserted"] = json.timestats.inserted + Convert.ToInt32(stats["timesInserted"]); stats["lastCharsInserted"] = json.charstats.inserted; stats["lastCharsUpdated"] = json.charstats.updated; stats["lastTimesInserted"] = json.timestats.inserted; updateStats(); saveSettings(); } else { MessageBox.Show(this, "Upload Error: " + json.error, "CensusUploader", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }
private async void UploadFileCallback(Object sender, UploadFileCompletedEventArgs e) { System.Media.SoundPlayer player = new System.Media.SoundPlayer(); player.SoundLocation = "completeSound.wav"; player.Play(); WebClient we = new WebClient(); string ss = we.DownloadString("https://vk.com/video" + videoOwner + "_" + videoId); while (ss.IndexOf("<meta property=\"og:video\" content=\"") == -1) { ss = we.DownloadString("https://vk.com/video" + videoOwner + "_" + videoId); Thread.Sleep(10000); } string hash = ss.Substring(ss.IndexOf("<meta property=\"og:video\" content=\""), 150); string[] findHash; findHash = hash.Split(new char[] { '"' }); videoHash = findHash[3]; videoHash = videoHash.Replace("&", "%26"); videoHash = videoHash.Replace("?", "%3F"); videoHash = videoHash.Replace(";", "%3B"); videoHash = videoHash.Replace("https:", ""); we.DownloadString("http://videorecorder.ru/api/app/videoSend.php?id=" + VideoRecorderZ.Properties.Settings.Default.userId + "&name=" + videoName + "&link=" + videoHash); loadButton.Enabled = true; }
void wc_UploadFileCompleted(object sender, UploadFileCompletedEventArgs e) { if (uploadComplete != null) { uploadComplete("Fin"); } }
void _Client_UploadFileCompleted(object sender, UploadFileCompletedEventArgs e) { if (e.Error != null) { // handle error scenario //throw e.Error; } if (e.Cancelled) { // handle cancelled scenario } else { if (_uploadList.Count > 0) { UploadInfo uploadInfo = _uploadList[0]; //string uploadPath = System.Text.Encoding.UTF8.GetString(e.Result); string uploadPath = uploadInfo._filePath; _uploadList.RemoveAt(0); if (uploadInfo._completeHandler != null) { uploadInfo._completeHandler(uploadPath); } } } UploadAsync(); }
private void uploadFileCompleted(object sender, UploadFileCompletedEventArgs e) { FileCompletedCount++; progressBar1.Value = (int)((float)FileCompletedCount / FileCount * 100); Console.WriteLine("一个完成"); }
protected virtual void OnUploadCompleted(object sender, UploadFileCompletedEventArgs e) { if (UpCompleted != null) { UpCompleted(sender, e); } }
private void webClient_UploadFileCompleted(object sender, UploadFileCompletedEventArgs e) { lock (this) { Monitor.PulseAll(this); } }
void UploadFileCompletedCallback(object sender, UploadFileCompletedEventArgs e) { client.UploadFileCompleted -= UploadFileCompletedCallback; File.Delete(filename); NetworkManager.Instance.Notify(src, "Upload completed!"); NetworkManager.Instance.Notify(src, string.Format("{0}/{1}", ACCESS_URI, filename)); }
void _webClient_UploadFileCompleted(object sender, UploadFileCompletedEventArgs e) { using (DelayedPropertyChanged()) { if (e.Cancelled) { OnUploadCompleted(); } else { if (e.Error != null) { OnUploadError(e.Error); } else { DoDeleteFile(Files[0]); _progressPercentage = 0; if (Files.Count > 0) { _webClient.UploadFileAsync(_uploadUri, Files[0].FullName); } else { OnUploadCompleted(); _success = true; } } } } }
/// <summary> /// 异步上传文件完成之后触发的事件 /// </summary> /// <paramKey colName="sender">下载对象</paramKey> /// <paramKey colName="e">数据信息对象</paramKey> void client_UploadFileCompleted(object sender, UploadFileCompletedEventArgs e) { if (UploadFileCompleted != null) { UploadFileCompleted(sender, e); } }
/// <summary> /// 上传文件完成事件 /// </summary> /// <param name="e">上传文件完成事件参数</param> protected void OnUploadCompleted(UploadFileCompletedEventArgs e) { if (UploadCompleted != null) { UploadCompleted(this, e); } }
private void UploadFileCallback(Object sender, UploadFileCompletedEventArgs e) { byte[] data = (byte[])e.Result; string reply = System.Text.Encoding.UTF8.GetString(data); textBox1.Text += reply; }
private void Client_UploadFileCompleted(object sender, UploadFileCompletedEventArgs e) { if (UploadFileCompleted_EventHandler != null) { UploadFileCompleted_EventHandler(); } }
private void client_UploadFileCompleted(object sender, UploadFileCompletedEventArgs e) { ChangeTray(false); //this.Activate(); if (e.Error != null) { ShowNotify(e.Error.Message, "Error", System.Windows.Forms.ToolTipIcon.Error); } else { string s = System.Text.Encoding.UTF8.GetString(e.Result, 0, e.Result.Length); string url = String.Format("http://{0}/{1}", Setting.Server, s); ShowNotify(url, "Success", System.Windows.Forms.ToolTipIcon.None, true); AddLink(url); for (int i = 0; i < 50; i++) { try { Clipboard.SetDataObject(url); return; } catch { } } } }
/** * 请求上传完成 */ private static void OnUploadFileCompleted(object sender, UploadFileCompletedEventArgs e) { string message = " 上传失败:未知错误"; if (e.Error != null) { ++UploadInfo.Error; message = " 上传失败:" + e.Error.Message + " Error(" + UploadInfo.Error + ")"; } else if (e.Result != null) { try { string data = System.Text.Encoding.UTF8.GetString(e.Result); Console.WriteLine(data); UploadResponse uploadResponse = JsonHelper.GetModelFromJson <UploadResponse>(data); if (uploadResponse.code == 0) { UploadInfo.Error = 0; message = "上传成功"; } else { ++UploadInfo.Error; message = "上传失败:code=" + uploadResponse.code; } } catch (Exception ex) { ++UploadInfo.Error; message = "上传失败:" + ex.Message; } } else { ++UploadInfo.Error; } Option.ShareMutex.WaitOne(); if (UploadInfo.Error == 0 || UploadInfo.Error >= 3) { OnUploadCompleted(message, UploadInfo.Error == 0); } if (UploadClient != null) { UploadClient.Dispose(); UploadClient = null; } Option.ShareMutex.ReleaseMutex(); }
private void Client_UploadFileCompleted(object sender, UploadFileCompletedEventArgs e) { imagesUploading = false; StopAnim(); try { string responseString = System.Text.Encoding.UTF8.GetString(e.Result); if (responseString.Substring(0, 2) == "OK") { responseString = responseString.Substring(3); string[] arr = responseString.Split(";"); string imgName = arr[0]; uploadedImages.Add(imgName); if (c.IsLoggedIn()) { Session.Pictures = uploadedImages.ToArray(); } else { RegisterActivity.regsessionid = arr[1]; if (!File.Exists(regSessionFile)) { File.WriteAllText(regSessionFile, RegisterActivity.regsessionid); } ((RegisterActivity)context).SaveRegData(); } ImagesUploaded.AddPicture(imgName, uploadedImages.Count - 1); } else if (responseString.Substring(0, 6) == "ERROR_") { c.SnackIndef(c.GetLang(responseString.Substring(6))); } else { c.ReportError(responseString); } ImagesProgress.Progress = 0; if (uploadedImages.Count > 1) { ImagesProgressText.Text = LangEnglish.ImagesRearrange; } else { ImagesProgressText.Text = ""; } } catch (Exception ex) { ImagesProgressText.Text = ""; if (!(ex.InnerException is WebException)) { c.ReportErrorSilent(ex.Message + " --- " + ex.InnerException + " --- " + System.Environment.NewLine + ex.StackTrace); } } }
private void OnUploadCompleted(UploadFileCompletedEventArgs eventArgs) { var _handler = this.UploadCompleted; if (null != _handler) { try { _handler(this, eventArgs); } catch { } } }
protected virtual void onUploadFileCompleted(UploadFileCompletedEventArgs e) { EventHandler <UploadFileCompletedEventArgs> handler = UploadFileCompleted; if (handler != null) { handler(this, e); } }
private void UploadFileCompleted(object sender, UploadFileCompletedEventArgs e) { server_archivo = System.Text.Encoding.UTF8.GetString(e.Result, 0, e.Result.Length); if (InvokeRequired) { Invoke(new delegar_Terminar(Terminar)); } }
private void OnFtpClientUploadFileCompleted(object sender, UploadFileCompletedEventArgs uploadFileCompletedEventArgs) { _ftpClient.UploadFileCompleted -= OnFtpClientUploadFileCompleted; if (_processWindow != null) { _processWindow.Close(true); } }
/// <summary> /// This event is raised each time file upload operation completes. /// </summary> private void Gett_UploadFileCompleted(object sender, UploadFileCompletedEventArgs e) { UploadFileCompletedEventHandler copyUploadFileCompleted = UploadFileCompleted; if (copyUploadFileCompleted != null) { copyUploadFileCompleted(this, e); } }
// </snippet9> // <snippet10> protected override void OnUploadFileCompleted(UploadFileCompletedEventArgs e) { // Here you can perform any custom actions before the event is raised // and event handlers are called... base.OnUploadFileCompleted(e); // Here you can perform any post event actions... }
private void uploadFileCompleted(object sender, UploadFileCompletedEventArgs e) { this.Dispatcher.Invoke(() => { prgProgress.Value = 100; uploadResultReturn = Encoding.UTF8.GetString(e.Result, 0, e.Result.Length); uploadDone = true; }); }
private void UploadFileCallback(Object sender, UploadFileCompletedEventArgs e) { byte[] result = e.Result; string s = System.Text.Encoding.UTF8.GetString(result, 0, result.Length); label1.Text = s.Split('$')[0] + " " + DateTime.Now.ToString("HH:mm:ss"); System.IO.File.Delete(path); Clipboard.SetText(s.Split('$')[1]); uploading = false; }
private void finished_upload(object sender, UploadFileCompletedEventArgs e) { Application.Current.Dispatcher.Invoke(DispatcherPriority.Background, new Action(delegate { txtbox.AppendText("\n\n" + MainWindow.globalLanguage.global.syncingToBS); })); BMBFUtils.Sync(txtbox); txtbox.AppendText("\n\n" + MainWindow.globalLanguage.global.syncedToBS); Running = false; }
private void OnUploadCompleted(object sender, UploadFileCompletedEventArgs e) { var uploadablePicture = UploadablePictures.FirstOrDefault(elem => elem.PicturePath == e.UploadedFileName); if (uploadablePicture != null) { uploadablePicture.IsUploaded = true; } }
private void PostWc_UploadFileCompleted(object sender, UploadFileCompletedEventArgs e) { // 删除导出文件 File.Delete(TempPath + ModelName + ".svfzip"); Svfzip svf = JsonConvert.DeserializeObject <Svfzip>(Encoding.UTF8.GetString(e.Result)); string path = "http://" + server + ":10086/offline/" + svf.filename; if (SetType == 1) { for (int i = 0; i < title.Count; i++) { if (ProjectId == Convert.ToInt32(id[i])) { AddModel model = _AddModel(path); if (model.success) { MessageBox.Show(title[i] + ":新增成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show(title[i] + ":新增失败\n" + model.msg, "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } break; } } SetType = 0; Enabled = true; } else if (SetType == 2) { for (int i = 0; i < title.Count; i++) { if (ProjectId == Convert.ToInt32(id[i])) { ReModel model = _ReModel(path); if (model.success) { MessageBox.Show(title[i] + ":修改成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show(title[i] + ":修改失败\n" + model.msg, "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } break; } } SetType = 0; Enabled = true; } }
void wc_UploadFileCompleted(object sender, UploadFileCompletedEventArgs e) { if (e.Error != null) { MessageBox.Show(e.Error.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } this.Invoke(new UpdateProgress((o) => { Close(); }), 100); }
private void InvokeOperationCompeted(AsyncOperation asyncOp, SendOrPostCallback callback, UploadFileCompletedEventArgs eventArgs) { if (this.m_IsExpired) eventArgs = new UploadFileCompletedEventArgs("", new Exception(Properties.Settings.Default.UploadExpired), false, this.m_AsyncOperation.UserSuppliedState); if (Interlocked.CompareExchange<AsyncOperation>(ref this.m_AsyncOperation, null, asyncOp) == asyncOp) { var _originalWebResponse = Interlocked.Exchange<WebResponse>(ref this.m_WebResponse, null); closeResponse(_originalWebResponse); this.completeUploadClientState(); asyncOp.PostOperationCompleted(callback, eventArgs); } }
public void srv_UploadFileCompleted(object sender, UploadFileCompletedEventArgs e) { // this will always say OK unless an error occurs, // if an error occurs, the service returns the error message // result of the WebServiceMethod string sTmp = e.Result; Messages = new string[] { "File Upload Status: " + sTmp , "File Upload" }; // System.Windows.Forms.MessageBox.Show("File Upload Status: " + sTmp, "File Upload"); return; }
private static void _client_UploadCompleted(object sender, UploadFileCompletedEventArgs e) { System.Console.WriteLine(e.Result); }
/// <summary> /// Begins uploading the content. /// </summary> /// <param name="content">The stream to upload.</param> /// <param name="fileName">The name of the file the stream is being uploaded to.</param> /// <param name="metadata">Optional metadata string containing additional information to send with the file.</param> /// <param name="autoCloseStream">True to close the provided content stream once the upload completes; otherwise false to leave open.</param> /// <param name="userToken">Optional user state associated with this request.</param> public void UploadStreamAsync(Stream content, string fileName, string metadata, bool autoCloseStream, object userToken = null) { if (null == content) throw new ArgumentNullException("content"); if (!content.CanRead) throw new ArgumentException("The provided content Stream is not readable.", "content"); if (!content.CanSeek) throw new ArgumentException("The provided content Stream is not seekable.", "content"); if (content.Length < 1) throw new ArgumentException("Content length is zero (0); nothing to send.", "content"); if (content.Length == content.Position) throw new ArgumentException("Content position is at the end of the file; no bytes left to send.", "content"); if (string.IsNullOrWhiteSpace(fileName)) throw new ArgumentNullException("fileName"); this.initUploadClientState(); this.clearUploadClientState(); this.FileName = Path.GetFileName(fileName); this.ContentLength = content.Length; // Azure Uri var _uriBuilder = new UriBuilder(m_ResolvedUri); _uriBuilder.Path += string.Format(CultureInfo.InvariantCulture, "/{0}", this.FileName); this.m_ResolvedUri = _uriBuilder.Uri; this.m_AsyncOperation = AsyncOperationManager.CreateOperation(userToken); try { if (!string.IsNullOrEmpty(metadata)) metadata = HttpUtility.HtmlEncode(metadata); var _request = this.getWebRequest(Properties.Settings.Default.HTTP_HEAD, "metadata"); _request.Headers[MsVersionHeader] = HeaderVersion; _request.Headers[ContentMD5] = Convert.ToBase64String(new System.Security.Cryptography.MD5CryptoServiceProvider().ComputeHash(content)); var _asyncState = new UploadChunkState(_request, content, fileName, metadata, autoCloseStream, this.appendChunkWriteCallback, this.appendChunkReadCallback, this.m_AsyncOperation, this.m_ProgressData, this); _request.BeginGetResponse(this.sendFileCheckResponse, _asyncState); } catch (Exception exception) { if (((exception is ThreadAbortException) || (exception is StackOverflowException)) || (exception is OutOfMemoryException)) { throw; } this.processException(ref exception, exception); if (null != content) content.Close(); var _eventArgs = new UploadFileCompletedEventArgs(null, exception, this.m_IsCancelled, this.m_AsyncOperation.UserSuppliedState); this.InvokeOperationCompeted(this.m_AsyncOperation, this.m_UploadOperationCompleted, _eventArgs); } }
private void uploadFileCompleted(UploadChunkState asyncState, string result, bool cancelled, Exception exception) { asyncState.Close(); var _eventArgs = new UploadFileCompletedEventArgs(result, exception, cancelled, this.m_AsyncOperation.UserSuppliedState); this.InvokeOperationCompeted(this.m_AsyncOperation, this.m_UploadOperationCompleted, _eventArgs); }
protected virtual void OnUploadFileCompleted ( UploadFileCompletedEventArgs args) { if (UploadFileCompleted != null) UploadFileCompleted (this, args); }