private void sbrossetup(object sender, RoutedEventArgs e)
        {
            setup df = new setup();

            df.olldsetup();
            df.savesetup();
            MessageBox.Show("Настройки успешно востановлены!");
        }
Example #2
0
 private void ok(object sender, RoutedEventArgs e)
 {
     Cursor = Cursors.Wait;
     if (ComboBox1.Text == "Выберите курс") { Cursor = Cursors.Arrow; MessageBox.Show("Пожалуйста выберите курс!"); }
     else if (ComboBox2.Text == "Выберите неделю") { Cursor = Cursors.Arrow; MessageBox.Show("Пожалуйста выберите неделю!"); }
     else if (TextBox.Text == "" || TextBox.Text[0] != 'h' || TextBox.Text[3] != 'p' || TextBox.Text[11] != 'v' || TextBox.Text[16] != 'u') { Cursor = Cursors.Arrow; MessageBox.Show("Пожалуйста вставьте ссылку или проверьте ее корректность"); }
     else
     {
         try
         {
             setup fg = new setup();
             fg.redfile();
             string otbor = ComboBox1.Text.ToString() + ComboBox2.Text.ToString();
             switch (otbor)
             {
                 case "11":
                     fg.writeurl1_1 = TextBox.Text;
                     break;
                 case "12":
                     fg.writeurl1_2 = TextBox.Text;
                     break;
                 case "21":
                     fg.writeurl2_1 = TextBox.Text;
                     break;
                 case "22":
                     fg.writeurl2_2 = TextBox.Text;
                     break;
                 case "31":
                     fg.writeurl3_1 = TextBox.Text;
                     break;
                 case "32":
                     fg.writeurl3_2 = TextBox.Text;
                     break;
                 case "41":
                     fg.writeurl4_1 = TextBox.Text;
                     break;
                 case "42":
                     fg.writeurl4_2 = TextBox.Text;
                     break;
                 case "51":
                     fg.writeurl5_1 = TextBox.Text;
                     break;
                 case "52":
                     fg.writeurl5_2 = TextBox.Text;
                     break;
             }
             fg.savesetup();
             Close();
             Cursor = Cursors.Arrow;
             MessageBox.Show("Ссылка успешно добавлена!");
         }
         catch
         {
             Cursor = Cursors.Arrow;
             MessageBox.Show("Пожалуйста проверьте правильность введенной вами ссылки и соеденение с интернетом");
         }
     }
 }
Example #3
0
        private async void ok(object sender, RoutedEventArgs e)
        {
            int dostupkobrabotke = 0;
            button1.Visibility = Visibility.Collapsed;
            button2.Visibility = Visibility.Collapsed;
            Label1.Visibility = Visibility.Collapsed;
            bar.Visibility = Visibility.Visible;
            bar1.Visibility = Visibility.Visible;
            Label3.Visibility = Visibility.Visible;
            Label5.Visibility = Visibility.Visible;
            text1.Visibility = Visibility.Visible;
            Label6.Visibility = Visibility.Visible;
            try
            {
                string s = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
                this.we = System.IO.Path.Combine(s, @"ProgramData\FreeRooms");
                System.IO.Directory.CreateDirectory(we);
                bar1.Value = 1;
                text1.Text = bar1.Value.ToString();
                Label6.Content = "Создана папка для загрузки";
            }
            catch
            {
                MessageBox.Show("ошибка в создании папки для фаила\n  запустите программу от имени администратора!");
                Label1.Visibility = Visibility.Visible;
                Label3.Visibility = Visibility.Collapsed;
                button1.Visibility = Visibility.Visible;
                button2.Visibility = Visibility.Visible;
                bar.Visibility = Visibility.Collapsed;
                bar1.Visibility = Visibility.Collapsed;
                Label5.Visibility = Visibility.Collapsed;
                text1.Visibility = Visibility.Collapsed;
                Label6.Visibility = Visibility.Collapsed;
                dostupkobrabotke = 1;
            }
            if (dostupkobrabotke == 0)
            {
                int chatch1 = 0;
                var result = await Task<string>.Factory.StartNew(() =>
                {
                    try
                    {

                        WebClient webClient = new WebClient();
                        setup setup = new setup();
                        setup.redfile();
                        switch (setup.colichestvo)
                        {
                            case "0":
                                chatch1 = 1;
                                break;
                            case "2":
                                webClient.DownloadFile(setup.writeurl1_1, System.IO.Path.Combine(we, @"1_1.xls"));
                                webClient.DownloadFile(setup.writeurl1_2, System.IO.Path.Combine(we, @"1_2.xls"));
                                if (System.IO.File.Exists(System.IO.Path.Combine(we, @"2_1.xls"))) try { System.IO.File.Delete(System.IO.Path.Combine(we, @"2_1.xls")); }
                                    catch { }
                                if (System.IO.File.Exists(System.IO.Path.Combine(we, @"2_2.xls"))) try { System.IO.File.Delete(System.IO.Path.Combine(we, @"2_2.xls")); }
                                    catch { }
                                if (System.IO.File.Exists(System.IO.Path.Combine(we, @"3_1.xls"))) try { System.IO.File.Delete(System.IO.Path.Combine(we, @"3_1.xls")); }
                                    catch { }
                                if (System.IO.File.Exists(System.IO.Path.Combine(we, @"3_2.xls"))) try { System.IO.File.Delete(System.IO.Path.Combine(we, @"3_2.xls")); }
                                    catch { }
                                if (System.IO.File.Exists(System.IO.Path.Combine(we, @"4_1.xls"))) try { System.IO.File.Delete(System.IO.Path.Combine(we, @"4_1.xls")); }
                                    catch { }
                                if (System.IO.File.Exists(System.IO.Path.Combine(we, @"4_2.xls"))) try { System.IO.File.Delete(System.IO.Path.Combine(we, @"4_2.xls")); }
                                    catch { }
                                if (System.IO.File.Exists(System.IO.Path.Combine(we, @"5_1.xls"))) try { System.IO.File.Delete(System.IO.Path.Combine(we, @"5_1.xls")); }
                                    catch { }
                                if (System.IO.File.Exists(System.IO.Path.Combine(we, @"5_2.xls"))) try { System.IO.File.Delete(System.IO.Path.Combine(we, @"5_2.xls")); }
                                    catch { }

                                break;
                            case "4":
                                webClient.DownloadFile(setup.writeurl1_1, System.IO.Path.Combine(we, @"1_1.xls"));
                                webClient.DownloadFile(setup.writeurl1_2, System.IO.Path.Combine(we, @"1_2.xls"));
                                webClient.DownloadFile(setup.writeurl2_1, System.IO.Path.Combine(we, @"2_1.xls"));
                                webClient.DownloadFile(setup.writeurl2_2, System.IO.Path.Combine(we, @"2_2.xls"));
                                if (System.IO.File.Exists(System.IO.Path.Combine(we, @"3_1.xls"))) try { System.IO.File.Delete(System.IO.Path.Combine(we, @"3_1.xls")); }
                                    catch { }
                                if (System.IO.File.Exists(System.IO.Path.Combine(we, @"3_2.xls"))) try { System.IO.File.Delete(System.IO.Path.Combine(we, @"3_2.xls")); }
                                    catch { }
                                if (System.IO.File.Exists(System.IO.Path.Combine(we, @"4_1.xls"))) try { System.IO.File.Delete(System.IO.Path.Combine(we, @"4_1.xls")); }
                                    catch { }
                                if (System.IO.File.Exists(System.IO.Path.Combine(we, @"4_2.xls"))) try { System.IO.File.Delete(System.IO.Path.Combine(we, @"4_2.xls")); }
                                    catch { }
                                if (System.IO.File.Exists(System.IO.Path.Combine(we, @"5_1.xls"))) try { System.IO.File.Delete(System.IO.Path.Combine(we, @"5_1.xls")); }
                                    catch { }
                                if (System.IO.File.Exists(System.IO.Path.Combine(we, @"5_2.xls"))) try { System.IO.File.Delete(System.IO.Path.Combine(we, @"5_2.xls")); }
                                    catch { }
                                break;
                            case "6":
                                webClient.DownloadFile(setup.writeurl1_1, System.IO.Path.Combine(we, @"1_1.xls"));
                                webClient.DownloadFile(setup.writeurl1_2, System.IO.Path.Combine(we, @"1_2.xls"));
                                webClient.DownloadFile(setup.writeurl2_1, System.IO.Path.Combine(we, @"2_1.xls"));
                                webClient.DownloadFile(setup.writeurl2_2, System.IO.Path.Combine(we, @"2_2.xls"));
                                webClient.DownloadFile(setup.writeurl3_1, System.IO.Path.Combine(we, @"3_1.xls"));
                                webClient.DownloadFile(setup.writeurl3_2, System.IO.Path.Combine(we, @"3_2.xls"));
                                if (System.IO.File.Exists(System.IO.Path.Combine(we, @"4_1.xls"))) try { System.IO.File.Delete(System.IO.Path.Combine(we, @"4_1.xls")); }
                                    catch { }
                                if (System.IO.File.Exists(System.IO.Path.Combine(we, @"4_2.xls"))) try { System.IO.File.Delete(System.IO.Path.Combine(we, @"4_2.xls")); }
                                    catch { }
                                if (System.IO.File.Exists(System.IO.Path.Combine(we, @"5_1.xls"))) try { System.IO.File.Delete(System.IO.Path.Combine(we, @"5_1.xls")); }
                                    catch { }
                                if (System.IO.File.Exists(System.IO.Path.Combine(we, @"5_2.xls"))) try { System.IO.File.Delete(System.IO.Path.Combine(we, @"5_2.xls")); }
                                    catch { }
                                break;
                            case "8":
                                webClient.DownloadFile(setup.writeurl1_1, System.IO.Path.Combine(we, @"1_1.xls"));
                                webClient.DownloadFile(setup.writeurl1_2, System.IO.Path.Combine(we, @"1_2.xls"));
                                webClient.DownloadFile(setup.writeurl2_1, System.IO.Path.Combine(we, @"2_1.xls"));
                                webClient.DownloadFile(setup.writeurl2_2, System.IO.Path.Combine(we, @"2_2.xls"));
                                webClient.DownloadFile(setup.writeurl3_1, System.IO.Path.Combine(we, @"3_1.xls"));
                                webClient.DownloadFile(setup.writeurl3_2, System.IO.Path.Combine(we, @"3_2.xls"));
                                webClient.DownloadFile(setup.writeurl4_1, System.IO.Path.Combine(we, @"4_1.xls"));
                                webClient.DownloadFile(setup.writeurl4_2, System.IO.Path.Combine(we, @"4_2.xls"));
                                if (System.IO.File.Exists(System.IO.Path.Combine(we, @"5_1.xls"))) try { System.IO.File.Delete(System.IO.Path.Combine(we, @"5_1.xls")); }
                                    catch { }
                                if (System.IO.File.Exists(System.IO.Path.Combine(we, @"5_2.xls"))) try { System.IO.File.Delete(System.IO.Path.Combine(we, @"5_2.xls")); }
                                    catch { }
                                break;
                            case "10":
                                webClient.DownloadFile(setup.writeurl1_1, System.IO.Path.Combine(we, @"1_1.xls"));
                                webClient.DownloadFile(setup.writeurl1_2, System.IO.Path.Combine(we, @"1_2.xls"));
                                webClient.DownloadFile(setup.writeurl2_1, System.IO.Path.Combine(we, @"2_1.xls"));
                                webClient.DownloadFile(setup.writeurl2_2, System.IO.Path.Combine(we, @"2_2.xls"));
                                webClient.DownloadFile(setup.writeurl3_1, System.IO.Path.Combine(we, @"3_1.xls"));
                                webClient.DownloadFile(setup.writeurl3_2, System.IO.Path.Combine(we, @"3_2.xls"));
                                webClient.DownloadFile(setup.writeurl4_1, System.IO.Path.Combine(we, @"4_1.xls"));
                                webClient.DownloadFile(setup.writeurl4_2, System.IO.Path.Combine(we, @"4_2.xls"));
                                webClient.DownloadFile(setup.writeurl5_1, System.IO.Path.Combine(we, @"5_1.xls"));
                                webClient.DownloadFile(setup.writeurl5_2, System.IO.Path.Combine(we, @"5_2.xls"));
                                break;
                        }
                    }
                    catch { chatch1 = 1; }
                    return "1";
                });

                if (chatch1 == 1)
                {
                    MessageBox.Show("Ошибка в доступе к серверу: \n a) проверьте подключение к интернету; \n b) запустите программу от имени администратора; \n c) повторите попытку; \n d) если подключение к интернету активно, и вы все равно видите это сообщение то необходимо перезагрузить компьютер.");
                    Label1.Visibility = Visibility.Visible;
                    Label3.Visibility = Visibility.Collapsed;
                    button1.Visibility = Visibility.Visible;
                    button2.Visibility = Visibility.Visible;
                    bar.Visibility = Visibility.Collapsed;
                    bar1.Visibility = Visibility.Collapsed;
                    Label5.Visibility = Visibility.Collapsed;
                    text1.Visibility = Visibility.Collapsed;
                    Label6.Visibility = Visibility.Collapsed;
                    dostupkobrabotke = 1;
                    chatch1 = 0;
                }

                bar1.Value = 10;
                text1.Text = bar1.Value.ToString();
                Label6.Content = "Скачены файлы с сайта ВятГУ, вы можете отключить интернет.";
                if (dostupkobrabotke == 0)
                {
                    otbordata(); 
                    if (obrabotkaisklucheni == 1)
                    {
                        MessageBox.Show("Ошибка в записи в фаил: \n a) проверьте наличие установленного на компьютер Excel; \n  b) перезагрузите компьютер; \n  с) напишите о проблеме разработчику, данные вы найдете в вкладке о программе.");
                        Label1.Visibility = Visibility.Visible;
                        Label3.Visibility = Visibility.Collapsed;
                        button1.Visibility = Visibility.Visible;
                        button2.Visibility = Visibility.Visible;
                        bar.Visibility = Visibility.Collapsed;
                        bar1.Visibility = Visibility.Collapsed;
                        Label5.Visibility = Visibility.Collapsed;
                        text1.Visibility = Visibility.Collapsed;
                        Label6.Visibility = Visibility.Collapsed;
                    }
                }
            }
        }
 private void sbrossetup(object sender, RoutedEventArgs e)
 {
     setup df = new setup();
     df.olldsetup();
     df.savesetup();
     MessageBox.Show("Настройки успешно востановлены!");
 }
Example #5
0
        private void ok(object sender, RoutedEventArgs e)
        {
            Cursor = Cursors.Wait;
            if (ComboBox1.Text == "Выберите курс")
            {
                Cursor = Cursors.Arrow; MessageBox.Show("Пожалуйста выберите курс!");
            }
            else if (ComboBox2.Text == "Выберите неделю")
            {
                Cursor = Cursors.Arrow; MessageBox.Show("Пожалуйста выберите неделю!");
            }
            else if (TextBox.Text == "" || TextBox.Text[0] != 'h' || TextBox.Text[3] != 'p' || TextBox.Text[11] != 'v' || TextBox.Text[16] != 'u')
            {
                Cursor = Cursors.Arrow; MessageBox.Show("Пожалуйста вставьте ссылку или проверьте ее корректность");
            }
            else
            {
                try
                {
                    setup fg = new setup();
                    fg.redfile();
                    string otbor = ComboBox1.Text.ToString() + ComboBox2.Text.ToString();
                    switch (otbor)
                    {
                    case "11":
                        fg.writeurl1_1 = TextBox.Text;
                        break;

                    case "12":
                        fg.writeurl1_2 = TextBox.Text;
                        break;

                    case "21":
                        fg.writeurl2_1 = TextBox.Text;
                        break;

                    case "22":
                        fg.writeurl2_2 = TextBox.Text;
                        break;

                    case "31":
                        fg.writeurl3_1 = TextBox.Text;
                        break;

                    case "32":
                        fg.writeurl3_2 = TextBox.Text;
                        break;

                    case "41":
                        fg.writeurl4_1 = TextBox.Text;
                        break;

                    case "42":
                        fg.writeurl4_2 = TextBox.Text;
                        break;

                    case "51":
                        fg.writeurl5_1 = TextBox.Text;
                        break;

                    case "52":
                        fg.writeurl5_2 = TextBox.Text;
                        break;
                    }
                    fg.savesetup();
                    Close();
                    Cursor = Cursors.Arrow;
                    MessageBox.Show("Ссылка успешно добавлена!");
                }
                catch
                {
                    Cursor = Cursors.Arrow;
                    MessageBox.Show("Пожалуйста проверьте правильность введенной вами ссылки и соеденение с интернетом");
                }
            }
        }
Example #6
0
        private async void ok(object sender, RoutedEventArgs e)
        {
            int dostupkobrabotke = 0;

            button1.Visibility = Visibility.Collapsed;
            button2.Visibility = Visibility.Collapsed;
            Label1.Visibility  = Visibility.Collapsed;
            bar.Visibility     = Visibility.Visible;
            bar1.Visibility    = Visibility.Visible;
            Label3.Visibility  = Visibility.Visible;
            Label5.Visibility  = Visibility.Visible;
            text1.Visibility   = Visibility.Visible;
            Label6.Visibility  = Visibility.Visible;
            try
            {
                string s = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
                this.we = System.IO.Path.Combine(s, @"ProgramData\FreeRooms");
                System.IO.Directory.CreateDirectory(we);
                bar1.Value     = 1;
                text1.Text     = bar1.Value.ToString();
                Label6.Content = "Создана папка для загрузки";
            }
            catch
            {
                MessageBox.Show("ошибка в создании папки для фаила\n  запустите программу от имени администратора!");
                Label1.Visibility  = Visibility.Visible;
                Label3.Visibility  = Visibility.Collapsed;
                button1.Visibility = Visibility.Visible;
                button2.Visibility = Visibility.Visible;
                bar.Visibility     = Visibility.Collapsed;
                bar1.Visibility    = Visibility.Collapsed;
                Label5.Visibility  = Visibility.Collapsed;
                text1.Visibility   = Visibility.Collapsed;
                Label6.Visibility  = Visibility.Collapsed;
                dostupkobrabotke   = 1;
            }
            if (dostupkobrabotke == 0)
            {
                int chatch1 = 0;
                var result  = await Task <string> .Factory.StartNew(() =>
                {
                    try
                    {
                        WebClient webClient = new WebClient();
                        setup setup         = new setup();
                        setup.redfile();
                        switch (setup.colichestvo)
                        {
                        case "0":
                            chatch1 = 1;
                            break;

                        case "2":
                            webClient.DownloadFile(setup.writeurl1_1, System.IO.Path.Combine(we, @"1_1.xls"));
                            webClient.DownloadFile(setup.writeurl1_2, System.IO.Path.Combine(we, @"1_2.xls"));
                            if (System.IO.File.Exists(System.IO.Path.Combine(we, @"2_1.xls")))
                            {
                                try { System.IO.File.Delete(System.IO.Path.Combine(we, @"2_1.xls")); }
                                catch { }
                            }
                            if (System.IO.File.Exists(System.IO.Path.Combine(we, @"2_2.xls")))
                            {
                                try { System.IO.File.Delete(System.IO.Path.Combine(we, @"2_2.xls")); }
                                catch { }
                            }
                            if (System.IO.File.Exists(System.IO.Path.Combine(we, @"3_1.xls")))
                            {
                                try { System.IO.File.Delete(System.IO.Path.Combine(we, @"3_1.xls")); }
                                catch { }
                            }
                            if (System.IO.File.Exists(System.IO.Path.Combine(we, @"3_2.xls")))
                            {
                                try { System.IO.File.Delete(System.IO.Path.Combine(we, @"3_2.xls")); }
                                catch { }
                            }
                            if (System.IO.File.Exists(System.IO.Path.Combine(we, @"4_1.xls")))
                            {
                                try { System.IO.File.Delete(System.IO.Path.Combine(we, @"4_1.xls")); }
                                catch { }
                            }
                            if (System.IO.File.Exists(System.IO.Path.Combine(we, @"4_2.xls")))
                            {
                                try { System.IO.File.Delete(System.IO.Path.Combine(we, @"4_2.xls")); }
                                catch { }
                            }
                            if (System.IO.File.Exists(System.IO.Path.Combine(we, @"5_1.xls")))
                            {
                                try { System.IO.File.Delete(System.IO.Path.Combine(we, @"5_1.xls")); }
                                catch { }
                            }
                            if (System.IO.File.Exists(System.IO.Path.Combine(we, @"5_2.xls")))
                            {
                                try { System.IO.File.Delete(System.IO.Path.Combine(we, @"5_2.xls")); }
                                catch { }
                            }

                            break;

                        case "4":
                            webClient.DownloadFile(setup.writeurl1_1, System.IO.Path.Combine(we, @"1_1.xls"));
                            webClient.DownloadFile(setup.writeurl1_2, System.IO.Path.Combine(we, @"1_2.xls"));
                            webClient.DownloadFile(setup.writeurl2_1, System.IO.Path.Combine(we, @"2_1.xls"));
                            webClient.DownloadFile(setup.writeurl2_2, System.IO.Path.Combine(we, @"2_2.xls"));
                            if (System.IO.File.Exists(System.IO.Path.Combine(we, @"3_1.xls")))
                            {
                                try { System.IO.File.Delete(System.IO.Path.Combine(we, @"3_1.xls")); }
                                catch { }
                            }
                            if (System.IO.File.Exists(System.IO.Path.Combine(we, @"3_2.xls")))
                            {
                                try { System.IO.File.Delete(System.IO.Path.Combine(we, @"3_2.xls")); }
                                catch { }
                            }
                            if (System.IO.File.Exists(System.IO.Path.Combine(we, @"4_1.xls")))
                            {
                                try { System.IO.File.Delete(System.IO.Path.Combine(we, @"4_1.xls")); }
                                catch { }
                            }
                            if (System.IO.File.Exists(System.IO.Path.Combine(we, @"4_2.xls")))
                            {
                                try { System.IO.File.Delete(System.IO.Path.Combine(we, @"4_2.xls")); }
                                catch { }
                            }
                            if (System.IO.File.Exists(System.IO.Path.Combine(we, @"5_1.xls")))
                            {
                                try { System.IO.File.Delete(System.IO.Path.Combine(we, @"5_1.xls")); }
                                catch { }
                            }
                            if (System.IO.File.Exists(System.IO.Path.Combine(we, @"5_2.xls")))
                            {
                                try { System.IO.File.Delete(System.IO.Path.Combine(we, @"5_2.xls")); }
                                catch { }
                            }
                            break;

                        case "6":
                            webClient.DownloadFile(setup.writeurl1_1, System.IO.Path.Combine(we, @"1_1.xls"));
                            webClient.DownloadFile(setup.writeurl1_2, System.IO.Path.Combine(we, @"1_2.xls"));
                            webClient.DownloadFile(setup.writeurl2_1, System.IO.Path.Combine(we, @"2_1.xls"));
                            webClient.DownloadFile(setup.writeurl2_2, System.IO.Path.Combine(we, @"2_2.xls"));
                            webClient.DownloadFile(setup.writeurl3_1, System.IO.Path.Combine(we, @"3_1.xls"));
                            webClient.DownloadFile(setup.writeurl3_2, System.IO.Path.Combine(we, @"3_2.xls"));
                            if (System.IO.File.Exists(System.IO.Path.Combine(we, @"4_1.xls")))
                            {
                                try { System.IO.File.Delete(System.IO.Path.Combine(we, @"4_1.xls")); }
                                catch { }
                            }
                            if (System.IO.File.Exists(System.IO.Path.Combine(we, @"4_2.xls")))
                            {
                                try { System.IO.File.Delete(System.IO.Path.Combine(we, @"4_2.xls")); }
                                catch { }
                            }
                            if (System.IO.File.Exists(System.IO.Path.Combine(we, @"5_1.xls")))
                            {
                                try { System.IO.File.Delete(System.IO.Path.Combine(we, @"5_1.xls")); }
                                catch { }
                            }
                            if (System.IO.File.Exists(System.IO.Path.Combine(we, @"5_2.xls")))
                            {
                                try { System.IO.File.Delete(System.IO.Path.Combine(we, @"5_2.xls")); }
                                catch { }
                            }
                            break;

                        case "8":
                            webClient.DownloadFile(setup.writeurl1_1, System.IO.Path.Combine(we, @"1_1.xls"));
                            webClient.DownloadFile(setup.writeurl1_2, System.IO.Path.Combine(we, @"1_2.xls"));
                            webClient.DownloadFile(setup.writeurl2_1, System.IO.Path.Combine(we, @"2_1.xls"));
                            webClient.DownloadFile(setup.writeurl2_2, System.IO.Path.Combine(we, @"2_2.xls"));
                            webClient.DownloadFile(setup.writeurl3_1, System.IO.Path.Combine(we, @"3_1.xls"));
                            webClient.DownloadFile(setup.writeurl3_2, System.IO.Path.Combine(we, @"3_2.xls"));
                            webClient.DownloadFile(setup.writeurl4_1, System.IO.Path.Combine(we, @"4_1.xls"));
                            webClient.DownloadFile(setup.writeurl4_2, System.IO.Path.Combine(we, @"4_2.xls"));
                            if (System.IO.File.Exists(System.IO.Path.Combine(we, @"5_1.xls")))
                            {
                                try { System.IO.File.Delete(System.IO.Path.Combine(we, @"5_1.xls")); }
                                catch { }
                            }
                            if (System.IO.File.Exists(System.IO.Path.Combine(we, @"5_2.xls")))
                            {
                                try { System.IO.File.Delete(System.IO.Path.Combine(we, @"5_2.xls")); }
                                catch { }
                            }
                            break;

                        case "10":
                            webClient.DownloadFile(setup.writeurl1_1, System.IO.Path.Combine(we, @"1_1.xls"));
                            webClient.DownloadFile(setup.writeurl1_2, System.IO.Path.Combine(we, @"1_2.xls"));
                            webClient.DownloadFile(setup.writeurl2_1, System.IO.Path.Combine(we, @"2_1.xls"));
                            webClient.DownloadFile(setup.writeurl2_2, System.IO.Path.Combine(we, @"2_2.xls"));
                            webClient.DownloadFile(setup.writeurl3_1, System.IO.Path.Combine(we, @"3_1.xls"));
                            webClient.DownloadFile(setup.writeurl3_2, System.IO.Path.Combine(we, @"3_2.xls"));
                            webClient.DownloadFile(setup.writeurl4_1, System.IO.Path.Combine(we, @"4_1.xls"));
                            webClient.DownloadFile(setup.writeurl4_2, System.IO.Path.Combine(we, @"4_2.xls"));
                            webClient.DownloadFile(setup.writeurl5_1, System.IO.Path.Combine(we, @"5_1.xls"));
                            webClient.DownloadFile(setup.writeurl5_2, System.IO.Path.Combine(we, @"5_2.xls"));
                            break;
                        }
                    }
                    catch { chatch1 = 1; }
                    return("1");
                });

                if (chatch1 == 1)
                {
                    MessageBox.Show("Ошибка в доступе к серверу: \n a) проверьте подключение к интернету; \n b) запустите программу от имени администратора; \n c) повторите попытку; \n d) если подключение к интернету активно, и вы все равно видите это сообщение то необходимо перезагрузить компьютер.");
                    Label1.Visibility  = Visibility.Visible;
                    Label3.Visibility  = Visibility.Collapsed;
                    button1.Visibility = Visibility.Visible;
                    button2.Visibility = Visibility.Visible;
                    bar.Visibility     = Visibility.Collapsed;
                    bar1.Visibility    = Visibility.Collapsed;
                    Label5.Visibility  = Visibility.Collapsed;
                    text1.Visibility   = Visibility.Collapsed;
                    Label6.Visibility  = Visibility.Collapsed;
                    dostupkobrabotke   = 1;
                    chatch1            = 0;
                }

                bar1.Value     = 10;
                text1.Text     = bar1.Value.ToString();
                Label6.Content = "Скачены файлы с сайта ВятГУ, вы можете отключить интернет.";
                if (dostupkobrabotke == 0)
                {
                    otbordata();
                    if (obrabotkaisklucheni == 1)
                    {
                        MessageBox.Show("Ошибка в записи в фаил: \n a) проверьте наличие установленного на компьютер Excel; \n  b) перезагрузите компьютер; \n  с) напишите о проблеме разработчику, данные вы найдете в вкладке о программе.");
                        Label1.Visibility  = Visibility.Visible;
                        Label3.Visibility  = Visibility.Collapsed;
                        button1.Visibility = Visibility.Visible;
                        button2.Visibility = Visibility.Visible;
                        bar.Visibility     = Visibility.Collapsed;
                        bar1.Visibility    = Visibility.Collapsed;
                        Label5.Visibility  = Visibility.Collapsed;
                        text1.Visibility   = Visibility.Collapsed;
                        Label6.Visibility  = Visibility.Collapsed;
                    }
                }
            }
        }