コード例 #1
0
        private void Ftp_OnCommitCompleted(object sender, System.Net.UploadFileCompletedEventArgs e)
        {
            try
            {
                m_Count++;

                if (m_Count == m_TotleCount)
                {
                    Application.ActiveApplication.Output.ClearOutput();
                    FileInfo fileinfo = new FileInfo(m_WorkspacePath);
                    Application.ActiveApplication.Output.Output("【" + fileinfo.Name.Split('.')[0] + "】工程上传完成!", InfoType.Information);
                    WorkspaceConnectionInfo info = new WorkspaceConnectionInfo()
                    {
                        Server = m_WorkspacePath,
                        Type   = (WorkspaceType)Enum.Parse(typeof(WorkspaceType), fileinfo.Name.Split('.')[1].ToUpper()),
                    };
                    if (Application.ActiveApplication.Workspace.Open(info))
                    {
                        Application.ActiveApplication.Workspace.Caption = fileinfo.Name.Split('.')[0];
                        Application.ActiveApplication.Workspace.Save();
                        Application.ActiveApplication.CreateSceneWindow(Application.ActiveApplication.Workspace.Scenes[0]);
                    }
                }
            }
            catch (Exception ex)
            {
                Log.OutputBox(ex);
            }
        }
コード例 #2
0
ファイル: UploadProgram.cs プロジェクト: mt-code/ByteGuard
        private void UploadCompleted(object sender, System.Net.UploadFileCompletedEventArgs e)
        {
            // Gets the web response that has been returned from the server.
            string webResponse = Encoding.ASCII.GetString(e.Result);

            // Parses the web response.
            if (webResponse.Split('[', ']')[1] == "SUCCESS")
            {
                // Displays the most recently uploaded file.
                Thread threadDisplayMostRecent = new Thread(DisplayRecentlyUploaded);
                threadDisplayMostRecent.Start();

                // Displays the success message.
                Variables.Containers.Main.SetStatus(webResponse.Replace("[SUCCESS]", String.Empty), 4);
            }
            else
            {
                // Failed to upload avatar, display error.
                Variables.Containers.Main.SetStatus(webResponse.Replace("[ERROR] ", String.Empty), 1);
            }

            Invoke((MethodInvoker) delegate
            {
                progUploadProgress.Value   = 0;
                progUploadProgress.Visible = false;
                btnUpload.Visible          = true;
            });
        }
コード例 #3
0
        private void File_UploadFileCompleted(object sender, System.Net.UploadFileCompletedEventArgs e)
        {
            if (InvokeRequired)
            {
                Invoke(new Action(() => File_UploadFileCompleted(sender, e)));
                return;
            }

            _file.UploadProgressChanged -= File_UploadProgressChanged;
            _file.UploadFileCompleted   -= File_UploadFileCompleted;

            _ended = DateTime.Now;
            TimeSpan totalTime = _ended - _started;
            long     speed     = (long)totalTime.TotalSeconds > 0 ? _fileSize / (long)totalTime.TotalSeconds : 0;

            progressBar_UploadDownload.Value = progressBar_UploadDownload.Maximum;

            label_Speed.Text = string.Format("Total time: {0}, speed was {1}/s", (DateTime.Now - _started).ToString(@"hh\:mm\:ss"), FormatSizeDisplay(speed));

            button_Cancel.Text   = @"Close";
            button_Cancel.Click -= button_Cancel_Click;
            button_Cancel.Click += (obj, evt) => Close();

            if (e.Error != null)
            {
                MessageBox.Show(@"Failed to upload new file '" + _fileName + @"' to Ge.tt" + Environment.NewLine + @"Exception of type " + e.Error.GetType() + Environment.NewLine + e.Error.Message);
            }
        }
コード例 #4
0
 private void M_ftp2_UploadFileCompleted(object sender, System.Net.UploadFileCompletedEventArgs e)
 {
     try
     {
         OnCommitCompleted?.Invoke(sender, e);
     }
     catch (Exception ex)
     {
         Log.OutputBox(ex);
         Log.ShowError(m_ftp.ErrorMsg);
     }
 }
コード例 #5
0
 private void M_Ftp_OnUploadCompleted(object sender, System.Net.UploadFileCompletedEventArgs e)
 {
     try
     {
         m_loadIndex++;
         LoadData();
         m_Application.MessageBox.Show("上传完成!");
     }
     catch (Exception ex)
     {
         Log.OutputBox(ex);
     }
 }
コード例 #6
0
        private void UploadProgressComplete(object sender, System.Net.UploadFileCompletedEventArgs e)
        {
            // Displays the operation identifier, and the transfer progress.

            if (System.Text.Encoding.UTF8.GetString(e.Result, 0, e.Result.Length).StartsWith("http://"))
            {
                Lbstats.Content = "Stats: Message Sent";
            }
            else
            {
                Lbstats.Content = "Fault -Report to Cloud Wallet: " + System.Text.Encoding.UTF8.GetString(e.Result, 0, e.Result.Length);
            }
        }
コード例 #7
0
        public static void OnUploadFileCompleted(object sender, System.Net.UploadFileCompletedEventArgs e)
        {
            if (e.Cancelled == true)
            {
                // MessageBox.Show("Download has been canceled.");
                System.Console.WriteLine("Download has been canceled.");
                return;
            }
            else if (e.Error != null)
            {
                throw e.Error;
            }


            byte[] ba = e.Result;
            System.Console.WriteLine(ba != null);

            string userState = (string)e.UserState;

            System.Console.WriteLine("UserState: \"{0}\".", userState);
        }
コード例 #8
0
        private void Client_UploadFileCompleted(object sender, System.Net.UploadFileCompletedEventArgs e)
        {
            HttpWebClient <AddAttachmentDto> hbc = sender as HttpWebClient <AddAttachmentDto>;
            var str = Encoding.UTF8.GetString(e.Result);

            var dataStr      = string.Empty;
            var temperrorMsg = string.Empty;

            if (!GetValueByJsonKey("data", str, ref dataStr, ref temperrorMsg))
            {
                LogHelper.WriteError($"[NoticeAddWindowViewModel_NoticeFileUploadReturnError data is null]:{temperrorMsg}");
                return;
            }
            //处理
            var upoutput = JsonConvert.DeserializeObject <AntSdkFileUpLoadOutput>(dataStr);

            if (upoutput != null)
            {
                var fDto = new AddAttachmentDto
                {
                    data = new data
                    {
                        createTime  = upoutput.createTime,
                        downloadURL = upoutput.dowmnloadUrl,
                        fileMD5     = upoutput.fileMD5,
                        fileName    = upoutput.fileName,
                        fileSize    = upoutput.fileSize,
                        fileType    = upoutput.fileType
                    },
                    uploadFileSucess = 1
                };
                AddAttachmentDto changed =
                    _attachment.SingleOrDefault(m => m.fileGuid == (hbc.obj as AddAttachmentDto).fileGuid);

                changed.data             = fDto.data;
                changed.uploadFileSucess = 1;
                changed.btnforeground    = "0";
                changed.btnStatus        = "上传成功";
            }
        }
コード例 #9
0
ファイル: FormMain.cs プロジェクト: farti/WebApplications
 private void Client_UpCompleted(object sender, System.Net.UploadFileCompletedEventArgs e)
 {
     if (e.Cancelled || e.Error != null)
     {
         MessageBox.Show("Błąd: " + e.Error.Message);
         client.UploadCompleted = true;
         buttonSend.Enabled = true;
         buttonDownload.Enabled = true;
         return;
     }
     client.UploadCompleted = true;
     buttonSend.Enabled = true;
     buttonDownload.Enabled = true;
     MessageBox.Show("Wysłano plik");
     try
     {
         GetFtpContent(client.GetDirectories());
     }
     catch ( Exception ex)
     {
         MessageBox.Show(ex.Message, "Błąd");
     }
 }
コード例 #10
0
 protected virtual void OnUploadFileCompleted(System.Net.UploadFileCompletedEventArgs e)
 {
 }
コード例 #11
0
 static void wb_UploadFileCompleted(object sender, System.Net.UploadFileCompletedEventArgs e)
 {
     // Console.WriteLine("ok" + e.Error != null ? e.Error.Message : "");
 }
コード例 #12
0
        private void UploadProgressComplete(object sender, System.Net.UploadFileCompletedEventArgs e)
        {
            // Displays the operation identifier, and the transfer progress.

            EmailTo.Text = System.Text.Encoding.UTF8.GetString(e.Result, 0, e.Result.Length);
        }
コード例 #13
0
 /// <summary>
 /// 上传文件回调
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void Client_UploadFileCompleted(object sender, System.Net.UploadFileCompletedEventArgs e)
 {
     Console.WriteLine(sender.ToString());
     DoNext();
 }
コード例 #14
0
 private void Ftp_OnCommitCompleted(object sender, System.Net.UploadFileCompletedEventArgs e)
 {
     lblResult.Text = "上传完成";
 }