Progressbar update

Advertisement

MrVinc
Joined:
Posts:
1
Location:
Ger

Progressbar update

Hello,
i upload files via SCP and want to see the status in a Progressbar.
How did i update the progressbar?

Here my Code for the upload with a backgroundworker:


 private void frm_main_Load(object sender, EventArgs e)
        {
            worker = new BackgroundWorker();
            worker.WorkerReportsProgress = true;
            worker.WorkerSupportsCancellation = true;

            worker.DoWork += new DoWorkEventHandler(worker_DoWork);

        }


        private void btn_hochladen_Click(object sender, EventArgs e)
        {

            worker.RunWorkerAsync(2000);

        }

        void worker_DoWork(object sender, DoWorkEventArgs e)
        {

           if (arguments.Length > 1)
            {



                for (int i = 1; i < arguments.Length; i++) // Loop through array
                {

                    using (Session session = new Session())
                    {

                        // Connect
                        session.Open(sessionOptions);


                        // Upload files
                        TransferOptions transferOptions = new TransferOptions();
                        transferOptions.TransferMode = TransferMode.Binary;


                        TransferOperationResult transferResult;
                        string path = "/recalbox/share/roms/" + folder + "/";
                        transferResult = session.PutFiles(@"" + String.Join(", ", arguments[i]), path, false, transferOptions);
                        //transferResult = session.PutFiles(@"" + String.Join(", ", arguments[i]), "/recalbox/share/test/", false, transferOptions);


                        // Throw on any error
                        transferResult.Check();

                        // Print results
                        //foreach (TransferEventArgs transfer in transferResult.Transfers)
                        //{
                        //    MessageBox.Show(transfer.FileName);

                        //}

                    }

                }


            }

Reply with quote

Advertisement

You can post new topics in this forum