Ejemplo n.º 1
0
        public CaveFilterUI(CAVE_FILTER_TYPE type, CaveSearchUI parent)
        {
            this.type   = type;
            this.parent = parent;
            switch (type)
            {
            case CAVE_FILTER_TYPE.DISTRICT: Title = "Districts"; break;

            case CAVE_FILTER_TYPE.REGION: Title = "Regions"; break;

            case CAVE_FILTER_TYPE.SITE: Title = "Sites"; break;
            }
            StackLayout finalStack = new StackLayout
            {
                Padding = new Thickness(16, 10, 16, 10)
            };

            listStack = new StackLayout();
            if (type == CAVE_FILTER_TYPE.DISTRICT)
            {
                foreach (CaveDistrictModel caveDistrict in Kucha.GetCaveDistricts())
                {
                    listStack.Children.Add(new CaveDistrictGrid(caveDistrict, parent.pickedDistricts.Contains(caveDistrict)));
                }
            }
            else if (type == CAVE_FILTER_TYPE.REGION)
            {
                foreach (CaveRegionModel caveRegion in Kucha.GetCaveRegions())
                {
                    listStack.Children.Add(new CaveRegionGrid(caveRegion, parent.pickedRegions.Contains(caveRegion)));
                }
            }
            else if (type == CAVE_FILTER_TYPE.SITE)
            {
                foreach (CaveSiteModel caveSite in Kucha.GetCaveSites())
                {
                    listStack.Children.Add(new CaveSiteGrid(caveSite, parent.pickedSites.Contains(caveSite)));
                }
            }
            ScrollView scrollView = new ScrollView
            {
                Content = listStack
            };

            finalStack.Children.Add(scrollView);
            Button doneButton = new Button
            {
                Text              = "Select",
                BackgroundColor   = Color.Accent,
                TextColor         = Color.White,
                HorizontalOptions = LayoutOptions.Center
            };

            doneButton.Clicked += DoneButton_Clicked;
            doneButton.Margin   = new Thickness(0, 20, 0, 10);
            listStack.Children.Add(doneButton);

            Content = finalStack;
        }
Ejemplo n.º 2
0
        public CaveSearchHistoryUI(CaveSearchUI parent)
        {
            this.parent = parent;
            Title       = "Search History";
            ToolbarItems.Add(new ToolbarItem("Clear History", null, Clear_List));

            StackLayout contentStack = new StackLayout
            {
                Padding = 0
            };
            ListView listView = new ListView
            {
                ItemTemplate = new DataTemplate(typeof(TextCell))
            };

            listView.ItemTemplate.SetBinding(TextCell.TextProperty, "SearchTimeString");
            listView.ItemTemplate.SetBinding(TextCell.DetailProperty, "FoundResultsString");
            listView.ItemsSource = Settings.CaveSearchHistorySetting;
            listView.ItemTapped += ListView_ItemTapped;

            contentStack.Children.Add(listView);
            Content = contentStack;
        }