Exemplo n.º 1
0
        private async void ThreadProcess(object obj)
        {
            if (token1 == "")
            {
                DialogResult d;
                d = System.Windows.Forms.MessageBox.Show("Please login your account ", "Login required", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
                if (d == System.Windows.Forms.DialogResult.Yes)
                {
                    Thread.Sleep(50);
                    FourPage fo = new FourPage();
                    fo.Show();
                    this.Hide();
                }
                if (d == System.Windows.Forms.DialogResult.No)
                {
                    Close();
                    Environment.Exit(0);
                }
            }
            else
            {
                FunctionStep1 step1 = new FunctionStep1();
                list1 = step1.GetMeJoinedTeam(token1);
                for (int i = 0; i < list1.Count; i++)
                {
                    await testFuctions(token1, list1[i].id, 1);

                    int c = i + 1;
                    SetprogressBar1(c, list1.Count);
                    Thread.Sleep(5);
                }
            }
        }
Exemplo n.º 2
0
        public FivePage()
        {
            InitializeComponent();
            con.Open();
            SqlCommand cmd1 = new SqlCommand("select_atoken", con);

            cmd1.CommandType = CommandType.StoredProcedure;
            using (SqlDataReader reader = cmd1.ExecuteReader())
            {
                if (reader.Read())
                {
                    token1 = reader["access_token"].ToString();
                }
            }
            con.Close();

            if (token1 == "")
            {
                DialogResult d;
                d = System.Windows.Forms.MessageBox.Show("Please login your account ", "Login required", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
                if (d == System.Windows.Forms.DialogResult.Yes)
                {
                    FourPage fo = new FourPage();
                    fo.Show();
                    this.Hide();
                }
                if (d == System.Windows.Forms.DialogResult.No)
                {
                    Close();
                    Environment.Exit(0);
                }
            }
            else
            {
                FunctionStep1 step1 = new FunctionStep1();
                list1 = step1.GetMeJoinedTeam(token1);
            }

            worker                            = new BackgroundWorker();
            worker.DoWork                    += worker_DoWork;
            worker.ProgressChanged           += worker_ProgressChanged;
            worker.RunWorkerCompleted        += worker_RunWorkerCompleted;
            worker.WorkerReportsProgress      = true;
            worker.WorkerSupportsCancellation = false;

            int maxItems = list1.Count;

            pbar.Minimum = 1;
            pbar.Maximum = 100;

            StatusTextBox.Text = "Starting...";
            worker.RunWorkerAsync(maxItems);
        }