Exemplo n.º 1
0
    public static void Init()
    {
        MyFirstWindow window = EditorWindow.GetWindow(typeof(MyFirstWindow)) as MyFirstWindow;

        // Initialize window : start de la fenêtre

        window.Show();
    }
Exemplo n.º 2
0
    public static void InitWithContent(LevelProfile profile)
    {
        MyFirstWindow window = EditorWindow.GetWindow(typeof(MyFirstWindow)) as MyFirstWindow;

        window.currentProfile = profile;

        window.Show();
    }
        private void submit_Click(object sender, RoutedEventArgs e)
        {
            Query  q    = new Query();
            string name = "";
            string pass = "";
            string type = "";

            if (username.Text == "" || password.Password == "")
            {
                MessageBox.Show("用户名或密码不能为空!", "提示");
            }
            else
            {
                DataTable dt = q.Query_by_user(username.Text);
                if (dt.Rows.Count > 0)
                {
                    name = dt.Rows[0][1].ToString();
                    pass = dt.Rows[0][2].ToString();
                    type = dt.Rows[0][3].ToString();
                }

                string code = validCode.CheckCode;
                if (validcode.Text.ToUpper() == code.ToUpper())
                {
                    if (username.Text == name && password.Password == pass)
                    {
                        Application.Current.Properties["userName"] = name;
                        if (type == "1")
                        {
                            MyFirstWindow myFirstWindow = new MyFirstWindow();
                            myFirstWindow.Show();
                            this.Close();
                        }
                    }
                    else
                    {
                        i++;
                        if (i == 3)
                        {
                            MessageBox.Show("连续输入三次错误,系统将退出!", "提示");
                            Application.Current.Shutdown();
                        }
                        else
                        {
                            if (username.Text != name)
                            {
                                MessageBox.Show("用户名或者密码错误!", "提示");
                            }
                            else if (password.Password != pass)
                            {
                                MessageBox.Show("用户名或者密码错误!", "提示");
                                reset_Click(sender, e);
                            }
                            else
                            {
                                MessageBox.Show("用户名或者密码错误!", "提示");
                            }
                            username.Text     = "";
                            password.Password = "";
                            username.Focus();
                        }
                    }
                }
                else
                {
                    MessageBox.Show("验证码输入错误!", "提示");
                }
            }
        }