本文整理汇总了C#中MainPage.Show方法的典型用法代码示例。如果您正苦于以下问题:C# MainPage.Show方法的具体用法?C# MainPage.Show怎么用?C# MainPage.Show使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MainPage
的用法示例。
在下文中一共展示了MainPage.Show方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LoginButton_Click
private void LoginButton_Click(object sender, EventArgs e)
{
// mySQLconnection.Open();
/*
MySqlCommand mySQLcommand = new MySqlCommand("SELECT * FROM SUser WHERE username = @username AND password = @password");
if (this.OpenConnection() == true)
{
mySQLcommand.Parameters.AddWithValue("username", UsernameTextBox.Text);
mySQLcommand.Parameters.AddWithValue("password", PasswordTextBox.Text);
MySqlDataReader dataReader = mySQLcommand.ExecuteReader();
while(dataReader.Read())
{
mainpage = new MainPage();
mainpage.Show();
}
dataReader.Close();
}
//mainpage = new MainPage();
// mainpage.Show();
* */
DBConnect db = new DBConnect();
DataTable dataTable = db.GetUser(PasswordTextBox.Text, UsernameTextBox.Text);
if (dataTable != null)
{
mainpage = new MainPage();
mainpage.Show();
//MessageBox.Show(dataTable.ToString());
}
else MessageBox.Show("Noe gikk galt");
}
示例2: Image_MouseLeftButtonDown
private void Image_MouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
// TODO: Add event handler implementation here.
MainPage mainPage = new MainPage();
mainPage.Show();
this.Close();
}
示例3: backButton_Click
private void backButton_Click(object sender, System.Windows.RoutedEventArgs e)
{
MainPage w1 = new MainPage();
Window parent = Window.GetWindow(this);
parent.Close();
w1.Show();
}
示例4: btnSubmit_Click
private void btnSubmit_Click(object sender, EventArgs e)
{
if (txtName.Text == "pawan")
{
//this.Close();
MainPage obj = new MainPage();
obj.Show();
this.Hide();
}
}
示例5: loginButton_Click
private void loginButton_Click(object sender, RoutedEventArgs e)
{
MessageBox.Show("Login Successful", "Welcome, " + usernameTextBox.Text);
MainPage w1 = new MainPage();
Window parent = Window.GetWindow(this);
parent.Close();
w1.Show();
}
示例6: checkSuccess
private void checkSuccess()
{
string userName = tbUserName.Text;
string password = tbPassWord.Password;
if ((bool)isAutoSave.IsChecked) {
IniHelper.WriteINI("userlogin", new string[] { "username", "password", "autosave" }, new string[] { userName, password, "1" });
}
else {
IniHelper.WriteINI("userlogin", new string[] { "username", "password", "autosave" }, new string[] { "", "", "0" });
}
this.Hide();
MainPage mainpage = new MainPage();
mainpage.Show();
mainpage.Activate();
mainpage.menu.SetUserName(userName);
lbErrorMsg.Visibility = Visibility.Hidden;
}
示例7: button1_Click
private void button1_Click(object sender, EventArgs e)
{
NpgsqlConnection conn = new NpgsqlConnection("Server=webblabb.miun.se;Port=5432;Database=grp3vt13;User Id=grp3vt13;Password=XmFGFwX6t;SSL=true");
try
{
conn.Open();
NpgsqlCommand command1 = new NpgsqlCommand("SELECT password, firstname FROM staff WHERE firstname = ('" + txtUser.Text + "')", conn);
//hämtar alla användare som heter t.ex "Björn", detta kan ersättas med unikare saker, t.ex mail
object objPassword = command1.ExecuteScalar(); //= är lösenordet för Björn
string stringPassword = Convert.ToString(objPassword);
if (!string.IsNullOrEmpty("" + stringPassword))
{
if (stringPassword == txtPassword.Text)
{
MainPage mp = new MainPage();
mp.Show();
this.Hide();
}
else
{
MessageBox.Show("Användarnamn eller lösenord felaktigt. vänligen försök igen (lösen)");
}
}
else
{
MessageBox.Show("Användarnamn eller lösenord felaktigt. vänligen försök igen (lösen/användarnamn)");
}
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
finally
{
conn.Close();
}
}
示例8: Login_Click
private void Login_Click(object sender, EventArgs e)
{
int result = sr.checkUser(Username.Text, Password.Text, PostalCode.Text);
if (result == 0)
{
/*
Response.Cookies["username"].Value = UsernameText.Text;
Session["sessionName"] = UsernameText.Text;
Response.Redirect("MainPage.aspx");*/
this.Hide();
MainPage f2 = new MainPage();
f2.Size = new System.Drawing.Size(900, 563);
f2.Show();
}
if (result == -1)
MessageBox.Show("Wrong Username/Not registered");
if (result == -2)
MessageBox.Show("Wrong Password");
if (result == 1)
MessageBox.Show("unexpected errorrrererrr");
}
示例9: button_Return_Click
private void button_Return_Click(object sender, EventArgs e)
{
MainPage mainPage = new MainPage();
mainPage.Show();
}
示例10: InitView
public bool InitView(MainPage main)
{
main.Show(this);
return true;
}
示例11: BackButton_Click
private void BackButton_Click(object sender, RoutedEventArgs e)
{
MainPage mainPage = new MainPage();
mainPage.Show();
this.Close();
}
示例12: enterButton_Click
private void enterButton_Click(object sender, EventArgs e)
{
string username = usernameBox.Text;
string password = passwordBox.Text;
string temp = username + password;
if (!MainPage.IsLetterOrDigit(temp))
{
MessageBox.Show("Restrict your input to letters and numbers. Or else.");
return;
}
string connectionString = "user id=CSSE333-201212-SuperSmashBros;" +
"Password=supersmashbros;" +
"server=whale.cs.rose-hulman.edu;" +
"Trusted_Connection=no;" +
"Database=SuperSmashBros;" +
"connection timeout=30;" +
"TrustServerCertificate=true";
SqlConnection connection = null;
SqlDataReader sdr = null;
try
{
connection = new SqlConnection(connectionString);
connection.Open();
string cmd = "LoginPlayer";
//"SELECT * " +
//"FROM PLAYER AS p " +
//"WHERE p.Username = \'" + username + "\' AND p.Password = \'" + password + "\'";
SqlCommand command = new SqlCommand(cmd, connection);
command.CommandType = CommandType.StoredProcedure;
SqlParameter retval = new SqlParameter("@Return_Value", SqlDbType.Int);
retval.Direction = ParameterDirection.ReturnValue;
retval.Value = -1;
string hashpasswd = MainPage.GetSHAHash("Richard!" + username + "[email protected]" + password + "Seth#");
command.Parameters.Add(new SqlParameter("@pUsername", username));
command.Parameters.Add(new SqlParameter("@pPassword", hashpasswd));
command.Parameters.Add(retval);
command.ExecuteNonQuery();
int success = Int32.Parse(retval.Value.ToString());
if (success > 0)
{
connection.Close();
connection.Dispose();
MainPage main = new MainPage(this, username, hashpasswd);
main.Show();
this.Hide();
}
else
MessageBox.Show("Login failed. Try again or register!");
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
finally
{
if (null != connection)
{
connection.Close();
connection.Dispose();
}
if (null != sdr)
{
sdr.Close();
}
}
}