protected override void Synchronise() { base.Synchronise(); ChatFlightCardDataItem dataItem = this.DataItem as ChatFlightCardDataItem; this.nameElement.Text = dataItem.PassangerName; this.planeImage = dataItem.Image; this.totalSumElement.Text = dataItem.Total; for (int index = 0; index < this.stackElement.Children.Count; ++index) { if (index < this.stackElement.Children.Count && this.stackElement.Children[index] is FlightStackLayoutPanel) { this.stackElement.Children.RemoveAt(index); } } int index1 = 3; foreach (FlightInfo flight in dataItem.Flights) { FlightStackLayoutPanel flightStackElement = this.CreateFlightStackElement(); FlightCardAirportInfo departureElement = this.CreateFlightDepartureElement(flight.DepartureCity, flight.DepartureAirport, flight.DepartureDateTime.ToShortDateString(), flight.DepartureDateTime.ToShortTimeString()); LightVisualElement flightImageElement = this.CreateFlightImageElement(); flightImageElement.Image = this.planeImage; FlightCardAirportInfo flightArrivalElement = this.CreateFlightArrivalElement(flight.ArrivalCity, flight.ArrivalAirport, flight.ArrivalDateTime.ToShortDateString(), flight.ArrivalDateTime.ToShortTimeString()); flightStackElement.Children.Add((RadElement)departureElement); flightStackElement.Children.Add((RadElement)flightImageElement); flightStackElement.Children.Add((RadElement)flightArrivalElement); this.stackElement.Children.Insert(index1, (RadElement)flightStackElement); ++index1; } }
protected virtual FlightCardAirportInfo CreateFlightDepartureElement( string city, string airport, string date, string time) { FlightCardAirportInfo flightCardAirportInfo = new FlightCardAirportInfo(city, airport, date, time); flightCardAirportInfo.ShouldHandleMouseInput = false; return(flightCardAirportInfo); }
protected virtual FlightCardAirportInfo CreateFlightArrivalElement( string city, string airport, string date, string time) { FlightCardAirportInfo flightCardAirportInfo = new FlightCardAirportInfo(city, airport, date, time); flightCardAirportInfo.CityElement.TextAlignment = ContentAlignment.MiddleRight; flightCardAirportInfo.AirportElement.TextAlignment = ContentAlignment.MiddleRight; flightCardAirportInfo.DateElement.TextAlignment = ContentAlignment.MiddleRight; flightCardAirportInfo.TimeElement.TextAlignment = ContentAlignment.MiddleRight; flightCardAirportInfo.ShouldHandleMouseInput = false; return(flightCardAirportInfo); }