internal void connectToLobby(string name)
        {
            monopolyDealService = new MonopolyDealServiceReference.MonopolyDealClient("HttpBinding");
            try
            {
                getServiceReady();

                thisClientGuid = monopolyDealService.connectToLobby(name).guid;
                mainForm.buttonConnect1.Enabled  = false;
                mainForm.buttonStartGame.Enabled = true;
                addToLog("connected .guid" + thisClientGuid);
            }
            catch (Exception ex)
            {
                addToLog(ex.Message);
            }
        }
        public bool getServiceReady()
        {
            bool closedSuccess = false;

            if (monopolyDealService.State == CommunicationState.Created)
            {
                monopolyDealService.Open();
            }
            if (monopolyDealService.State == CommunicationState.Opened)
            {
                return(true);
            }
            else if (monopolyDealService.State == CommunicationState.Faulted || monopolyDealService.State == CommunicationState.Closed || monopolyDealService.State == CommunicationState.Closing)
            {
                try
                {
                    monopolyDealService.Close();
                    closedSuccess = true;
                }
                catch (Exception eC)
                {
                    addToLog(eC.ToString());
                    monopolyDealService.Abort();
                    closedSuccess = true;
                }
            }
            if (closedSuccess)
            {
                try
                {
                    monopolyDealService = new MonopolyDealServiceReference.MonopolyDealClient("HttpBinding");
                    monopolyDealService.Open();
                    return(true);
                }
                catch (Exception eO)
                {
                    addToLog(eO.ToString());
                    return(false);
                }
            }
            return(false);
        }
Пример #3
0
        //Service calling methods
        public void connect()
        {
            //Opens Connection to service
            try
            {
                // The client callback interface must be hosted for the server to invoke the callback
                // Open a connection to the Monopoly Deal service via the proxy
                monopolyDealService = new MonopolyDealServiceReference.MonopolyDealClient(new InstanceContext(this), "TcpBinding");
                monopolyDealService.Open();
                //End

                //Connect to service with player name
                monopolyDealService.connect(mainForm.textBoxPlayerName.Text);

                //Disable Connect button
                mainForm.buttonConnect.Enabled = false;
            }
            catch (Exception r)
            {
                MessageBox.Show(r.ToString());
                mainForm.buttonConnect.Enabled = true;
            }
        }
 public bool getServiceReady()
 {
     bool closedSuccess = false;
     if (monopolyDealService.State == CommunicationState.Created)
     {
         monopolyDealService.Open();
     }
     if (monopolyDealService.State == CommunicationState.Opened)
     {
         return true;
     }
     else if (monopolyDealService.State == CommunicationState.Faulted || monopolyDealService.State == CommunicationState.Closed || monopolyDealService.State == CommunicationState.Closing)
     {
         try
         {
             monopolyDealService.Close();
             closedSuccess = true;
         }
         catch (Exception eC)
         {
             addToLog(eC.ToString());
             monopolyDealService.Abort();
             closedSuccess = true;
         }
     }
     if (closedSuccess)
     {
         try
         {
             monopolyDealService = new MonopolyDealServiceReference.MonopolyDealClient("HttpBinding");
             monopolyDealService.Open();
             return true;
         }
         catch (Exception eO)
         {
             addToLog(eO.ToString());
             return false;
         }
     }
     return false;
 }
        internal void connectToLobby(string name)
        {
            monopolyDealService = new MonopolyDealServiceReference.MonopolyDealClient("HttpBinding");
            try
            {
                getServiceReady();

                thisClientGuid = monopolyDealService.connectToLobby(name).guid;
                mainForm.buttonConnect1.Enabled = false;
                mainForm.buttonStartGame.Enabled = true;
                addToLog("connected .guid" + thisClientGuid);
            }
            catch (Exception ex)
            {
                addToLog(ex.Message);
            }
        }
Пример #6
0
        //Service calling methods
        public void connect()
        {
            //Opens Connection to service
            try
            {
                // The client callback interface must be hosted for the server to invoke the callback
                // Open a connection to the Monopoly Deal service via the proxy
                monopolyDealService = new MonopolyDealServiceReference.MonopolyDealClient(new InstanceContext(this), "TcpBinding");
                monopolyDealService.Open();
                //End

                //Connect to service with player name
                monopolyDealService.connect(mainForm.textBoxPlayerName.Text);

                //Disable Connect button
                mainForm.buttonConnect.Enabled = false;
            }
            catch (Exception r)
            {
                MessageBox.Show(r.ToString());
                mainForm.buttonConnect.Enabled = true;
            }
        }