Ejemplo n.º 1
0
        private void RenderFavoriteData()
        {
            favoriteStationLayout.RemoveAllViews();
            favoriteLineLayout.RemoveAllViews();

            var favoriteStations = UserConfigManager.GetFavoriteStations();
            var favoriteLines    = UserConfigManager.GetFavoriteJehLines();

            var stationButtonLayout = new HierarchyButtonLayout(Context);
            var lineButtonLayout    = new HierarchyButtonLayout(Context);

            var stationButtons = favoriteStations.Select(str =>
            {
                var button = new HierarchyButtonLayout.HierarchyTextButton()
                {
                    Text = str.Name,
                    ArrowSignDirection = HierarchyButtonLayout.HierarchyTextButton.ArrowSignDirections.Right,
                };
                button.Click += FavoriteStationButton_Click;
                return(button);
            });

            var lineButtons = favoriteLines.Select(line =>
            {
                var button = new HierarchyButtonLayout.HierarchyTextButton()
                {
                    Text = line.GetName(),
                    ArrowSignDirection = HierarchyButtonLayout.HierarchyTextButton.ArrowSignDirections.Right,
                };
                button.Click += FavoriteLineButton_Click;
                return(button);
            });

            stationButtonLayout.RootButton.AddChildren(stationButtons);
            lineButtonLayout.RootButton.AddChildren(lineButtons);

            favoriteStationLayout.AddView(stationButtonLayout.Build());
            favoriteLineLayout.AddView(lineButtonLayout.Build());
        }