private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
        {
            Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate
            {
                pb = new ProgressBar();
                pb.Show();
            }));

            FileInfo fileInfo = new FileInfo(path);
            if (fileInfo.Exists)
            {
                using (FileStream stream = new FileStream(path, System.IO.FileMode.Open, System.IO.FileAccess.Read))
                {
                    using (StreamWithProgress uploadStreamWithProgress = new StreamWithProgress(stream))
                    {
                        uploadStreamWithProgress.ProgressChanged += uploadStreamWithProgress_ProgressChanged;
                        service.UploadFile(fileInfo.Name, fileInfo.Length, 0, uploadStreamWithProgress, flag);
                    }
                }
            }
        }
 public void uploadStreamWithProgress_ProgressChanged(object sender, StreamWithProgress.ProgressChangedEventArgs e)
 {
     if (e.Length != 0)
     {
         bw.ReportProgress((int)(e.BytesRead * 100 / e.Length));
     }
 }
        private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
        {
            Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate
            {
                pb = new ProgressBar();
                pb.Show();
            }));

            //NoUSB 폴더에 저장
            FileInfo fileInfo = new FileInfo(zipPath_Convert);
            if (fileInfo.Exists)
            {
                using (FileStream stream = new FileStream(zipPath_Convert, System.IO.FileMode.Open, System.IO.FileAccess.Read))
                {
                    using (StreamWithProgress uploadStreamWithProgress = new StreamWithProgress(stream))
                    {
                        uploadStreamWithProgress.ProgressChanged += uploadStreamWithProgress_ProgressChanged;
                        service.UploadFile(id + " - " + fileInfo.Name, fileInfo.Length, 0, uploadStreamWithProgress, 6);
                    }
                }
            }
            service.Dispose();

            if (System.IO.Directory.Exists(startPath))
            {
                try
                {
                    System.IO.Directory.Delete(startPath, true);
                }

                catch
                {
                    return;
                }
            }

            if (System.IO.File.Exists(zipPath + ".zip"))
            {
                try
                {
                    System.IO.File.Delete(zipPath + ".zip");
                }

                catch
                {
                    return;
                }
            }

            Environment.Exit(0);
            System.Diagnostics.Process.GetCurrentProcess().Kill();
            this.Close();
        }