/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnLogin_Click(object sender, RoutedEventArgs e) { if (username.Text.Trim() == "" || password.Password.Trim() == "") { message.Content = "please fill in all fields"; return; } ServiceClient sc = new ServiceClient(); Dictionary <String, String> response = sc.Login(username.Text, password.Password); if (response["status"] == Constants.ERROR) { message.Content = response["message"]; return; } else { message.Content = "Welcome boss!!!!!!! >> " + response["nickname"]; } Application.Current.Resources["username"] = response["username"]; Application.Current.Resources["nickname"] = response["nickname"]; Application.Current.Resources["id"] = response["id"]; this.Close(); ParentWindow parentWindow = ParentWindow.getParentWindow(); parentWindow.Left = (Utils.getScreenWidth() / 2) - (parentWindow.Width / 2); parentWindow.Top = (Utils.getScreenHeight() / 2) - (parentWindow.Height / 2); parentWindow.Show(); Application.Current.MainWindow.Close(); }
private void Game_Results_MenuItem_Click(object sender, RoutedEventArgs e) { ResultsWindow resultsWindow = new ResultsWindow() { ShowInTaskbar = false, Topmost = true, ResizeMode = ResizeMode.NoResize, Owner = ParentWindow.getParentWindow(), }; resultsWindow.Left = (Utils.getScreenWidth() / 2) - (resultsWindow.Width / 2); resultsWindow.Top = (Utils.getScreenHeight() / 2) - (resultsWindow.Height / 2); resultsWindow.ShowDialog(); }
private void startGame() { RequestWindow rw = new RequestWindow { ShowInTaskbar = false, // don't show the dialog on the taskbar Topmost = true, // ensure we're Always On Top ResizeMode = ResizeMode.NoResize, // remove excess caption bar buttons Owner = ParentWindow.getParentWindow(), }; rw.Left = (Utils.getScreenWidth() / 2) - (rw.Width / 2); rw.Top = (Utils.getScreenHeight() / 2) - (rw.Height / 2); rw.ShowDialog(); }
private void LeaderBoard_MenuItem_Click(object sender, RoutedEventArgs e) { LeaderBoard lb = new LeaderBoard() { ShowInTaskbar = false, Topmost = true, ResizeMode = ResizeMode.NoResize, Owner = ParentWindow.getParentWindow(), }; lb.Left = (Utils.getScreenWidth() / 2) - (lb.Width / 2); lb.Top = (Utils.getScreenHeight() / 2) - (lb.Height / 2); lb.ShowDialog();; }
private void Game_Request_Click(object sender, RoutedEventArgs e) { String nickName = (string)Application.Current.Resources["nickname"]; Dictionary <string, string>[] requests = serviceClient.GetGameRequests(nickName); PendingRequests pendingRequestsWindow = new PendingRequests(requests) { ShowInTaskbar = false, Topmost = true, ResizeMode = ResizeMode.NoResize, Owner = ParentWindow.getParentWindow(), }; pendingRequestsWindow.Left = (Utils.getScreenWidth() / 2) - (pendingRequestsWindow.Width / 2); pendingRequestsWindow.Top = (Utils.getScreenHeight() / 2) - (pendingRequestsWindow.Height / 2); pendingRequestsWindow.ShowDialog(); }