Esempio n. 1
0
        /// <summary>
        /// Window_Loaded
        /// event handler for loading the window
        /// connects to portal then asks user to login
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void Window_Loaded(object sender, RoutedEventArgs e)
        {
            ChannelFactory <IDGPortalController> channelFactory;
            NetTcpBinding tcpBinding = new NetTcpBinding();
            string        url        = "net.tcp://localhost:50002/DGPortal";

            try
            {
                channelFactory = new ChannelFactory <IDGPortalController>(tcpBinding, url); // bind url to channel factory
                m_portal       = channelFactory.CreateChannel();                            // create portal on remote server

                Login();
            }
            catch (ArgumentNullException)
            {
                MessageBox.Show("Error Connecting to Portal, please  try again later\n");
                CloseWindow();
            }
            catch (InvalidOperationException)
            {
                MessageBox.Show("Error Connecting to Portal, please  try again later\n");
                CloseWindow();
            }
            catch (EndpointNotFoundException)
            {
                MessageBox.Show("Portal not avialable at this time, please  try again later\n");
                CloseWindow();
            }
        }
Esempio n. 2
0
 /// <summary>
 /// MainWindow
 /// Constructor
 /// </summary>
 public MainWindow()
 {
     m_user    = null;
     m_portal  = null;
     m_server  = null;
     m_ability = null;
     m_target  = -1;
 }
Esempio n. 3
0
    public void ConnectToPortal()
    {
        ChannelFactory <IDGPortalController> channelFactory;
        NetTcpBinding tcpBinding = new NetTcpBinding();
        string        url        = "net.tcp://localhost:50002/DGPortal";

        try
        {
            channelFactory = new ChannelFactory <IDGPortalController>(tcpBinding, url); // bind url to channel factory
            m_portal       = channelFactory.CreateChannel();                            // create portal on remote server
        }
        catch (ArgumentNullException)
        {
        }
        catch (InvalidOperationException)
        {
        }
        catch (EndpointNotFoundException)
        {
        }
    }
Esempio n. 4
0
        /// <summary>
        /// ConnectToPortal
        /// Connects and subscribes to the portal
        /// </summary>
        public void ConnectToPortal()
        {
            ChannelFactory <IDGPortalController> channelFactory;

            NetTcpBinding tcpBinding = new NetTcpBinding();
            string        url        = "net.tcp://localhost:50002/DGPortal";

            try
            {
                // incease default message size quota
                tcpBinding.MaxReceivedMessageSize      = System.Int32.MaxValue;
                tcpBinding.ReaderQuotas.MaxArrayLength = System.Int32.MaxValue;

                // bind channel to url
                channelFactory = new ChannelFactory <IDGPortalController>(tcpBinding, url);   // bind url to channel factory

                m_portal     = channelFactory.CreateChannel();
                m_serverInfo = m_portal.Subscribe();
            }
            catch (ArgumentNullException e1)
            {
                Console.WriteLine("\nError: Binding URL to ChannelFactory\n" + e1.Message);
                CloseServer(1);
            }
            catch (InvalidOperationException e4)
            {
                Console.WriteLine(e4.Message);
                Environment.Exit(1);
            }
            catch (FaultException <PortalServerFault> e)
            {
                Console.WriteLine("Error in portal function {0} \n{1}", e.Detail.Operation, e.Detail.ProblemType);
                CloseServer(1);
            }
            catch (CommunicationException e2)
            {
                Console.WriteLine("\nError: Communicating with Portal \n" + e2.Message);
                CloseServer(1);
            }
        }