Beispiel #1
0
        // Called when progress updates
        void OnUploadProgress(Google.Apis.Upload.IUploadProgress progress)
        {
            switch (progress.Status)
            {
            case Google.Apis.Upload.UploadStatus.Starting:
                progressBar1.Minimum = 0;
                progressBar1.Value   = 0;

                break;

            case Google.Apis.Upload.UploadStatus.Completed:
                progressBar1.Value = progressBar1.Maximum;
                break;

            case Google.Apis.Upload.UploadStatus.Uploading:
                UpdateProgressBar(progress.BytesSent);

                break;

            case Google.Apis.Upload.UploadStatus.Failed:
                MessageBox.Show("Upload failed"
                                + Environment.NewLine
                                + progress.Exception);
                break;
            }
        }
Beispiel #2
0
        /********************************************** Events *****************************************************************/


        public void myProgressChanged(Google.Apis.Upload.IUploadProgress myProgress)
        {
            try
            {
                if (myProgress.Status == Google.Apis.Upload.UploadStatus.Uploading)
                {
                    double myProcent = myProgress.BytesSent / (m_TotalBytesSize / 100);

                    if (ProgressEvent != null)
                    {
                        ProgressEvent(new DriveProgressEventArgs(myProcent));
                    }
                }
                else if (myProgress.Status == Google.Apis.Upload.UploadStatus.Completed)
                {
                    if (FinishedEvent != null)
                    {
                        FinishedEvent(new DriveFinishedEventArgs(true));
                    }
                }
                else if (myProgress.Status == Google.Apis.Upload.UploadStatus.Failed)
                {
                    if (FinishedEvent != null)
                    {
                        FinishedEvent(new DriveFinishedEventArgs(false));
                    }
                }
            }
            catch (Exception ex)
            {
                ErrorDump.AddError(System.IntPtr.Zero, "GUpload.cs", "myProgressChanged", ex);
            }
        }
        void videosInsertRequest_ProgressChanged(Google.Apis.Upload.IUploadProgress progress)
        {
            switch (progress.Status)
            {
            case UploadStatus.Starting:
                break;

            case UploadStatus.Uploading:

                label5.Text = String.Format("{0} мб загружено.", progress.BytesSent / 1048576);;
                break;

            case UploadStatus.Completed:
                DialogResult dialog = MessageBox.Show("Загзузка успешно завершена.", "Чтобы вернуться в начало, нажмите ОК", MessageBoxButtons.OK, MessageBoxIcon.Information);
                if (dialog == DialogResult.OK)
                {
                    panel1.Controls.Clear();
                    panel1.Controls.Add(label1);
                    panel1.Controls.Add(label2);
                    panel1.Controls.Add(openFileButton1);
                }
                break;

            case UploadStatus.Failed:
                label5.Text = String.Format("Обнаружена ошибка не позволяющая завершить загрузку.\n{0}", progress.Exception);
                break;
            }
        }
Beispiel #4
0
        private void OnRequestProgressChanged(Google.Apis.Upload.IUploadProgress obj)
        {
            string content;

            switch (obj.Status)
            {
            case UploadStatus.NotStarted:
                content = "Not Started";
                break;

            case UploadStatus.Starting:
                content = "Upload Starting";
                break;

            case UploadStatus.Completed:
                content = "Upload completed";
                break;

            case UploadStatus.Uploading:
                content = "Uploading the file...";
                break;

            case UploadStatus.Failed:
                content = "Upload failed";
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
            MessagingCenter.Send(new DownloadStatusModel()
            {
                DownloadStatus = content
            }, "UploadStatus");
        }
        void videosInsertRequest_ProgressChanged(Google.Apis.Upload.IUploadProgress progress)
        {
            switch (progress.Status)
            {
            case UploadStatus.Completed:
                IsUploadingFinished = true;
                break;

            case UploadStatus.Failed:
                throw new InvalidOperationException("An error prevented the upload from completing.\n{0}", progress.Exception);
            }
        }
Beispiel #6
0
        private void videosInsertRequest_ProgressChanged(Google.Apis.Upload.IUploadProgress progress)
        {
            switch (progress.Status)
            {
            case UploadStatus.Uploading:
                _log.LogInformation($"Still uploading... {progress.BytesSent} bytes sent.");
                break;

            case UploadStatus.Failed:
                _log.LogError($"An error prevented the upload from completing.");     // Ex: {progress.Exception}
                break;
            }
        }
        void videosInsertRequest_ProgressChanged(Google.Apis.Upload.IUploadProgress progress)
        {
            switch (progress.Status)
            {
            case UploadStatus.Uploading:
                Console.WriteLine($"{progress.BytesSent} bytes sent. ({ ((double)progress.BytesSent / TotalSize).ToString("P")})");
                break;

            case UploadStatus.Failed:
                Console.WriteLine("An error prevented the upload from completing.\n{0}", progress.Exception);
                break;
            }
        }
Beispiel #8
0
        void videosInsertRequest_ProgressChanged(Google.Apis.Upload.IUploadProgress progresso)
        {
            switch (progresso.Status)
            {
            case UploadStatus.Uploading:
                Console.WriteLine("{0} bytes enviados.", progresso.BytesSent);
                break;

            case UploadStatus.Failed:
                Console.WriteLine("Ocorreu um erro impedindo o upload do video.\n{0}", progresso.Exception);
                break;
            }
        }
Beispiel #9
0
        void videosInsertRequest_ProgressChanged(Google.Apis.Upload.IUploadProgress progress)
        {
            switch (progress.Status)
            {
            case UploadStatus.Uploading:
                Console.WriteLine("{0} bytes sent.", progress.BytesSent);
                break;

            case UploadStatus.Failed:
                Console.WriteLine("An error prevented the upload from completing.\n{0}", progress.Exception);
                break;
            }
        }
    void insertRequest_ProgressChanged(Google.Apis.Upload.IUploadProgress progress)
    {
        // You can handle several status messages here.
        switch (progress.Status)
        {
        case UploadStatus.Failed:
            UploadedVideoId = "FAILED";
            break;

        case UploadStatus.Completed:
            break;

        default:
            break;
        }
    }
Beispiel #11
0
        /// <summary>
        /// 状態変更イベント
        /// </summary>
        /// <param name="progress"></param>
        void VideosInsertRequest_ProgressChanged(Google.Apis.Upload.IUploadProgress progress)
        {
            status.Status = progress.Status;
            switch (progress.Status)
            {
            case UploadStatus.Uploading:
                Debug.WriteLine("{0} bytes sent.", progress.BytesSent);
                status.FileCurrentUploadedByte = progress.BytesSent;
                break;

            case UploadStatus.Failed:
                Debug.WriteLine("An error prevented the upload from completing.\n{0}", progress.Exception);
                break;
            }
            YoutubeUploadStatusChanged?.Invoke(status.Clone());
        }
Beispiel #12
0
        void videosInsertRequest_ProgressChanged(Google.Apis.Upload.IUploadProgress progress)
        {
            FileInfo localFileInfo = new FileInfo(this.currentFilename);

            switch (progress.Status)
            {
            case UploadStatus.Uploading:
                Console.WriteLine("{0} bytes sent.", progress.BytesSent);
                currentProgressCallback(localFileInfo.Name, progress.BytesSent, localFileInfo.Length);
                break;

            case UploadStatus.Failed:
                Console.WriteLine("An error prevented the upload from completing.\n{0}", progress.Exception);
                break;
            }
        }
Beispiel #13
0
        } // hàm upload

        static void videosInsertRequest_ProgressChanged(Google.Apis.Upload.IUploadProgress progress)// báo dung lượng upload
        {
            switch (progress.Status)
            {
            case UploadStatus.Uploading:
                long Mbupload  = progress.BytesSent / (1024 * 1024);
                long Mbupload1 = progress.BytesSent % (1024 * 1024);
                Mbupload = Mbupload + Mbupload1;
                Console.WriteLine(string.Format("{0} MB uploaded.", Mbupload));
                break;

            case UploadStatus.Failed:
                Console.WriteLine(string.Format("Đã có lỗi.\n{0}", progress.Exception));
                break;
            }
        }
Beispiel #14
0
        private static void ProgressChanged(Google.Apis.Upload.IUploadProgress progress)
        {
            switch (progress.Status)
            {
            case UploadStatus.Uploading:
                Console.WriteLine($"{Math.Round((double)progress.BytesSent / _totalBytes * 100, 2)}% uploaded " +
                                  $"({FileHelper.BytesToString(progress.BytesSent)}/{FileHelper.BytesToString(_totalBytes)}) at " +
                                  $"{ FileHelper.BytesToString(Convert.ToInt64(progress.BytesSent / (DateTime.Now - _startTime).TotalSeconds)) }/s.");
                break;

            case UploadStatus.Failed:
                Console.WriteLine($"An error prevented the upload from completing.\n{progress.Exception}");
                Thread.Sleep(10000);
                break;
            }
        }
Beispiel #15
0
        } // hàm upload

        void videosInsertRequest_ProgressChanged(Google.Apis.Upload.IUploadProgress progress)// báo dung lượng upload
        {
            switch (progress.Status)
            {
            case UploadStatus.Uploading:
                long Mbupload  = progress.BytesSent / (1024 * 1024);
                long Mbupload1 = progress.BytesSent % (1024 * 1024);
                Mbupload = Mbupload + Mbupload1;

                break;

            case UploadStatus.Failed:

                break;
            }
        }
Beispiel #16
0
        void videosInsertRequest_ProgressChanged(Google.Apis.Upload.IUploadProgress progress)
        {
            switch (progress.Status)
            {
            case UploadStatus.Uploading:
                break;

            case UploadStatus.Failed:
                MessageBox.Show("An error prevented the upload from completing");
                break;

            case UploadStatus.Completed:
                MessageBox.Show("Film został wysłany");
                break;
            }
        }
Beispiel #17
0
 void videosInsertRequest_ProgressChanged(Google.Apis.Upload.IUploadProgress progress)
 {
     /*switch (progress.Status)
      * {
      *  case UploadStatus.Uploading:
      *      //Bilgi Mesajları
      *      statusLabel.ForeColor = Color.DarkBlue;
      *      statusLabel.Text = "[" + progress.BytesSent.ToString() + "] Video yükleniyor. Tarih: " + DateTime.Now.ToString("hh:mm:ss dd MMMM yyyy");
      *  break;
      *
      *  case UploadStatus.Failed:
      *      //Bilgi Mesajları
      *      statusLabel.ForeColor = Color.DarkRed;
      *      statusLabel.Text = "Video yüklenirken hata oluştu. Hata: " + progress.Exception;
      *  break;
      * }*/
 }
Beispiel #18
0
            /// <summary>
            /// Fire the associated event handler
            /// </summary>
            /// <param name="uploadProgress"></param>
            void videosInsertRequest_ProgressChanged(Google.Apis.Upload.IUploadProgress uploadProgress)
            {
                switch (uploadProgress.Status)
                {
                case UploadStatus.Uploading:
                    EventHandler <long> ea = Upload_ProgressChanged;
                    if (ea != null)
                    {
                        ea(this, uploadProgress.BytesSent);
                    }
                    break;

                case UploadStatus.Failed:
                    EventHandler <String> eb = Upload_Failed;
                    if (eb != null)
                    {
                        eb(this, uploadProgress.Exception.ToString());
                    }
                    Console.WriteLine("An error prevented the upload from completing.\n{0}", uploadProgress.Exception);
                    break;
                }
            }
Beispiel #19
0
        void videosInsertRequest_ProgressChanged(Google.Apis.Upload.IUploadProgress progress)
        {
            switch (progress.Status)
            {
            case UploadStatus.Uploading:
                lblprogress.Text    = "Status : Uploading... " + progress.BytesSent.ToString();
                Session["progress"] = progress.BytesSent.ToString();
                break;

            case UploadStatus.Failed:
                //  Response.Write(String.Format("{0}<br/>", progress.Exception.Message));
                //Response.Write(String.Format("{0}<br/>", progress.Exception.StackTrace));
                lbluploadfailed.Text = "Status : " + progress.Exception.Message.ToString();
                CreateLog err = new CreateLog();
                CreateLog.CreateLogFiles();
                err.ErrorLog(Server.MapPath("/Logs/ErrorLog.txt"), progress.Exception.Message.ToString());
                break;

            case UploadStatus.Completed:
                Session["uploadcompleted"] = UploadStatus.Completed;
                break;
            }
        }
Beispiel #20
0
 private void Request_ProgressChanged(Google.Apis.Upload.IUploadProgress obj)
 {
     _logger.LogInformation(obj.Status + " " + obj.BytesSent);
 }