예제 #1
0
        private void SetupOakLocations(ObservableCollection <Forest> validForests)
        {
            OakLocations.IsVisible    = true;
            RedbudLocations.IsVisible = false;

            SetActivityMonotoring(ServiceActive,
                                  new List <Xamarin.Forms.View> {
                FlagImage_blue_mountain,
                FlagImage_stadtwald,
                FlagImage_bois_de_boulogne,
                FlagImage_sherwood,
                FlagImage_aokigahara,
                FlagImage_vondelpark,
                FlagImage_sentosa,
                FlagImage_great_trinity,
                FlagImage_fernbank,
                FlagImage_redwood,
                FlagImage_schiller,
                FlagImage_angeles,
                FlagImage_whitewater,
                FlagImage_altmar,
                FlagImage_hoh
            });

            foreach (string forestTag in new string[]
            {
                "blue_mountain", "stadtwald", "bois_de_boulogne",
                "sherwood", "aokigahara", "vondelpark",
                "sentosa", "great_trinity", "fernbank",
                "redwood", "schiller", "angeles",
                "whitewater", "altmar", "hoh"
            })
            {
                var    tagUnderscores = forestTag.Replace('_', '-');
                Forest found          = validForests.FirstOrDefault(x => x.Tag == tagUnderscores);
                if (found == null)
                {
                    AppLocationView view       = this;
                    StackLayout     flagHolder = view.FindByName <StackLayout>("FlagHolder_" + forestTag);
                    flagHolder.Opacity = 0.5;
                }
                else
                {
                    _forestButtons.Add(forestTag, new ForestButton(this, forestTag));
                }
            }
        }
예제 #2
0
            public ForestButton(AppLocationView view, string forestTag)
            {
                TapGestureRecognizer tap = new TapGestureRecognizer
                {
                    Command          = new Command <Forest>(async(forest) => await view.OnSelectLocation(forest, true)),
                    CommandParameter = view.AppViewModel.DeploymentViewModel.ForestsByTag[forestTag.Replace('_', '-')]
                };

                FlagLabel = view.FindByName <Label>("FlagLabel_" + forestTag);
                FlagLabel.GestureRecognizers.Add(tap);

                FlagImage = view.FindByName <Image>("FlagImage_" + forestTag);
                FlagImage.GestureRecognizers.Add(tap);

                FlagHolder = view.FindByName <StackLayout>("FlagHolder_" + forestTag);
                FlagHolder.GestureRecognizers.Add(tap);
            }
예제 #3
0
        private void SetupRedbudLocations(ObservableCollection <Forest> validForests)
        {
            OakLocations.IsVisible    = false;
            RedbudLocations.IsVisible = true;

            SetActivityMonotoring(ServiceActive,
                                  new List <Xamarin.Forms.View> {
                FlagHolder_cumberland,
                FlagHolder_bourassa,
                FlagHolder_gifford,
                FlagHolder_elliott,
                FlagHolder_glendalough,
                FlagHolder_epping,
                FlagHolder_vincennes_woods,
                FlagHolder_waldspielpark_scheerwald,
                FlagHolder_bukit_timah,
                FlagHolder_hinohara,
                FlagHolder_bukhansan,
                FlagHolder_sanjay_gandhi,
                FlagHolder_mont_royal
            });

            foreach (string forestTag in new string[]
            {
                "cumberland", "bourassa", "gifford",
                "elliott", "glendalough", "epping",
                "vincennes_woods", "waldspielpark_scheerwald", "bukit_timah",
                "hinohara", "bukhansan", "sanjay_gandhi",
                "mont_royal"
            })
            {
                var    tagUnderscores = forestTag.Replace('_', '-');
                Forest found          = validForests.FirstOrDefault(x => x.Tag == tagUnderscores);
                if (found == null)
                {
                    AppLocationView view       = this;
                    StackLayout     flagHolder = view.FindByName <StackLayout>("FlagHolder_" + forestTag);
                    flagHolder.Opacity = 0.5;
                }
                else
                {
                    _forestButtons.Add(forestTag, new ForestButton(this, forestTag));
                }
            }
        }