Esempio n. 1
0
        /// <summary>
        /// ConnectToServer
        /// connects to the server for the given object
        /// </summary>
        /// <param name="newServer"></param>
        private void ConnectToServer(Server newServer)
        {
            DuplexChannelFactory <IDGServerController> channelFactory;

            NetTcpBinding tcpBinding = new NetTcpBinding();
            string        url        = newServer.Url;

            try
            {
                channelFactory = new DuplexChannelFactory <IDGServerController>(new InstanceContext(this), tcpBinding, url); // bind url to channel factory
                m_server       = channelFactory.CreateChannel();                                                             // create portal on remote server
                m_server.Subscribe(m_user);
            }
            catch (FaultException <GameServerFault> e)
            {
                MessageBox.Show("Error Connecting to Server, please  try again later\n\n" + e.Detail.Message);
                CloseWindow();
            }
            catch (ArgumentNullException)
            {
                MessageBox.Show("Error Connecting to Server, please  try again later\n");
                CloseWindow();
            }
            catch (InvalidOperationException)
            {
                MessageBox.Show("Error Connecting to Server, please  try again later\n");
                CloseWindow();
            }
            catch (EndpointNotFoundException)
            {
                MessageBox.Show("Server Endpoint not avialable at this time, please  try again later\n");
                CloseWindow();
            }
        }
Esempio n. 2
0
 public DGWebService()
 {
     m_server = null;
     m_hero   = null;
     m_user   = null;
     ConnectToPortal();
     Login();
 }
Esempio n. 3
0
 /// <summary>
 /// MainWindow
 /// Constructor
 /// </summary>
 public MainWindow()
 {
     m_user    = null;
     m_portal  = null;
     m_server  = null;
     m_ability = null;
     m_target  = -1;
 }
Esempio n. 4
0
    public void ConnectToServer(Server server)
    {
        DuplexChannelFactory <IDGServerController> channelFactory;

        NetTcpBinding tcpBinding = new NetTcpBinding();
        string        url        = server.Url;

        try
        {
            channelFactory = new DuplexChannelFactory <IDGServerController>(new InstanceContext(this), tcpBinding, url); // bind url to channel factory
            m_server       = channelFactory.CreateChannel();                                                             // create portal on remote server
            m_server.Subscribe(m_user);
        }
        catch (ArgumentNullException)
        {
        }
        catch (InvalidOperationException)
        {
        }
        catch (EndpointNotFoundException)
        {
        }
    }