Ejemplo n.º 1
0
        private void FavoritesButtonClicked(object sender, EventArgs e)
        {
            try
            {
                Structures.Basic.RoutesInfoBasic.RouteInfoBasic route = Request.GetRouteInfoFromLabel(lineEntry.Text);

                if (route == null)
                {
                    PlatformDependentSettings.ShowMessage(Settings.Localization.UnableToFindRouteInfo + ": " + lineEntry.Text);
                    return;
                }

                if (LineInfoCached.Select(route.ID) != null)
                {
                    return;
                }

                var fav = new LineInfoCached(route.ID);

#pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
                Request.CacheDepartureBoardAsync(fav.ConstructNewRequest());
#pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed

                favoritesStackLayout.Children.Add(new FavoriteItemContentView(favoritesStackLayout, scrollView, fav, lineEntry));
            }
            catch
            {
#pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
                Request.CheckBasicDataValidity();
#pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
            }
        }
Ejemplo n.º 2
0
        private void addButton_Click(object sender, System.EventArgs e)
        {
            Structures.Basic.RoutesInfoBasic.RouteInfoBasic route = Request.GetRouteInfoFromLabel(lineTextBox.Text);

            if (route == null || LineInfoCached.Select(route.ID) != null)
            {
                return;
            }

            var fav = new LineInfoCached(route.ID);

#pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
            Request.CacheDepartureBoardAsync(fav.ConstructNewRequest());
#pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed

            favoritesListBox.Items.Add(fav);
            favorites.Add(fav);
        }