public OngoingGames(FIARServiceClient Client, WaitingRoom wr) { this.Client = Client; InitializeComponent(); dgData.ItemsSource = Client.GetOngoingGames(); }
public SearchBy2Players(FIARServiceClient Client, WaitingRoom sender) { this.sender = sender; this.Client = Client; InitializeComponent(); resetLabels(); }
/// <summary> /// sends request to log in to host /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnLogin_Click(object sender, RoutedEventArgs e) { if (AllboxesFilled()) { try { ClientCallback callback = new ClientCallback(); var instanceCallback = new InstanceContext(callback); FIARServiceClient client = new FIARServiceClient(instanceCallback); string username = tbUserName.Text.Trim(); string pass = tbPass.Password.ToString(); client.PlayerLogin(username, pass); WaitingRoom waitingRoom = new WaitingRoom(client, username, callback); this.Close(); waitingRoom.Show(); } catch (FaultException <PlayerAlreadyConnectedFault> ex) { MessageBox.Show(ex.Detail.Details); } catch (FaultException <PlayerDoesntExistInDataBase> ex) { MessageBox.Show(ex.Detail.Details); } catch (Exception) { MessageBox.Show("Server is not avalibale"); } } }
/// <summary> /// sets the game with given players callback and turn /// </summary> /// <param name="client"></param> /// <param name="us"></param> /// <param name="callback"></param> /// <param name="turn"></param> /// <param name="waitingRoom"></param> /// <param name="otherPalyerUS"></param> /// <param name="wr"></param> public Game(FIARServiceClient client, string us, ClientCallback callback, bool turn, WaitingRoom waitingRoom, string otherPalyerUS, WaitingRoom wr) { InitializeComponent(); this.waitingRoom = waitingRoom; this.callback = callback; this.Client = client; this.callback.madeMove = UpdateGame; this.turn = turn; this.wr = wr; SetTurn(); callback.EndGame = this.EndGame; playerColor = new SolidColorBrush((Color)ColorConverter.ConvertFromString("Red")); opponentColor = new SolidColorBrush((Color)ColorConverter.ConvertFromString("Yellow")); SetUsers(us, otherPalyerUS); SetGui(); }