Beispiel #1
0
        public static void SetNextTheme()
        {
            if (ActiveTheme != null)
            {
                var themes = AvailableThemes.ToList();
                var i      = themes.IndexOf(ActiveTheme);

                var next = i + 1 == themes.Count ? 0 : i + 1;

                SetTheme(themes[next]);
            }
            else if (AvailableThemes.Count > 0)
            {
                SetTheme(AvailableThemes.First());
            }
        }
Beispiel #2
0
        /// <summary>
        /// To be called after setting _userSuppliedMap
        /// </summary>
        private async Task BuildAndApplySubsetMap()
        {
            if (_userSuppliedMap == null)
            {
                return;
            }

            // Clear existing map
            _subsetMap = null;

            // update list of available themes
            AvailableThemes = await ThemeResponsiveMapUtilities.ThemesFromMap(_userSuppliedMap);

            var systemTheme = _themeOracle.GetCurrentSystemTheme();

            // Try to build map for selected theme
            if (SelectedTheme == "Automatic" && AvailableThemes.Contains(systemTheme))
            {
                _subsetMap = await ThemeResponsiveMapUtilities.ThemedSubsetFromThemeAwareMap(_userSuppliedMap, systemTheme);
            }
            else if (AvailableThemes.Contains(SelectedTheme))
            {
                _subsetMap = await ThemeResponsiveMapUtilities.ThemedSubsetFromThemeAwareMap(_userSuppliedMap, SelectedTheme);
            }
            // Fall back to fallback theme
            else if (AvailableThemes.Contains(FallbackTheme))
            {
                _subsetMap = await ThemeResponsiveMapUtilities.ThemedSubsetFromThemeAwareMap(_userSuppliedMap, FallbackTheme);
            }
            // Fall back to first theme
            else if (AvailableThemes.Any())
            {
                _subsetMap = await ThemeResponsiveMapUtilities.ThemedSubsetFromThemeAwareMap(_userSuppliedMap, AvailableThemes.First());
            }
            // Fall back to input map
            else
            {
                _subsetMap = _userSuppliedMap;
            }

            _subsetMap.InitialViewpoint = GetCurrentViewpoint(ViewpointType.BoundingGeometry);
            // update map
            base.Map = _subsetMap;
        }
Beispiel #3
0
        public void LoadTheme(string name)
        {
            Theme theme = AvailableThemes.First(x => string.Equals(x.Name, name, StringComparison.OrdinalIgnoreCase));

            LoadTheme(theme);
        }