Exemple #1
0
        public MainWindow()
        {
            //establishes connection to Master Server
            NetTcpBinding tcpBinding = new NetTcpBinding();

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

            ChannelFactory <IMasterController> MasterFactory;
            string surl = "net.tcp://localhost:50000/Master";

            MasterFactory = new DuplexChannelFactory <IMasterController>(this, tcpBinding, surl);

            //channel to Master set
            masterInter = MasterFactory.CreateChannel();
            Console.WriteLine("here");
            displayAirports = masterInter.GetAllAirports();
            Console.WriteLine("here");
            foreach (Airport airporttest in displayAirports)
            {
                Console.WriteLine(airporttest.airportID + airporttest.airportName);
            }
            Console.WriteLine("here");


            InitializeComponent();

            airportListBox.Items.Clear();
            //display the airports in listbox
            foreach (Airport displayport in displayAirports)
            {
                Console.WriteLine(displayport.airportName);
                airportListBox.Items.Add(displayport.airportName);
            }
        }
        public SlaveController()
        {
            //establishes connection to Master Server
            NetTcpBinding tcpBinding = new NetTcpBinding();

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

            ChannelFactory <IMasterController> MasterFactory;
            string surl = "net.tcp://localhost:50000/Master";

            MasterFactory = new DuplexChannelFactory <IMasterController>(this, tcpBinding, surl);

            //channel to Master set
            masterInter = MasterFactory.CreateChannel();

            //retrieving airport object for the slave
            slaveAirport = masterInter.initiateAirportSlave();

            Console.WriteLine(slaveAirport.airportName + " server started");
        }
Exemple #3
0
 protected virtual void Start()
 {
     instance = this;
 }