public IGame connectToGame(string uri, GameWindow gameWindow)
 {
     DuplexChannelFactory<IGame> httpDuplexFactory =
         new DuplexChannelFactory<IGame>(
             new GameCallback(gameWindow),
             new WSDualHttpBinding(WSDualHttpSecurityMode.Message),
             new EndpointAddress(
                 uri));
     return httpDuplexFactory.CreateChannel();
 }
        public IGame connectToGame(string uri, GameWindow gameWindow)
        {
            DuplexChannelFactory<IGame> tcpDuplexFactory =
                new DuplexChannelFactory<IGame>(
                    new GameCallback(gameWindow),
                    new NetTcpBinding(SecurityMode.None),
                    new EndpointAddress(
                        uri));

            return tcpDuplexFactory.CreateChannel();
        }
Example #3
0
 public void MyTestInitialize()
 {
     owner = new UserAccount("Daniel van der Wal", 1);
     user2 = new UserAccount("Cihad Kirhan", 2);
     window = new GameWindow(owner, "localhost", new TestGUI(), new WCFHTTPConnectionFactory());
     window.owner = owner;
     window.playfields.Add(new Playfield(6, owner));
     window.playfields.Add(new Playfield(6, user2));
     window.playfields.Add(new Playfield(6, new UserAccount("Sebastian Hantich", 3)));
     window.playfields.Add(new Playfield(6, new UserAccount("Kamil Szuster", 4)));
     window.playfields.Add(new Playfield(6, new UserAccount("Daniel Witkowski", 5)));
 }
		public GameWindowPage(UserAccount account, string connString)
		{
			this.InitializeComponent();
            user = account;
            Chat.sendButton.Click += sendButton_Click;
            Chat.message.KeyDown += message_KeyDown;
            gameWindow = new BattleShipClient.Windows.GameWindow(user, connString, this, new WCFTCPConnectionFactory());

            for (int i = 0; i < 12; i++)
            {
                for (int j = 0; j < 12; j++)
                {
                    enemyPanel.Playfield.fieldControl[i, j].PreviewMouseDown += FieldClick;
                }
            }
			myGamePanel.addMouseEvents();
			enemyPanel.Disable();
			load.Show();
			myGamePanel.playerName.Text = user.username;
			enemyPanel.playerName.Text = "";
			myGamePanel.KeyDown += HandleKeyDown;
			WinnerDialog.LockElement = LayoutRoot;
		}
Example #5
0
 public TestGUI(Server server)
 {
     UserAccount owner = new UserAccount("TestUser", 0);
     String connString = server.joinGame("TestGame");
     Assert.AreEqual("http://localhost/Game/TestGame", connString);
     WCFConnectionFactory factory = new WCFTCPConnectionFactory();
     gameWindow = new GameWindow(owner, connString, this,factory);
 }
Example #6
0
 public GameCallback(GameWindow gameWindow)
 {
     this.gameWindow = gameWindow;  
 }
Example #7
0
 public void MyTestCleanup()
 {
     owner = null;
     user2 = null;
     window = null;
 }
Example #8
0
 public TestGUI()
 {
     UserAccount user = new UserAccount("testUser", 0);
     gameWindow = new GameWindow(user, "localhost", this, new WCFTCPConnectionFactory());
     messageUpdated = 0;
     logUpdated = 0;
 }