コード例 #1
0
        public FindLineInfoPage()
        {
            InitializeComponent();

            BindingContext = new FindStationInfoPageViewModel();

            foreach (var cached in LineInfoCached.FetchLineInfoData())
            {
                favoritesStackLayout.Children.Add(new FavoriteItemContentView(favoritesStackLayout, scrollView, cached, lineEntry));
            }
        }
コード例 #2
0
        private void removeButton_Click(object sender, EventArgs e)
        {
            foreach (LineInfoCached item in favoritesListBox.CheckedItems)
            {
                item.Remove();
            }

            favorites = LineInfoCached.FetchLineInfoData().ToList();

            favoritesListBox.Items.Clear();
            foreach (var item in favorites)
            {
                favoritesListBox.Items.Add(item);
            }

            removeButton.Enabled = favoritesListBox.CheckedItems.Count > 0;
            findButton.Enabled   = favoritesListBox.CheckedItems.Count > 0;
        }
コード例 #3
0
        public FavoriteLinesWindow()
        {
            InitializeComponent();

            Settings.Theme.Apply(this);

            lineTextBox.Text  = Settings.Localization.Line;
            addButton.Text    = Settings.Localization.Add;
            removeButton.Text = Settings.Localization.Remove;
            findButton.Text   = Settings.Localization.Find;

            favorites = LineInfoCached.FetchLineInfoData().ToList();

            foreach (var item in favorites)
            {
                favoritesListBox.Items.Add(item);
            }
        }
コード例 #4
0
ファイル: Request.cs プロジェクト: TheSpeedding/Timetables
        /// <summary>
        /// Updates all the cached results.
        /// </summary>
        public static async Task UpdateCachedResultsAsync(bool forceUpdate = false)
        {
            Task ForEachFetchedResult <Res, Req>(IEnumerable <CachedData <Res, Req> > collection, Func <Req, bool, Task> processAsync) where Res : ResponseBase where Req : RequestBase
            {
                return(Task.Run(() =>
                {
                    foreach (var fetched in collection)
                    {
                        if (forceUpdate || fetched.ShouldBeUpdated)
                        {
                            processAsync(fetched.ConstructNewRequest(), forceUpdate);
                        }
                    }
                }));
            }

            await Task.WhenAll(
                ForEachFetchedResult(StationInfoCached.FetchStationInfoData(), CacheDepartureBoardAsync),
                ForEachFetchedResult(LineInfoCached.FetchLineInfoData(), CacheDepartureBoardAsync),
                ForEachFetchedResult(JourneyCached.FetchJourneyData(), CacheJourneyAsync)
                );
        }