private void PlayOnlineClick(object sender, RoutedEventArgs e) { GameOptionsWindow playOnlineWindow = new GameOptionsWindow(); playOnlineWindow.Client = Client; playOnlineWindow.CallBack = CallBack; playOnlineWindow.Username = Username; this.Close(); playOnlineWindow.Show(); }
private void Register(string userName, string password) { GameCallback callback = new GameCallback(); try { GameServiceClient client = new GameServiceClient(new InstanceContext(callback)); client.RegisterClient(userName, password); GameOptionsWindow optionWindow = new GameOptionsWindow(); optionWindow.Client = client; optionWindow.CallBack = callback; optionWindow.Username = userName; optionWindow.Title = userName; this.Close(); optionWindow.Show(); } catch (FaultException <UserExistsFault> ex) { MessageBox.Show(ex.Detail.Message, "Oops!", MessageBoxButton.OK, MessageBoxImage.Information); } catch (FaultException ex) { MessageBox.Show(ex.Message, "Error occurred", MessageBoxButton.OK, MessageBoxImage.Error); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error occurred", MessageBoxButton.OK, MessageBoxImage.Error); } }