Beispiel #1
0
        private void OnTestConnectionCompleted(bool result, BombsHost.CommunicatorClient testCommunicator, Server.ServerVariables serverVariables)
        {
            serverToConnect = serverVariables;
            if (TestConnectionCompleted != null)
            {
                if (!result)
                {
                    TestConnectionCompleted(this, new ResultArg()
                    {
                        Result = new Server.TestConnectionVariablesArgs()
                        {
                            IsTestConnectionSuccessful = false,
                            ServerInformation = null
                        }
                    });
                }
                else
                {
                    if (testCommunicator != null)
                    {
                        testResultHost = testCommunicator;

                        testResultHost.GetServerInformationCompleted -= testCommunicator_GetServerInformationCompleted;
                        testResultHost.GetServerInformationCompleted += testCommunicator_GetServerInformationCompleted;

                        testResultHost.GetServerInformationAsync();
                    }
                }
            }
        }
Beispiel #2
0
        public void Connect()
        {
            connector = new BombsHost.CommunicatorClient(new InstanceContext(this), binding, new EndpointAddress(string.Format(@"net.tcp://{0}:{1}/BombsHost/tcp", activeServer.Address, activeServer.Port.ToString())));

            connector.Endpoint.Name = "BOMBS_Service_Communicator_EndPoint";
            try
            {
                connector.Open();
                OnConnectionStatusChange(Server.ConnectionStatus.Success);

                if (HostInitializedAndOpened != null) HostInitializedAndOpened(this, EventArgs.Empty);
            }
            catch
            {
                OnConnectionStatusChange(Server.ConnectionStatus.ConnectionFailure);
                return;
            }

            connector.GetServerInformationCompleted -= connector_GetServerInformationCompleted;
            connector.GetServerInformationCompleted += connector_GetServerInformationCompleted;

            connector.GetServerInformationAsync();
        }