Beispiel #1
0
        public SignupWindow()
        {
            InitializeComponent();
            ClientCallback callback = new ClientCallback();

            client = new ConnectFourServiceClient(new InstanceContext(callback));
        }
        private void Login_Click(object sender, RoutedEventArgs e)
        {
            string username = tbUsername.Text;
            string password = tbPassword.Password;

            if (string.IsNullOrEmpty(username) || string.IsNullOrEmpty(password))
            {
                MessageBox.Show("username and password cant be empty!");
                return;
            }
            string         passwordEncrypted = GetSHA1HashData(password);
            ClientCallback callback          = new ClientCallback();

            client = new ConnectFourServiceClient(new InstanceContext(callback));
            bool loginResult = client.login(username, passwordEncrypted);

            if (loginResult == false)
            {
                MessageBox.Show("username or password is incorrect!");
                return;
            }

            OpenMainWindow(username, callback);
            this.Close();
        }
Beispiel #3
0
        private void initWaitingGame(ClientCallback Callback, string currentUser, ConnectFourServiceClient client)
        {
            WaitingGameWindow waitingGameWindow = new WaitingGameWindow();

            waitingGameWindow.Callback    = Callback;
            waitingGameWindow.currentUser = currentUser;
            waitingGameWindow.client      = client;
            waitingGameWindow.Show();
        }
        private void OpenMainWindow(string username, ClientCallback callback)
        {
            MainWindow window = new MainWindow();

            window.Callback    = callback;
            window.currentUser = username;
            window.client      = client;

            window.Show();
        }