コード例 #1
0
        private void btRegisterRegister_Click(object sender, RoutedEventArgs e)
        {
            lbRegisterError.Content = "";


            if (!new System.Text.RegularExpressions.Regex(@"^.*(?=.{8,})((?=.*[!@#$%^&*()\-_=+{};:,<.>]){1})(?=.*\d)((?=.*[a-z]){1})((?=.*[A-Z]){1}).*$").IsMatch(tbRegisterPassword.Password))
            {
                lbRegisterError.Content = "Insecure Password";
                return;
            }

            User = new User(tbRegisterUsername.Text, "0:0", tbRegisterPassword.Password);

            Response response = Exchange(new Document(), "LoginModule", "Register");

            switch (response.Header.Code)
            {
            case ResponseCode.PlannedError:
                lbRegisterError.Content = response.Header.Message;
                break;

            case ResponseCode.Ok:
                GetMain.ChangeControl(MainWindow.Controls.Login);
                break;

            default:
                throw new Exception("Invalid response code.");
            }
        }
コード例 #2
0
ファイル: BaseControl.cs プロジェクト: Cyklan/TicTacTonline
 private void CheckConnectionAndSwitchToConnectionScreen()
 {
     if (!Client.IsConnected)
     {
         GetMain.ChangeControl(MainWindow.Controls.Connection);
         Abort();
     }
 }
コード例 #3
0
        private void btConnectionConnect_Click(object sender, RoutedEventArgs e)
        {
            DateTime startWaitTime = DateTime.Now;

            btConnectionConnect.IsEnabled = false;
            btConnectionConnect.Content   = "Connecting";
            lbConnectionError.Content     = "";
            DoEvents();

            try
            {
                GetMain.Connect();
            }
            catch (Exception ex)
            {
                btConnectionConnect.IsEnabled = true;
                btConnectionConnect.Content   = "Connect";
                lbConnectionError.Content     = ex.Message;
                return;
            }
            finally
            {
                GetMain.UpdateInfoLabel();
            }

            while (!Client.IsConnected)
            {
                System.Threading.Thread.Sleep(250);
                DoEvents();

                if (DateTime.Now > startWaitTime.AddSeconds(15))
                {
                    btConnectionConnect.IsEnabled = true;
                    btConnectionConnect.Content   = "Connect";
                    lbConnectionError.Content     = "Connection timed out";
                    Client.Close();
                    return;
                }
            }

            GetMain.UpdateInfoLabel();
            GetMain.ChangeControl(MainWindow.Controls.Login);
        }
コード例 #4
0
ファイル: BaseControl.cs プロジェクト: Cyklan/TicTacTonline
 protected void ChangeControl(MainWindow.Controls control)
 {
     GetMain.ChangeControl(control);
 }
コード例 #5
0
 private void btRegisterLogin_Click(object sender, RoutedEventArgs e)
 {
     GetMain.ChangeControl(MainWindow.Controls.Login);
 }