コード例 #1
0
        private void playerLeftGamePopup()
        {
            currentScreen = Screen.game_select;
            activateScreen();
            HostLeftErrorDelegate func = new HostLeftErrorDelegate(quitLobby);
            ErrorWindow           win2 = new ErrorWindow("A player has left the game.", func);

            win2.Show();
        }
コード例 #2
0
        private void quitLobbyPopup()
        {
            currentScreen = Screen.game_select;
            activateScreen();
            HostLeftErrorDelegate func = new HostLeftErrorDelegate(quitLobby);
            ErrorWindow           win2 = new ErrorWindow("The game host has left", func);

            win2.Show();
        }
コード例 #3
0
 public void GameDoesNotExist()
 {
     if (this.Dispatcher.Thread == System.Threading.Thread.CurrentThread)
     {
         currentScreen = Screen.game_select;
         activateScreen();
         ErrorWindow win2 = new ErrorWindow("The selected game does not exist. Please refresh the browser.");
         win2.Show();
     }
     else
     {
         this.Dispatcher.BeginInvoke(new GameDoesNotExistUpdateDelegate(
                                         GameDoesNotExist), new object[] { });
     }
 }
コード例 #4
0
 public void GameIsFull()
 {
     if (this.Dispatcher.Thread == System.Threading.Thread.CurrentThread)
     {
         currentScreen = Screen.game_select;
         activateScreen();
         ErrorWindow win2 = new ErrorWindow("The selected game is full.");
         win2.Show();
     }
     else
     {
         this.Dispatcher.BeginInvoke(new GameIsFullUpdateDelegate(
                                         GameIsFull), new object[] { });
     }
 }
コード例 #5
0
        private void login(object sender, RoutedEventArgs e)
        {
            try
            {
                DuplexChannelFactory <IFishService> channel;
                string hostName = Dns.GetHostName();
                string myIP     = Dns.GetHostByName(hostName).AddressList[0].ToString();
                if (endpoint_box.Text != "")
                {
                    myIP = endpoint_box.Text;
                }
                string endpointStr = "net.tcp://" + myIP + ":13200/CardsLibrary/FishService";
                //channel = new DuplexChannelFactory<IFishService>(this, "FishService", new EndpointAddress( endpointStr));
                //channel.Endpoint.ListenUri = new Uri(endpointStr);
                NetTcpBinding binding = new NetTcpBinding();
                binding.Security.Mode = SecurityMode.None;
                binding.Name          = "FishService";

                channel = new DuplexChannelFactory <IFishService>(this, binding,
                                                                  new EndpointAddress(endpointStr));
                // Activate a MessageBoard object
                fishService = channel.CreateChannel();
            }
            catch (Exception ex)
            {
                ErrorWindow win2 = new ErrorWindow(ex.Message);
                win2.Show();
            }
            try
            {
                if (fishService.AddPlayer(login_box.Text))
                {
                    ViewGameList();

                    user.Username = login_box.Text;
                }
                else
                {
                    ErrorWindow win2 = new ErrorWindow("The username selected is allready in use. Please select another username");
                    win2.ShowDialog();
                }
            }
            catch (Exception ex)
            {
                ErrorWindow win2 = new ErrorWindow(ex.Message);
                win2.Show();
            }
        }