Exemplo n.º 1
0
Arquivo: App.xaml.cs Projeto: bdr27/c-
        public App()
            : base()
        {
            handler = new MOCKMessageHandler();
            handler.connectTo("127.0.0.1", 50000);
            //handler.sendRequest("SET_NAME,BrendanRusso");
            Debug.WriteLine(handler.getResponse());
            handler.sendRequest("PUT,BrendanRusso,3,1");
            Debug.WriteLine(handler.getResponse());

            player1Window = new MainWindow();
            player2Window = new MainWindow();

            player1Window.Title = "Player 1 Window";
            player2Window.Title = "Player 2 Window";

            player2Window.enableIpSet();

            //Wires handlers
            wireHandlers(player1Window);
            wireHandlers(player2Window);
            player1Window.AddSetNameMenuItemHandler(HandleSetNamePlayer1MenuItem);
            player2Window.AddSetNameMenuItemHandler(HandleSetNamePlayer2MenuItem);
            
            //player1Window.AddIPAddressMenuItemHandler(HandleIPAddressMenuItem);
            //player1Window.GameBoard.AddMouseHandler(HandleMouseEvent);

            player1Window.Show();
            player2Window.Show();                     
        }
Exemplo n.º 2
0
Arquivo: App.xaml.cs Projeto: bdr27/c-
        private void wireHandlers(MainWindow playerWindow)
        {
            playerWindow.AddIPAddressMenuItemHandler(HandleIPAddressMenuItem);
            

            playerWindow.GameBoard.AddMouseHandler(HandleMouseEvent);
        }
Exemplo n.º 3
0
Arquivo: App.xaml.cs Projeto: bdr27/c-
        public App()
            : base()
        {
            // create long-lived objects
            handler = new MOCKMessageHandler();
            player1Window = new MainWindow();
            player1Window.Title = "Player1";
            player2Window = new MainWindow();
            player2Window.Title = "Player2";
            timer = new DispatcherTimer();
            timer.Interval = TimeSpan.FromSeconds(1);

            // wire up event handler
            player1Window.AddIPAddressMenuItemHandler(HandleIPAddressMenuItemForPlayer1);
            player2Window.AddIPAddressMenuItemHandler(HandleIPAddressMenuItemForPlayer2);
            player1Window.AddNameMenuItemHandler(HandleNameMenuItemForPlayer1);
            player2Window.AddNameMenuItemHandler(HandleNameMenuItemForPlayer2);
            player1Window.GameBoard.AddMouseHandler(HandleMouseEventForPlayer1);
            player2Window.GameBoard.AddMouseHandler(HandleMouseEventForPlayer2);

            // show the Views
            player1Window.Show();
            player2Window.Show();
            timer.Start();
        }
Exemplo n.º 4
0
Arquivo: App.xaml.cs Projeto: bdr27/c-
 private void HandleIPAddressMenuItem(object sender, RoutedEventArgs e)
 {
     NetworkInformationWindow dialog = new NetworkInformationWindow();
     dialog.Owner = player1Window;
     dialog.ShowDialog();
     networkIPAddress = dialog.GetIPAddress();
     System.Diagnostics.Debug.WriteLine("Address is: " + networkIPAddress);
     if(networkIPAddress.Equals("127.0.0.1") && !player2Display)
     {
         player2Display = true;
         player2Window = new MainWindow();
         player2Window.Title = "Player 2 Window";
         wireHandlers(player2Window);
         player2Window.Show();
     }
 }
Exemplo n.º 5
0
Arquivo: App.xaml.cs Projeto: bdr27/c-
        public App()
            : base()
        {
            player1Window = new MainWindow();         

            player1Window.Title = "Player 1 Window";            

            //Wires handlers
            wireHandlers(player1Window);
            
            //player1Window.AddIPAddressMenuItemHandler(HandleIPAddressMenuItem);
            //player1Window.GameBoard.AddMouseHandler(HandleMouseEvent);

            player1Window.Show();
            //player2Window.Show();                     
        }
Exemplo n.º 6
0
Arquivo: App.xaml.cs Projeto: bdr27/c-
        public App()
            : base()
        {
            player1Window = new MainWindow();
            player2Window = new MainWindow();

            player1Window.Title = "Player 1 Window";
            player2Window.Title = "Player 2 Window";

            player1Window.Show();            

            NetworkInformationWindow dialog = new NetworkInformationWindow();
            dialog.Owner = player1Window;
            dialog.ShowDialog();

            player2Window.Show();

            NetworkInformationWindow dialog2 = new NetworkInformationWindow();
            dialog2.Owner = player2Window;
            dialog2.ShowDialog();
        }
Exemplo n.º 7
0
Arquivo: App.xaml.cs Projeto: bdr27/c-
        public App()
            : base()
        {
            // create long-lived objects
            handler = new MOCKMessageHandler();
            player1Window = new MainWindow();
            player1Window.Title = "Player1";
            player2Window = new MainWindow();
            player2Window.Title = "Player2";

            // wire up event handler
            player1Window.AddIPAddressMenuItemHandler(HandleIPAddressMenuItemForPlayer1);
            player2Window.AddIPAddressMenuItemHandler(HandleIPAddressMenuItemForPlayer2);
            player1Window.AddNameMenuItemHandler(HandleNameMenuItemForPlayer1);
            player2Window.AddNameMenuItemHandler(HandleNameMenuItemForPlayer2);
            player1Window.GameBoard.AddMouseHandler(HandleMouseEventForPlayer1);
            player2Window.GameBoard.AddMouseHandler(HandleMouseEventForPlayer2);

            // show the Views
            player1Window.Show();
            player2Window.Show();
        }