Esempio n. 1
0
        // 选择编译工具界面
        private void OnJumpToCompileToolWindow(object sender, RoutedEventArgs e)
        {
            CompileToolWindow tool = new CompileToolWindow();

            tool.Show();
            this.Close();
        }
Esempio n. 2
0
        // 登录事件
        private void OnLoginIn(object sender, RoutedEventArgs e)
        {
            //{
            //    SelectWindow select = new SelectWindow();
            //    select.Show();
            //    this.Close();
            //}
            if (redisIPTextBox.Text == null)
            {
                MessageBox.Show("请输入数据库地址!", "Warning!", MessageBoxButton.OK, MessageBoxImage.Warning);
                return;
            }
            string ip   = redisIPTextBox.Text;
            int    port = int.Parse(redisPortTextBox.Text);

            if (!IsConnected(ip, port))
            {
                MessageBox.Show("连接失败!", "Warning!", MessageBoxButton.OK, MessageBoxImage.Warning);
                return;
            }
            myRedisIP   = ip;
            myRedisPort = port;

            string name      = usernameTextBox.Text;
            string pwd       = passwordPasswordBox.Password;
            int    authority = VerifyHelper.VerifyUser(name, pwd);

            if (authority == (int)UserAuthority.None)
            {
                MessageBox.Show("用户名或密码错误", "Warning!", MessageBoxButton.OK, MessageBoxImage.Warning);
                return;
            }
            if (authority == (int)UserAuthority.Alrealy)
            {
                MessageBox.Show("不允许多个用户使用同一账号!", "Warning!", MessageBoxButton.OK, MessageBoxImage.Warning);
                return;
            }
            myUsername  = name;
            myPassword  = pwd;
            myAuthority = authority;
            // 普通用户和管理员进入不同的界面
            if (authority == (int)UserAuthority.Normal)
            {
                CompileToolWindow tool = new CompileToolWindow();
                tool.Show();
            }
            else
            {
                SelectWindow select = new SelectWindow();
                select.Show();
            }
            this.Close();
        }