Exemple #1
0
    public MainWindow() : base(Gtk.WindowType.Toplevel)
    {
        Build();
        try {
            ChannelFactory <ITMBizController> channelFactory;
            NetTcpBinding tcpBind = new NetTcpBinding();

            tcpBind.MaxReceivedMessageSize      = System.Int32.MaxValue;
            tcpBind.ReaderQuotas.MaxArrayLength = System.Int32.MaxValue;


            channelFactory = new ChannelFactory <ITMBizController>(tcpBind, "net.tcp://localhost:50002/TMBiz");  // listening for biz tier with the port 50002
            m_biz          = channelFactory.CreateChannel();

            // default properties of a tile when loading an image tile
            this.m_zoom = 4;
            this.m_x    = 0;
            this.m_y    = 0;

            byte[] imageBuffer = m_biz.LoadTile(m_zoom, m_x, m_y);
            tmImageBox.Pixbuf = new Gdk.Pixbuf(imageBuffer);
        }
        catch (GLib.GException exception)
        {
            Console.WriteLine("Connection failure! " + exception);
        }
        catch (System.Net.Sockets.SocketException exception)
        {
            Console.WriteLine("Connection failure ! " + exception);
        }
    }
Exemple #2
0
        /// <summary>
        /// Window_Loaded
        /// first event fired
        /// binds server and initialises m_tmData
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            DuplexChannelFactory <ITMBizController> channelFactory;

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

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

                channelFactory = new DuplexChannelFactory <ITMBizController>(new InstanceContext(this), tcpBinding, url); // bind url to channel factory
                m_biz          = channelFactory.CreateChannel();                                                          // create true marblebiz on remote server
                m_biz.VerifyTilesAsync();
            }
            catch (ArgumentNullException)
            {
                MessageBox.Show("Error Connecting to Server, please  try again later\n");
                this.Close();
            }
            catch (InvalidOperationException)
            {
                MessageBox.Show("Error Connecting to Server, please  try again later\n");
                this.Close();
            }
            catch (EndpointNotFoundException)
            {
                MessageBox.Show("Service not avialable at this time, please  try again later\n");
                this.Close();
            }
        }
Exemple #3
0
        //sets up window on load
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            //Client side connects to server
            ChannelFactory <ITMBizController> tmBiz;
            NetTcpBinding tcpBinding = new NetTcpBinding();

            //sets max values for tcp binding
            tcpBinding.MaxReceivedMessageSize      = System.Int32.MaxValue;
            tcpBinding.ReaderQuotas.MaxArrayLength = System.Int32.MaxValue;
            string sURL = "net.tcp://localhost:50002/TMBiz";

            try
            {
                tmBiz   = new DuplexChannelFactory <ITMBizController>(this, tcpBinding, sURL);
                m_tmBiz = tmBiz.CreateChannel();
            }
            catch (FaultException)
            {
                Console.WriteLine("Fault Exception thrown in MainWindow.xaml.cs > Window_Loaded");
            }

            //makes the asynchronous call
            try
            {
                m_tmBiz.VerifyTilesAsync();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }

            load_Image(true);
        }
    public TMWebService()
    {
        DuplexChannelFactory <ITMBizController> channelFactory;

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

        tcpBinding.MaxReceivedMessageSize      = System.Int32.MaxValue;
        tcpBinding.ReaderQuotas.MaxArrayLength = System.Int32.MaxValue;

        channelFactory = new DuplexChannelFactory <ITMBizController>(new InstanceContext(this), tcpBinding, url);   // bind url to channel factory
        m_biz          = channelFactory.CreateChannel();
    }
Exemple #5
0
        //This method contains the coding need to establish a connection with the biz tier when the programme is running
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            NetTcpBinding ntb = new NetTcpBinding();

            //To relax the maximum size of a message in .net(Since images are being passed arround)
            ntb.MaxReceivedMessageSize      = System.Int32.MaxValue;
            ntb.ReaderQuotas.MaxArrayLength = System.Int32.MaxValue;
            try
            {
                DuplexChannelFactory <ITMBizController> TMFactory = new DuplexChannelFactory <ITMBizController>(this, ntb, "net.tcp://localhost:50002/TMBiz");

                m_biz = TMFactory.CreateChannel();
                m_biz.VerifyTilesAsync();
            }

            //If URI is invalid or uri Cannot be parsed or empty uri
            catch (UriFormatException ex)
            {
                Console.WriteLine("Error : " + ex.Message);
            }
            //If endpoint is null
            catch (InvalidOperationException ex)
            {
                Console.WriteLine("Error : " + ex.Message);
            }

            //If address is null
            catch (ArgumentNullException ex)
            {
                Console.WriteLine("Error : " + ex.Message);
            }

            //If address is null
            catch (EndpointNotFoundException)
            {
                MessageBox.Show("Error : Coulld not connect with the server. Please try again later!");
            }
        }