本文整理汇总了C#中MainPage.ShowDialog方法的典型用法代码示例。如果您正苦于以下问题:C# MainPage.ShowDialog方法的具体用法?C# MainPage.ShowDialog怎么用?C# MainPage.ShowDialog使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MainPage
的用法示例。
在下文中一共展示了MainPage.ShowDialog方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ValidateAndLogin
public void ValidateAndLogin(string user, string password)
{
if(getCurrentUsers().Contains(user))
{
string userFile = user + ".txt";
using(StreamReader sr = new StreamReader(userFile))
{
string formatLine = sr.ReadLine();
string username = sr.ReadLine();
string encryptedPassword;
if(formatLine == "USER" && user == username)
{
encryptedPassword = sr.ReadLine();
}
else
{
return;
}
if (password == AESThenHMAC.SimpleDecryptWithPassword(encryptedPassword, "passwordpassword"))
{
this.Hide();
sr.Close();
MainPage mainPage = new MainPage(txtUser.Text, txtPassword.Text);
mainPage.ShowDialog();
}
else
{
txtUser.Text = "password missmatch";
txtPassword.Text = "";
return;
}
}
}
}
示例2: returnMain
private void returnMain()
{
MainPage mainPage = new MainPage();
mainPage.ShowDialog();
}
示例3: btnNewUser_Click
private void btnNewUser_Click(object sender, EventArgs e)
{
string newUserFile = txtUser.Text + ".txt";
if(txtUser.Text == "" || txtUser.Text == null || txtPassword.Text == "" || txtPassword.Text == null || txtPassword.Text.Length < 5 )
{
return;
}
if(txtUser.Text == "currentUsers")
{
ErrorUserExists form = new ErrorUserExists(txtUser.Text);
form.ShowDialog();
return;
}
if (getCurrentUsers().Contains(txtUser.Text))
{
ErrorUserExists form = new ErrorUserExists(txtUser.Text);
form.ShowDialog();
return;
}
else
{
using (StreamWriter file = new StreamWriter(newUserFile, true))
{
file.WriteLine("USER");
file.WriteLine(txtUser.Text);
file.WriteLine(AESThenHMAC.SimpleEncryptWithPassword(txtPassword.Text, "passwordpassword"));
}
using (StreamWriter file = new StreamWriter("currentUsers.txt", true))
{
file.WriteLine(txtUser.Text);
}
this.Hide();
MainPage mainPage = new MainPage(txtUser.Text, txtPassword.Text);
mainPage.ShowDialog();
}
}