/// <summary> /// Инициализируем главную форму /// </summary> /// <param name="args">аргументы прилдожения</param> public MainForm(string[] args = null) { //Инициализируем нашу форму. Отрисовываем все органы управления InitializeComponent(); form = this; //Создаем экземляр формы настроек OptionsForm optionsForm = new OptionsForm(); //По умолчанию выставляем браузер Firefox cbBrowsers.SelectedIndex = cbBrowsers.FindString("FireFox"); //Обработчики tcMain.Selected += new System.Windows.Forms.TabControlEventHandler(this.tc_TabSelect_Log); cbUrlsCheckPageOnErrors.CheckedChanged += new System.EventHandler(this.cbCheckUrl1_VisibleChild); cmbboxConnType.TextChanged += new System.EventHandler(this.cmbboxConnType_TextChanged); cmbboxConnType.TextChanged += new System.EventHandler(this.cmbboxConnType_TextChanged1); //Значение по умолчанию для типа подключения на закладке SQL cmbboxConnType.SelectedIndex = 0; //По умолчанию лог включен а DataGridView выключен dataGVResult.Visible = false; tbLog.Visible = true; //Дописываем последний лог в файл-архив if (File.Exists(Shared.StartupPath + "log.html")) { File.AppendAllText(Shared.StartupPath + "ArchiveLog.html", File.ReadAllText(Shared.StartupPath + "log.html")); File.Delete(Shared.StartupPath + "log.html"); } //начинаем работу //выводим в лог информацию о запуске Log.PlainTextToHTMLLog("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">"); Log.PlainTextToHTMLLog("<div style=\"margin: 50px 0px 0px 50px;\"></div>"); Log.PlainTextToHTMLLog("<head><style>.plus, .minus { display: inline-block; padding-left: 20px;}.plus { background: url(plus.gif) no-repeat 5px 5px;} .minus { background: url(minus.gif) no-repeat 5px 5px; }</style><script>function collapse(id, link){var block = document.getElementById(id); if (block.style.display == \"none\"){block.style.display = \"block\";link.className = \"minus\"; }else{block.style.display = \"none\";link.className = \"plus\";}return false;}function collapseSpan(id, link){var block = document.getElementById(id);if (block.style.display == \"none\"){block.style.display = \"block\";}else{block.style.display =\"none\";}return false;}</script></head>"); Log.MesNormal("============ новая сессия " + DateTime.Now + " ============", false); Log.Gap(); //Читаем файл с настройками XmlDocument reader = new XmlDocument(); reader.Load("options.xml"); //Если файла с настройками нет, создадим пустой файл if (File.Exists("options.xml") == false) { File.Create("options.xml"); } //Выводим на форму несколько параметров для урлчекера из файла с настройками MainForm.form.tbCheckUrlsUrlToCheck.Text = reader.GetValue("/Options/CheckUrls_options/url"); MainForm.form.tbCheckUrlsLogin.Text = reader.GetValue("/Options/CheckUrls_options/login"); MainForm.form.tbCheckUrlsPass.Text = reader.GetValue("/Options/CheckUrls_options/password"); }
/// <summary> /// Инициализируем главную форму /// </summary> /// <param name="args">аргументы прилдожения</param> public MainForm(string[] args = null) { InitializeComponent(); form = this; OptionsForm optionsForm = new OptionsForm(); cbBrowsers.SelectedIndex = cbBrowsers.FindString("FireFox"); tcMain.Selected += new System.Windows.Forms.TabControlEventHandler(this.tc_TabSelect_Log); cbUrlsCheckPageOnErrors.CheckedChanged += new System.EventHandler(this.cbCheckUrl1_VisibleChild); cmbboxConnType.TextChanged += new System.EventHandler(this.cmbboxConnType_TextChanged); cmbboxConnType.TextChanged += new System.EventHandler(this.cmbboxConnType_TextChanged1); Shared.browserName = MainForm.form.cbBrowsers.SelectedItem.ToString(); cmbboxConnType.SelectedIndex = 0; dataGVResult.Visible = false; tbLog.Visible = true; //перемещаем последний лог в архив if (File.Exists(Shared.StartupPath + "log.html")) { File.AppendAllText(Shared.StartupPath + "ArchiveLog.html", File.ReadAllText(Shared.StartupPath + "log.html")); File.Delete(Shared.StartupPath + "log.html"); } //начинаем работу //Log.Gap(); Log.PlainTextToHTMLLog("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">"); Log.PlainTextToHTMLLog("<div style=\"margin: 50px 0px 0px 50px;\"></div>"); Log.PlainTextToHTMLLog("<head><style>.plus, .minus { display: inline-block; padding-left: 20px;}.plus { background: url(plus.gif) no-repeat 5px 5px;} .minus { background: url(minus.gif) no-repeat 5px 5px; }</style><script>function collapse(id, link){var block = document.getElementById(id); if (block.style.display == \"none\"){block.style.display = \"block\";link.className = \"minus\"; }else{block.style.display = \"none\";link.className = \"plus\";}return false;}function collapseSpan(id, link){var block = document.getElementById(id);if (block.style.display == \"none\"){block.style.display = \"block\";}else{block.style.display =\"none\";}return false;}</script></head>"); Log.MesNormal("============ новая сессия " + DateTime.Now + " ============", false); Log.Gap(); XmlDocument reader = new XmlDocument(); reader.Load("options.xml"); if (File.Exists("options.xml") == false) { File.Create("options.xml"); } MainForm.form.tbCheckUrlsUrlToCheck.Text = reader.GetValue("/Options/CheckUrls_options/url"); MainForm.form.tbCheckUrlsLogin.Text = reader.GetValue("/Options/CheckUrls_options/login"); MainForm.form.tbCheckUrlsPass.Text = reader.GetValue("/Options/CheckUrls_options/password"); }
/// <summary> /// Инициализируем главную форму /// </summary> /// <param name="args">аргументы прилдожения</param> public MainForm(string[] args = null) { InitializeComponent(); form = this; OptionsForm optionsForm = new OptionsForm(); cbBrowsers.SelectedIndex = cbBrowsers.FindString("FireFox"); tcMain.Selected += new System.Windows.Forms.TabControlEventHandler(this.tc_TabSelect_Log); cbUrlsCheckPageOnErrors.CheckedChanged += new System.EventHandler(this.cbCheckUrl1_VisibleChild); cmbboxConnType.TextChanged += new System.EventHandler(this.cmbboxConnType_TextChanged); cmbboxConnType.TextChanged += new System.EventHandler(this.cmbboxConnType_TextChanged1); Shared.browserName = MainForm.form.cbBrowsers.SelectedItem.ToString(); cmbboxConnType.SelectedIndex = 0; dataGVResult.Visible = false; tbLog.Visible = true; //перемещаем последний лог в архив if (File.Exists(Shared.StartupPath + "log.html")) { File.AppendAllText(Shared.StartupPath + "ArchiveLog.html", File.ReadAllText(Shared.StartupPath + "log.html")); File.Delete(Shared.StartupPath + "log.html"); } //начинаем работу //Log.Gap(); Log.PlainTextToHTMLLog("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">"); Log.PlainTextToHTMLLog("<div style=\"margin: 50px 0px 0px 50px;\"></div>"); Log.PlainTextToHTMLLog("<head><style>.plus, .minus { display: inline-block; padding-left: 20px;}.plus { background: url(plus.gif) no-repeat 5px 5px;} .minus { background: url(minus.gif) no-repeat 5px 5px; }</style><script>function collapse(id, link){var block = document.getElementById(id); if (block.style.display == \"none\"){block.style.display = \"block\";link.className = \"minus\"; }else{block.style.display = \"none\";link.className = \"plus\";}return false;}function collapseSpan(id, link){var block = document.getElementById(id);if (block.style.display == \"none\"){block.style.display = \"block\";}else{block.style.display =\"none\";}return false;}</script></head>"); Log.MesNormal("============ новая сессия " + DateTime.Now + " ============", false); Log.Gap(); XmlDocument reader = new XmlDocument(); reader.Load("options.xml"); if (File.Exists("options.xml") == false) File.Create("options.xml"); MainForm.form.tbCheckUrlsUrlToCheck.Text = reader.GetValue("/Options/CheckUrls_options/url"); MainForm.form.tbCheckUrlsLogin.Text = reader.GetValue("/Options/CheckUrls_options/login"); MainForm.form.tbCheckUrlsPass.Text = reader.GetValue("/Options/CheckUrls_options/password"); }
/// <summary> /// Форма настроек /// </summary> public OptionsForm() { InitializeComponent(); form = this; }