public Stoteles(Transportas Marsrutas, Color color, bool ArSuLaikais, string pradinisLaikas) { NavigationPage.SetHasNavigationBar(this, false); InitializeComponent(); _ArSuLaikais = ArSuLaikais; _Color = color; _Marsrutas = Marsrutas; Laikas laikas = new Laikas(); List <string> Stoteless = new List <string>(); List <string> Laikai = new List <string>(); Stoteless = ParseString(Marsrutas.Stoteles); if (ArSuLaikais) { laikas = GetLaikas(pradinisLaikas); Laikai = ParseString(Marsrutas.LaikuSkirtumai); } string TheHeader = Marsrutas.PradineGalutineStotele; for (int i = 0; i < Stoteless.Count; i++) { if (ArSuLaikais) { if (i > 0) { laikas.Add(GetLaikas(Laikai[i - 1])); } Items.Add(new Data() { Id = i, Primary = Stoteless[i], Secondary = " " + laikas.ToString() }); } else { Items.Add(new Data() { Primary = " " + Stoteless[i], Secondary = "" }); } } MyListView.ItemsSource = Items; MyListView.BackgroundColor = color; BackgroundColor = color; MyListView.Header = TheHeader; MyListView.SeparatorColor = color; MyListView.Footer = ""; }
public Laikai(Data stotele, Color color, Transportas Marsrutas, bool ArDarboDiena) { _Stotele = stotele; _Marsrutas = Marsrutas; _Color = color; if (Marsrutas.PradinesStotelesLaikai.Length < 1) { ArDarboDiena = false; } _ArDarboDiena = ArDarboDiena; List <string> stoteles = ParseString(Marsrutas.Stoteles); List <Laikas> skirtumai = ParseStringLaikai(Marsrutas.LaikuSkirtumai); int stotelesIndex = 0; for (int i = 0; i < stoteles.Count; i++) { if (stoteles[i].Equals(stotele.Primary.Trim())) { stotelesIndex = i; } } if (_ArDarboDiena) { _Laikas = ParseStringLaikai(Marsrutas.PradinesStotelesLaikai); } else { _Laikas = ParseStringLaikai(Marsrutas.PradinesStotelesLaikaiSavaitgaliais); } Laikas skirtumasNuoPirmos = new Laikas(0, 0); for (int i = 0; i < stotelesIndex; i++) { skirtumasNuoPirmos.Add(skirtumai[i]); } NavigationPage.SetHasNavigationBar(this, false); InitializeComponent(); string TheHeader = stotele.Primary; _TheHeader = TheHeader; Items = new ObservableCollection <Data>(); Laikas current = new Laikas(0, 0); foreach (var item in _Laikas) { current = new Laikas(item.Valanda, item.Minute); current = current.Add(skirtumasNuoPirmos); Items.Add(new Data() { Primary = " " + current.ToString(), Secondary = item.ToString() }); } MyListView.ItemsSource = Items; MyListView.BackgroundColor = color; BackgroundColor = color; Data header; if (_ArDarboDiena) { header = new Data() { Primary = "Darbo diena ", Secondary = TheHeader }; } else { header = new Data() { Primary = "Savaitgalis ", Secondary = TheHeader }; } if (Marsrutas.PradinesStotelesLaikai.Length < 2) { header = new Data() { Primary = "Savaitgalis ", Secondary = TheHeader }; } MyListView.Header = header; MyListView.SeparatorColor = color; MyListView.Footer = ""; if (Marsrutas.PradinesStotelesLaikaiSavaitgaliais.Length < 1 || Marsrutas.PradinesStotelesLaikai.Length < 1) { button1.IsEnabled = false; button1.IsVisible = false; } if (_ArDarboDiena) { button1.Text = "Savaitgalis"; } else { button1.Text = "Darbo diena"; } Color buttonColor = Color.Black; if (color == Color.Red) { buttonColor = Color.DarkRed; } if (color == Color.Green) { buttonColor = Color.DarkGreen; } if (color == Color.Goldenrod) { buttonColor = Color.DarkGoldenrod; } if (color == Color.Blue) { buttonColor = Color.DarkBlue; } button1.BackgroundColor = buttonColor; }