Exemplo n.º 1
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            ServiceReference1.TowTruckServiceClient myService = new ServiceReference1.TowTruckServiceClient();
            myService.Endpoint.Address = new EndpointAddress(new Uri("http://" + ServiceRef.ServiceAddress));
            List <ServiceReference1.TowTruckData> theseTrucks = new List <ServiceReference1.TowTruckData>();

            theseTrucks            = myService.CurrentTrucks().ToList <ServiceReference1.TowTruckData>();
            theseTrucks            = theseTrucks.OrderBy(c => c.TruckNumber).ToList <ServiceReference1.TowTruckData>();
            gvTruckList.DataSource = theseTrucks;
        }
Exemplo n.º 2
0
        private void LoadTrucks()
        {
            ServiceReference1.TowTruckServiceClient myService = new ServiceReference1.TowTruckServiceClient();
            myService.Endpoint.Address = new EndpointAddress(new Uri("http://" + ServiceRef.ServiceAddress));
            List <ServiceReference1.TowTruckData> theseTrucks = myService.CurrentTrucks().ToList <ServiceReference1.TowTruckData>();
            List <TruckData> localTrucks = new List <TruckData>();

            foreach (ServiceReference1.TowTruckData thisAssistTruck in theseTrucks)
            {
                TruckData thisTruck = new TruckData();
                thisTruck.IPAddress      = thisAssistTruck.IPAddress;
                thisTruck.TruckNumber    = thisAssistTruck.TruckNumber;
                thisTruck.ContractorName = thisAssistTruck.ContractorName;
                localTrucks.Add(thisTruck);
            }
            cboTrucks.DataSource    = localTrucks;
            cboTrucks.DisplayMember = "TruckNumber";
            cboTrucks.ValueMember   = "IPAddress";
        }