/// <summary> /// Login button /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void LoginBtn_Click(object sender, EventArgs e) { #if DEBUG var interConvert = Convert.ToInt32(99); MainView main = new MainView(2, interConvert, "Test"); this.Hide(); main.Closed += (s, args) => this.Close(); main.Show(); #else if (checkIfPassWordExists(usernameTextBox.Text) == true) { int value; if (int.TryParse(IntercomID.Text, out value)) { var userName = usernameTextBox.Text; var password = passwordTextBox.Text; var intercom = IntercomID.Text; if (checkLogin(userName, password, intercom) == true) // Open new form { var level = 4; var level = Convert.ToInt32(MySQLHandler.getUserLevel(userName)); var interConvert = Convert.ToInt32(intercom); MainView main = new MainView(level, interConvert, userName); this.Hide(); main.Closed += (s, args) => this.Close(); main.Show(); if (!NewsMySQLHandler.checkIfDisplayNews(userName)) { NewsForm news = new NewsForm(userName); news.Show(); // disp news popup } } else { errorLabel.Visible = true; } } else { errorLabel2.Visible = true; } } else { if (userController.checkIfUserExists(usernameTextBox.Text)) { View.ChoosePassPormpt cpp = new View.ChoosePassPormpt(usernameTextBox.Text); cpp.Show(); } else { MessageBox.Show("Användaren finns inte"); } } #endif }
private void getNews() { try { var InfoBlob = NewsMySQLHandler.getNews(); Font fon = new Font("Palatino Linotype", 12.0f); newsBrowser.Font = fon; newsBrowser.Navigate("about:blank"); newsBrowser.Document.Encoding = "utf-8"; HtmlDocument doc2 = newsBrowser.Document; doc2.Write(String.Empty); newsBrowser.DocumentText = InfoBlob; } catch (Exception e) { Console.WriteLine(e); } }
private void closeNewsPromptBtn_Click(object sender, EventArgs e) { NewsMySQLHandler.updateReadNews(userName); this.Close(); }