diff --git a/Tariffs/Form1.Designer.cs b/Tariffs/Form1.Designer.cs
index 76da44e..31fd697 100644
--- a/Tariffs/Form1.Designer.cs
+++ b/Tariffs/Form1.Designer.cs
@@ -45,15 +45,6 @@
this.tabControl1 = new System.Windows.Forms.TabControl();
this.tabPage1 = new System.Windows.Forms.TabPage();
this.dataGridView1 = new System.Windows.Forms.DataGridView();
- this.tabPage2 = new System.Windows.Forms.TabPage();
- this.tabPage3 = new System.Windows.Forms.TabPage();
- this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
- this.button1 = new System.Windows.Forms.Button();
- this.button2 = new System.Windows.Forms.Button();
- this.button3 = new System.Windows.Forms.Button();
- this.button4 = new System.Windows.Forms.Button();
- this.button5 = new System.Windows.Forms.Button();
- this.button6 = new System.Windows.Forms.Button();
this.toCompare = new System.Windows.Forms.DataGridViewCheckBoxColumn();
this.Column1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Column2 = new System.Windows.Forms.DataGridViewTextBoxColumn();
@@ -63,6 +54,15 @@
this.Column6 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Column7 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Column8 = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.tabPage2 = new System.Windows.Forms.TabPage();
+ this.tabPage3 = new System.Windows.Forms.TabPage();
+ this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
+ this.button1 = new System.Windows.Forms.Button();
+ this.button2 = new System.Windows.Forms.Button();
+ this.button3 = new System.Windows.Forms.Button();
+ this.button4 = new System.Windows.Forms.Button();
+ this.button5 = new System.Windows.Forms.Button();
+ this.button6 = new System.Windows.Forms.Button();
this.menuStrip1.SuspendLayout();
this.tabControl1.SuspendLayout();
this.tabPage1.SuspendLayout();
@@ -95,13 +95,13 @@
// обновитьToolStripMenuItem
//
this.обновитьToolStripMenuItem.Name = "обновитьToolStripMenuItem";
- this.обновитьToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
+ this.обновитьToolStripMenuItem.Size = new System.Drawing.Size(128, 22);
this.обновитьToolStripMenuItem.Text = "Обновить";
//
// выходToolStripMenuItem
//
this.выходToolStripMenuItem.Name = "выходToolStripMenuItem";
- this.выходToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
+ this.выходToolStripMenuItem.Size = new System.Drawing.Size(128, 22);
this.выходToolStripMenuItem.Text = "Выход";
this.выходToolStripMenuItem.Click += new System.EventHandler(this.CloseProgram);
//
@@ -121,7 +121,7 @@
this.нижегородскаяОбластьToolStripMenuItem,
this.ульяновскаяОбластьToolStripMenuItem});
this.регионToolStripMenuItem.Name = "регионToolStripMenuItem";
- this.регионToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
+ this.регионToolStripMenuItem.Size = new System.Drawing.Size(113, 22);
this.регионToolStripMenuItem.Text = "Регион";
//
// московскаяОбластьToolStripMenuItem
@@ -160,14 +160,14 @@
// оНасToolStripMenuItem
//
this.оНасToolStripMenuItem.Name = "оНасToolStripMenuItem";
- this.оНасToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
+ this.оНасToolStripMenuItem.Size = new System.Drawing.Size(149, 22);
this.оНасToolStripMenuItem.Text = "О нас";
this.оНасToolStripMenuItem.Click += new System.EventHandler(this.оНасToolStripMenuItem_Click);
//
// оПрограммеToolStripMenuItem
//
this.оПрограммеToolStripMenuItem.Name = "оПрограммеToolStripMenuItem";
- this.оПрограммеToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
+ this.оПрограммеToolStripMenuItem.Size = new System.Drawing.Size(149, 22);
this.оПрограммеToolStripMenuItem.Text = "О программе";
this.оПрограммеToolStripMenuItem.Click += new System.EventHandler(this.оПрограммеToolStripMenuItem_Click);
//
@@ -211,12 +211,61 @@
this.dataGridView1.Size = new System.Drawing.Size(779, 287);
this.dataGridView1.TabIndex = 0;
//
+ // toCompare
+ //
+ this.toCompare.HeaderText = "CMP";
+ this.toCompare.Name = "toCompare";
+ this.toCompare.Resizable = System.Windows.Forms.DataGridViewTriState.True;
+ this.toCompare.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
+ this.toCompare.ToolTipText = "Сравнение";
+ this.toCompare.Width = 35;
+ //
+ // Column1
+ //
+ this.Column1.HeaderText = "Оператор";
+ this.Column1.Name = "Column1";
+ //
+ // Column2
+ //
+ this.Column2.HeaderText = "Тариф";
+ this.Column2.Name = "Column2";
+ //
+ // Column3
+ //
+ this.Column3.HeaderText = "Звонки (мин)";
+ this.Column3.Name = "Column3";
+ //
+ // Column4
+ //
+ this.Column4.HeaderText = "SMS";
+ this.Column4.Name = "Column4";
+ //
+ // Column5
+ //
+ this.Column5.HeaderText = "MMS";
+ this.Column5.Name = "Column5";
+ //
+ // Column6
+ //
+ this.Column6.HeaderText = "Интернет (МБ/ГБ)";
+ this.Column6.Name = "Column6";
+ //
+ // Column7
+ //
+ this.Column7.HeaderText = "Абон. плата";
+ this.Column7.Name = "Column7";
+ //
+ // Column8
+ //
+ this.Column8.HeaderText = "Правила";
+ this.Column8.Name = "Column8";
+ //
// tabPage2
//
this.tabPage2.Location = new System.Drawing.Point(4, 22);
this.tabPage2.Name = "tabPage2";
this.tabPage2.Padding = new System.Windows.Forms.Padding(3);
- this.tabPage2.Size = new System.Drawing.Size(730, 287);
+ this.tabPage2.Size = new System.Drawing.Size(775, 287);
this.tabPage2.TabIndex = 1;
this.tabPage2.Text = "Сравнение";
this.tabPage2.UseVisualStyleBackColor = true;
@@ -226,7 +275,7 @@
this.tabPage3.Controls.Add(this.tableLayoutPanel1);
this.tabPage3.Location = new System.Drawing.Point(4, 22);
this.tabPage3.Name = "tabPage3";
- this.tabPage3.Size = new System.Drawing.Size(730, 287);
+ this.tabPage3.Size = new System.Drawing.Size(775, 287);
this.tabPage3.TabIndex = 2;
this.tabPage3.Text = "Панель сайтов";
this.tabPage3.UseVisualStyleBackColor = true;
@@ -305,55 +354,6 @@
this.button6.Text = "GitHub - Страница проекта";
this.button6.UseVisualStyleBackColor = true;
//
- // toCompare
- //
- this.toCompare.HeaderText = "CMP";
- this.toCompare.Name = "toCompare";
- this.toCompare.Resizable = System.Windows.Forms.DataGridViewTriState.True;
- this.toCompare.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
- this.toCompare.ToolTipText = "Сравнение";
- this.toCompare.Width = 35;
- //
- // Column1
- //
- this.Column1.HeaderText = "Оператор";
- this.Column1.Name = "Column1";
- //
- // Column2
- //
- this.Column2.HeaderText = "Тариф";
- this.Column2.Name = "Column2";
- //
- // Column3
- //
- this.Column3.HeaderText = "Звонки (мин)";
- this.Column3.Name = "Column3";
- //
- // Column4
- //
- this.Column4.HeaderText = "SMS";
- this.Column4.Name = "Column4";
- //
- // Column5
- //
- this.Column5.HeaderText = "MMS";
- this.Column5.Name = "Column5";
- //
- // Column6
- //
- this.Column6.HeaderText = "Интернет (МБ/ГБ)";
- this.Column6.Name = "Column6";
- //
- // Column7
- //
- this.Column7.HeaderText = "Абон. плата";
- this.Column7.Name = "Column7";
- //
- // Column8
- //
- this.Column8.HeaderText = "Правила";
- this.Column8.Name = "Column8";
- //
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@@ -365,6 +365,7 @@
this.MainMenuStrip = this.menuStrip1;
this.Name = "Form1";
this.Text = "Tariffs";
+ this.Load += new System.EventHandler(this.Form1_Load);
this.menuStrip1.ResumeLayout(false);
this.menuStrip1.PerformLayout();
this.tabControl1.ResumeLayout(false);
diff --git a/Tariffs/Form1.cs b/Tariffs/Form1.cs
index d0361fa..822b252 100644
--- a/Tariffs/Form1.cs
+++ b/Tariffs/Form1.cs
@@ -1,4 +1,6 @@
using System;
+using System.IO;
+using System.Net;
using System.Windows.Forms;
namespace Tariffs
@@ -28,5 +30,80 @@ namespace Tariffs
ProgramHelp f2 = new ProgramHelp();
f2.Show();
}
+
+ private void Form1_Load(object sender, EventArgs e)
+ {
+ WebClient client = new WebClient();
+ String remoteFile = "https://tariffslist.000webhostapp.com/list.txt";
+
+ if (!File.Exists("list.txt"))
+ {
+ _ = File.Create("list.txt");
+ }
+
+ try
+ {
+ client.DownloadFile(remoteFile, "list.txt");
+ }
+ catch (WebException)
+ {
+ String clickedButton = MessageBox.Show("Не удалось получить сведения о тарифах с сервера.\n" +
+ "Поиск кэшированного файла...",
+ "Ошибка", MessageBoxButtons.AbortRetryIgnore,
+ MessageBoxIcon.Error).ToString();
+
+ if (clickedButton == "Abort")
+ {
+ Close();
+ }
+ if (clickedButton == "Retry")
+ {
+ try
+ {
+ client.DownloadFile(remoteFile, "list.txt");
+ }
+ catch (WebException)
+ {
+ _ = MessageBox.Show("Возможно, у Вас нет подключения к Интернету,\n" +
+ "или адрес к веб-серверу был неверно указан разработчиком.\n" +
+ "Приложение будет закрыто.",
+ "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ Close();
+ }
+ }
+ if (clickedButton == "Ignore")
+ {
+ if (File.Exists("list.txt"))
+ {
+ StreamReader s = new StreamReader("list.txt");
+ String firstcode = s.ReadLine();
+ if (!(firstcode == "Tariffs"))
+ {
+ _ = MessageBox.Show("Неверный тип файла!\n\n" +
+ "Так как невозможно загрузить тарифы,\n" +
+ "Приложение будет закрыто.",
+ "Ошибка",
+ MessageBoxButtons.OK,
+ MessageBoxIcon.Warning);
+ s.Close();
+ Close();
+ }
+ s.Close();
+ }
+ else
+ {
+ _ = MessageBox.Show("Файл почему-то не найден!\n" +
+ "Приложение будет закрыто.",
+ "Ошибка",
+ MessageBoxButtons.OK,
+ MessageBoxIcon.Error);
+ Close();
+ }
+ }
+ }
+
+ StreamReader listfile = new StreamReader("list.txt");
+ listfile.Close();
+ }
}
}
diff --git a/Tariffs/Form1.resx b/Tariffs/Form1.resx
index 3f76444..f9ba10d 100644
--- a/Tariffs/Form1.resx
+++ b/Tariffs/Form1.resx
@@ -147,33 +147,6 @@
True
-
- True
-
-
- True
-
-
- True
-
-
- True
-
-
- True
-
-
- True
-
-
- True
-
-
- True
-
-
- True
-
37
diff --git a/Tariffs/bin/Debug/Tariffs.exe b/Tariffs/bin/Debug/Tariffs.exe
index 7b90a1e..e23f9c5 100644
Binary files a/Tariffs/bin/Debug/Tariffs.exe and b/Tariffs/bin/Debug/Tariffs.exe differ
diff --git a/Tariffs/bin/Debug/Tariffs.pdb b/Tariffs/bin/Debug/Tariffs.pdb
index 662932b..7ee6de7 100644
Binary files a/Tariffs/bin/Debug/Tariffs.pdb and b/Tariffs/bin/Debug/Tariffs.pdb differ
diff --git a/Tariffs/obj/Debug/Tariffs.csproj.FileListAbsolute.txt b/Tariffs/obj/Debug/Tariffs.csproj.FileListAbsolute.txt
index 053f76c..49117c8 100644
--- a/Tariffs/obj/Debug/Tariffs.csproj.FileListAbsolute.txt
+++ b/Tariffs/obj/Debug/Tariffs.csproj.FileListAbsolute.txt
@@ -8,3 +8,13 @@ C:\Users\user\source\repos\Tariffs\Tariffs\obj\Debug\Tariffs.Properties.Resource
C:\Users\user\source\repos\Tariffs\Tariffs\obj\Debug\Tariffs.csproj.GenerateResource.cache
C:\Users\user\source\repos\Tariffs\Tariffs\obj\Debug\Tariffs.exe
C:\Users\user\source\repos\Tariffs\Tariffs\obj\Debug\Tariffs.pdb
+C:\Users\Acer\VisualStudio\source\repos\Tariff\Tariffs\bin\Debug\Tariffs.exe.config
+C:\Users\Acer\VisualStudio\source\repos\Tariff\Tariffs\bin\Debug\Tariffs.exe
+C:\Users\Acer\VisualStudio\source\repos\Tariff\Tariffs\bin\Debug\Tariffs.pdb
+C:\Users\Acer\VisualStudio\source\repos\Tariff\Tariffs\obj\Debug\Tariffs.csprojAssemblyReference.cache
+C:\Users\Acer\VisualStudio\source\repos\Tariff\Tariffs\obj\Debug\Tariffs.Form1.resources
+C:\Users\Acer\VisualStudio\source\repos\Tariff\Tariffs\obj\Debug\Tariffs.ProgramHelp.resources
+C:\Users\Acer\VisualStudio\source\repos\Tariff\Tariffs\obj\Debug\Tariffs.Properties.Resources.resources
+C:\Users\Acer\VisualStudio\source\repos\Tariff\Tariffs\obj\Debug\Tariffs.csproj.GenerateResource.cache
+C:\Users\Acer\VisualStudio\source\repos\Tariff\Tariffs\obj\Debug\Tariffs.exe
+C:\Users\Acer\VisualStudio\source\repos\Tariff\Tariffs\obj\Debug\Tariffs.pdb
diff --git a/Tariffs/obj/Debug/Tariffs.csproj.GenerateResource.cache b/Tariffs/obj/Debug/Tariffs.csproj.GenerateResource.cache
index db4cc1e..65a8de8 100644
Binary files a/Tariffs/obj/Debug/Tariffs.csproj.GenerateResource.cache and b/Tariffs/obj/Debug/Tariffs.csproj.GenerateResource.cache differ
diff --git a/Tariffs/obj/Debug/Tariffs.csprojAssemblyReference.cache b/Tariffs/obj/Debug/Tariffs.csprojAssemblyReference.cache
index e8c7d42..97e8ea7 100644
Binary files a/Tariffs/obj/Debug/Tariffs.csprojAssemblyReference.cache and b/Tariffs/obj/Debug/Tariffs.csprojAssemblyReference.cache differ
diff --git a/Tariffs/obj/Debug/Tariffs.exe b/Tariffs/obj/Debug/Tariffs.exe
index 7b90a1e..e23f9c5 100644
Binary files a/Tariffs/obj/Debug/Tariffs.exe and b/Tariffs/obj/Debug/Tariffs.exe differ
diff --git a/Tariffs/obj/Debug/Tariffs.pdb b/Tariffs/obj/Debug/Tariffs.pdb
index 662932b..7ee6de7 100644
Binary files a/Tariffs/obj/Debug/Tariffs.pdb and b/Tariffs/obj/Debug/Tariffs.pdb differ