コード例 #1
0
        private async Task LoadSettingsAsync()
        {
            try
            {
                var settings = await _settingsManager.GetSettings();

                if (!string.IsNullOrEmpty(settings.PreviousUrl))
                {
                    Url = settings.PreviousUrl;
                }
                else
                {
                    if (!string.IsNullOrEmpty(settings.Url))
                    {
                        Url = settings.Url;
                    }
                }

                if (!string.IsNullOrEmpty(settings.BackgroundImage))
                {
                    BackgroundImage = settings.BackgroundImage;
                }

                var theme = settings.Theme.ToLower();
                if (!string.IsNullOrEmpty(settings.Theme))
                {
                    if (theme.IndexOf("dark") >= 0)
                    {
                        _theme = ElementTheme.Dark;
                    }
                    if (theme.IndexOf("light") >= 0)
                    {
                        _theme = ElementTheme.Light;
                    }
                    if (theme.IndexOf("default") >= 0)
                    {
                        _theme = ElementTheme.Default;
                    }
                }
            }
            catch
            {
            }
        }