コード例 #1
0
        public static List <Stop_times> ListaPrzystankow(Dane dane, string t_id, Routes linia, string miasto, PrzystankiGodziny PG)
        {
            List <Stop_times> przystanki = new List <Stop_times>();


            int znalazlo = 0;

            foreach (Stop_times S in PG.stop_Times)
            {
                if (S.trip_id == t_id)
                {
                    znalazlo = 1;
                    przystanki.Add(S);
                }
                else if (znalazlo == 1)
                {
                    break;
                }
            }

            przystanki.Sort();



            return(przystanki);
        }
コード例 #2
0
        public MainPage(List <string> pobMias, Dane ko, string wybraneMiasto)
        {
            wybMiaso       = wybraneMiasto;
            pobrane_Miasta = pobMias;
            dane           = ko;
            Linie kom = new Linie(wybraneMiasto, dane);

            kierunki = new Kursy(wybraneMiasto, ko);

            Godziny = new PrzystankiGodziny(wybraneMiasto, dane);
            alien   = new ALIEN(Godziny.stop_Times, kierunki.trips);

            InitializeComponent();


            for (int i = 0; i < Navigation.NavigationStack.Count; i++)
            {
                if (Navigation.NavigationStack[i] != this)
                {
                    Navigation.RemovePage(Navigation.NavigationStack[i]);
                }
            }

            Conentpejdz.Title = wybraneMiasto;

            int kolumna = 0; int rzad = 0;

            for (int i = 0; i < kom.routes.Count; i++)
            {
                if (kom.routes[i].route_short_name != null && kom.routes[i].route_short_name != string.Empty)
                {
                    PrzyciskLinia b1 = new PrzyciskLinia(kom.routes[i]);
                    var           a  = new TapGestureRecognizer();
                    a.Tapped += async(s, e) =>
                    {
                        List <string> kier   = new List <string>(alien.Kierunki(b1.liniaZprzyisku.route_id));
                        var           action = await DisplayActionSheet("Linia nr " + b1.liniaZprzyisku.route_short_name, "Anuluj", null, kier.ToArray <string>());

                        if (action != "Anuluj")
                        {
                            string t = null;
                            foreach (string T in kier)
                            {
                                if (T == action)
                                {
                                    t = T;
                                    break;
                                }
                            }
                            await Navigation.PushAsync(new ListViewPage1(dane, t, b1.liniaZprzyisku.route_id, wybMiaso, alien));
                        }
                    };
                    b1.GestureRecognizers.Add(a);

                    Laj.Children.Add(b1, kolumna, rzad);
                    if (kolumna == 4)
                    {
                        Laj.RowDefinitions.Add(new RowDefinition {
                            Height = new GridLength(1, GridUnitType.Auto)
                        });
                        rzad++;
                        kolumna = 0;
                    }
                    else
                    {
                        kolumna++;
                    }
                }
            }
        }