diff --git a/Login.xaml b/Login.xaml
index e240c2b..47c11be 100644
--- a/Login.xaml
+++ b/Login.xaml
@@ -3,6 +3,7 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+ xmlns:input="clr-namespace:System.Windows.Input;assembly=PresentationCore"
xmlns:local="clr-namespace:formula_manage"
mc:Ignorable="d"
Title="Login" Height="360" Width="248">
@@ -12,9 +13,8 @@
-
-
-
+
+
diff --git a/Login.xaml.cs b/Login.xaml.cs
index 4ea1062..034b932 100644
--- a/Login.xaml.cs
+++ b/Login.xaml.cs
@@ -2,11 +2,13 @@
using System.Collections.Generic;
using System.Linq;
using System.Text;
+using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
+using System.Windows.Forms;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
@@ -19,20 +21,38 @@ namespace formula_manage
///
public partial class Login : Window
{
+
public Login()
{
WindowStartupLocation = WindowStartupLocation.CenterScreen;
InitializeComponent();
}
- private void Button_Click(object sender, RoutedEventArgs e)
+ private void TextBox_PreviewTextInput(object sender, TextCompositionEventArgs e)
+ {
+ Regex re = new Regex("^[1-9]+[0-9]*$");
+
+ e.Handled = !re.IsMatch(e.Text);
+ }
+
+ private void Button_Click(object sender, RoutedEventArgs e) //退出按钮事件
{
this.Close();
}
- private void Button_Click_1(object sender, RoutedEventArgs e)
+ private void Button_Click_1(object sender, RoutedEventArgs e) //登录按钮事件
{
+ if ((Name.Text == "engineer" || Name.Text == "ENGINEER") && (Pasword.Password == "engineer" || Pasword.Password == "ENGINEER"))
+ {
+ MainWindow Main = new MainWindow();
+ Main.ShowDialog();//实例化并置顶打开信息窗口
+ this.Close();
+ }
+ else
+ {
+ System.Windows.MessageBox.Show("账号或密码错误");
+ }
}
}
}
diff --git a/formula_manage.csproj b/formula_manage.csproj
index 3195cc8..8884c2f 100644
--- a/formula_manage.csproj
+++ b/formula_manage.csproj
@@ -37,6 +37,7 @@
+