Beispiel #1
0
        public MainWindow()
        {
            InitializeComponent();

            DuplexChannelFactory <DeckInterface> channel = new DuplexChannelFactory <DeckInterface>(this, "DeckEndPoint");

            deck = channel.CreateChannel();

            playerIndex         = deck.PlayerIndex;
            playerLabel.Content = "Player " + (playerIndex + 1);

            if (playerIndex != 0)
            {
                btnDraw.IsEnabled = false;
            }

            if (playerIndex == 0)
            {
                deck.PlayerIndex++;
                string numPlayers = Interaction.InputBox("Enter Number of Players", "Enter Number of Players", "0", -1, -1);
                deck.NumPlayers = Int32.Parse(numPlayers);;
            }
            else
            {
                deck.PlayerIndex++;
            }

            deck.RegisterForCallbacks();
        }
Beispiel #2
0
            private void initialize()
            {
                try
                {
                    // Connect to the WCF service endpoint
                    DuplexChannelFactory <DeckInterface> channel = new DuplexChannelFactory <DeckInterface>(this, "DeckEndPoint");
                    deck = channel.CreateChannel();

                    // Register for the callback service
                    deck.RegisterForCallbacks();

                    playerIndex = deck.PlayerIndex;
                    deck.PlayerIndex++;

                    Console.WriteLine("player index " + playerIndex);
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                }
            }