diff --git a/App.xaml.cs b/App.xaml.cs index 118d6bd..2dfc661 100644 --- a/App.xaml.cs +++ b/App.xaml.cs @@ -12,7 +12,11 @@ namespace formula_manage /// App.xaml 的交互逻辑 /// public partial class App : Application - { + { /// + ///公共变量来自Login的用户名 + /// + public static string USER_Purview { get; set; } + public App() { this.Startup += new StartupEventHandler(App_Startup); diff --git a/Login.xaml.cs b/Login.xaml.cs index 692191b..cadf5f9 100644 --- a/Login.xaml.cs +++ b/Login.xaml.cs @@ -62,17 +62,19 @@ namespace formula_manage private void Button_Click_1(object sender, RoutedEventArgs e) //登录按钮事件 { - // if ((User.Text == "engineer" || User.Text == "ENGINEER") && (Pasword.Password == "engineer" || Pasword.Password == "ENGINEER")) + if ((User.Text == "engineer" || User.Text == "ENGINEER") && (Pasword.Password == "engineer" || Pasword.Password == "ENGINEER")) { + App.USER_Purview = "ENGINEER";//传入用户名 + Window window = Window.GetWindow(this); MainWindow Main = new MainWindow(); window.Close(); Main.ShowDialog();//实例化并置顶打开信息窗口 } - /* else + else { System.Windows.MessageBox.Show("账号或密码错误"); - }*/ + } } private void SearchBox_OnKeyDownd(object sender, System.Windows.Input.KeyEventArgs e) //回车跳转功能 diff --git a/MainWindow.xaml b/MainWindow.xaml index 2e10462..4b9924d 100644 --- a/MainWindow.xaml +++ b/MainWindow.xaml @@ -9,15 +9,17 @@ BorderBrush="White" Background="#FFE0E0E0"> - + + + + + + - - - @@ -40,10 +42,16 @@ + + + + +