Пример #1
0
        /// <summary>
        /// Rellena un control ListView con las circulaciones que contiene el horario
        /// </summary>
        /// <param name="control">Control contenedor del listado</param>
        /// <param name="imageKey">Clave (name) de la imagen a mostrar junto a las entradas de la lista.</param>
        public void ListView(ListView control, string imageKey)
        {
            control.Items.Clear();
            control.Columns.Clear();
            control.Columns.Add("Tipo", 100);
            control.Columns.Add("Número", 100);
            control.Columns.Add("Procedencia", 200);
            control.Columns.Add("Destino", 200);
            control.Columns.Add("Entrada", 80, HorizontalAlignment.Center);
            control.Columns.Add("Salida", 80, HorizontalAlignment.Center);
            control.Columns.Add("Andén", 70, HorizontalAlignment.Center);
            control.Columns.Add("Comentarios", 300);
            control.View = View.Details;

            foreach (OTCCirculation circulation in _circulations)
            {
                ListViewItem item = new ListViewItem(OTCCirculations.TypeName(circulation.Type), imageKey);
                item.SubItems.Add(circulation.Number);
                item.SubItems.Add(circulation.Source);
                item.SubItems.Add(circulation.Destination);
                item.SubItems.Add(circulation.Arrival == DateTime.MinValue ? "" : circulation.Arrival.ToString("hh:mm"));
                item.SubItems.Add(circulation.Depart == DateTime.MinValue ? "" : circulation.Depart.ToString("hh:mm"));
                item.SubItems.Add(circulation.Platform);
                item.SubItems.Add(circulation.Comments);

                item.Tag = circulation;

                control.Items.Add(item);
            }
        }
Пример #2
0
        /// <summary>
        /// Genera una lista de tipos de circulación
        /// </summary>
        /// <param name="control">Control contenedor de la lista</param>
        /// <param name="selected">Valor seleccionado por defecto</param>
        public static void TypesList(ImageComboBox control, OTCCirculationTypes selected)
        {
            ImageComboBoxItem item = null;

            foreach (OTCCirculationTypes val in Enum.GetValues(typeof(OTCCirculationTypes)))
            {
                item = new ImageComboBoxItem(OTCCirculations.TypeName(val), (int)val);
                control.Items.Add(item);
                if (selected == val)
                {
                    control.SelectedItem = item;
                }
            }
        }
Пример #3
0
 /// <summary>
 /// Genera una lista de tipos de circulación
 /// </summary>
 /// <param name="control">Control contenedor de la lista</param>
 public static void TypesList(ImageComboBox control)
 {
     OTCCirculations.TypesList(control, OTCCirculationTypes.None);
 }