예제 #1
0
파일: App.xaml.cs 프로젝트: 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();                     
        }
예제 #2
0
파일: App.xaml.cs 프로젝트: bdr27/c-
        private void wireHandlers(MainWindow playerWindow)
        {
            playerWindow.AddIPAddressMenuItemHandler(HandleIPAddressMenuItem);
            

            playerWindow.GameBoard.AddMouseHandler(HandleMouseEvent);
        }
예제 #3
0
파일: App.xaml.cs 프로젝트: 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();
        }
예제 #4
0
파일: App.xaml.cs 프로젝트: 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();
     }
 }
예제 #5
0
파일: App.xaml.cs 프로젝트: 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();                     
        }
예제 #6
0
파일: App.xaml.cs 프로젝트: 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();
        }
예제 #7
0
파일: App.xaml.cs 프로젝트: 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();
        }