示例#1
0
        private async void loginButton_Click(object sender, RoutedEventArgs e)
        {
            string       loginName   = loginNameTB.Text;
            string       passWord    = passWordBox.Password;
            LoginControl logcontroll = null;

            logcontroll = LoginControl.login(loginName, passWord);
            if (logcontroll != null)
            {
                Person nowPerson = new Person();
                nowPerson       = logcontroll.returnPersonMes();
                App.loginperson = nowPerson;
                //loginperson = nowPerson;
                Frame root = Window.Current.Content as Frame;
                root.Navigate(typeof(BlankPage1));
            }
            else
            {
                var dialog = new ContentDialog()
                {
                    Title               = "错误提示:",
                    Content             = "",
                    PrimaryButtonText   = "确定",
                    SecondaryButtonText = "取消",
                    FullSizeDesired     = false,
                };
                dialog.PrimaryButtonClick += (_s, _e) => { };
                await dialog.ShowAsync();
            }
        }
示例#2
0
        private async void loginButton_Click(object sender, RoutedEventArgs e)
        {
            string loginName = loginNameTB.Text;
            string passWord  = passWordBox.Password;

            App.loginperson = await LoginControl.login(loginName, passWord);

            if (App.loginperson != null)
            {
                switch (App.loginperson.level)
                {
                case Level.buyer:
                    App.loginperson = (Buyer)App.loginperson;
                    break;

                case Level.seller:
                    App.loginperson = (Seller)App.loginperson;
                    break;

                case Level.manager:
                    App.loginperson = (Manager)App.loginperson;
                    break;

                default:
                    break;
                }
                Frame root = Window.Current.Content as Frame;
                root.Navigate(typeof(BlankPage1));
            }
            else
            {
                var dialog = new ContentDialog()
                {
                    Title               = "错误提示:",
                    Content             = "请填完整或密码错误",
                    PrimaryButtonText   = "确定",
                    SecondaryButtonText = "取消",
                    FullSizeDesired     = false,
                };
                dialog.PrimaryButtonClick += (_s, _e) => { };
                await dialog.ShowAsync();
            }
        }