예제 #1
0
        private void buttonGo_Click(object sender, EventArgs e)
        {
            string targetPath = textBox1.Text;

            // create directory if no exist
            try
            {
                System.IO.Directory.CreateDirectory(targetPath);
                Report("Target path verified");
            }
            catch
            {
                Report("Error with target path");
            }

            // login
            rest = new REST("http", "www.digitous.com");
            int status = rest.Login("dcave", "superman1!");

            if (200 == status)
            {
                Report("Login successful");
            }
            else
            {
                Report("Login failed!");
                return;
            }

            string destPathForRoot = targetPath;

            DownloadFolder(0, destPathForRoot);

            // start worker
            BackgroundWorker bgw = new BackgroundWorker();

            bgw.WorkerReportsProgress = true;
            bgw.DoWork             += new DoWorkEventHandler(bgw_DoWork);
            bgw.ProgressChanged    += new ProgressChangedEventHandler(bgw_ProgressChanged);
            bgw.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bgw_RunWorkerCompleted);

            bgw.RunWorkerAsync(null);
        }
예제 #2
0
파일: Form1.cs 프로젝트: jakesays/TestRepo
        private void buttonGo_Click(object sender, EventArgs e)
        {
            string targetPath = textBox1.Text;

              // create directory if no exist
              try
              {
            System.IO.Directory.CreateDirectory(targetPath);
            Report("Target path verified");
              }
              catch
              {
            Report("Error with target path");
              }

              // login
              rest = new REST("http", "www.digitous.com");
              int status = rest.Login("dcave", "superman1!");
              if (200 == status)
            Report("Login successful");
              else
              {
            Report("Login failed!");
            return;
              }

              string destPathForRoot = targetPath;
              DownloadFolder(0, destPathForRoot);

              // start worker
              BackgroundWorker bgw = new BackgroundWorker();
              bgw.WorkerReportsProgress = true;
              bgw.DoWork += new DoWorkEventHandler(bgw_DoWork);
              bgw.ProgressChanged += new ProgressChangedEventHandler(bgw_ProgressChanged);
              bgw.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bgw_RunWorkerCompleted);

              bgw.RunWorkerAsync(null);
        }