예제 #1
0
        private async void buttonZalohovat_Click(object sender, EventArgs e)
        {
            buttonZalohovat.Enabled = false;


            int i = 0;

            foreach (string s in diffSlozky)
            {
                Mega.VytvorSlozky(s, cillist);
                dataGridView1.Rows[i].Cells[1].Value = "OK";
                i++;
                pocslozek--;
                dataGridView1.Columns[0].Name = "Složky [" + pocslozek.ToString() + "]";
            }
            i = 0;
            foreach (string s in diffSoubory)
            {
                await Mega.VytvorSoubory(s, this, i);

                // dataGridView2.Rows[i].Cells[1].Value = "OK";
                i++;
                pocsouboru--;
                dataGridView2.Columns[0].Name = "Soubory [" + pocsouboru.ToString() + "]";;
                if (i == 12)
                {
                    for (int j = 1; j <= 11; j++)
                    {
                        dataGridView2.Rows.RemoveAt(0);
                    }
                    i = 1;
                    dataGridView2.Refresh();
                    this.Refresh();
                }
            }

            Mega.odpoj();
        }
예제 #2
0
파일: Form1.cs 프로젝트: xkolm036/Foto
        private void button_mega_Click(object sender, EventArgs e)
        {
            button_mega.Text    = "Loading";
            button_mega.Enabled = false;

            List <string> diffSlozky  = new List <string>();
            List <string> diffSoubory = new List <string>();
            List <string> zdrojlist;
            List <string> cillist = new List <string>();

            Task t = Task.Run(() =>
            {
                FileManager.DirSearch(zdroj);
                zdrojlist = new List <string>(FileManager.Slozky);

                foreach (string s in FileManager.Soubory)
                {
                    zdrojlist.Add(s);
                }

                FileManager.clear();


                Mega.pripoj();
                if (checkBox_list.Checked == false)
                {
                    cillist = Mega.VratStruktura();
                }

                //Pridat z nacteneho listu
                foreach (string s in ListFiles)
                {
                    if (!cillist.Contains(s))
                    {
                        cillist.Add(s);
                    }
                }

                foreach (string s in ListDirs)
                {
                    if (!cillist.Contains(s))
                    {
                        cillist.Add(s);
                    }
                }


                FileManager.difflist(zdrojlist, cillist, ref diffSlozky, ref diffSoubory);
            }
                              );
            var awaiter = t.GetAwaiter();

            awaiter.OnCompleted(() =>
            {
                button_mega.Text    = "Zálohovat na mega";
                button_mega.Enabled = true;
                Form mega           = new Mega_status(diffSlozky, diffSoubory, cillist);
                mega.Show();
            }
                                );
        }