Example #1
0
        private static SettingSection BuildGallerySection()
        {
            var section = new SettingSection(SystemUtil.GetStringResource("SettingSection_ContentsSync"));

            section.Add(new ToggleSetting
            {
                SettingData = new AppSettingData <bool>()
                {
                    Title         = SystemUtil.GetStringResource("Setting_PrioritizeOriginalSize"),
                    Guide         = SystemUtil.GetStringResource("Guide_PrioritizeOriginalSize"),
                    StateProvider = () => ApplicationSettings.GetInstance().PrioritizeOriginalSizeContents,
                    StateObserver = enabled => ApplicationSettings.GetInstance().PrioritizeOriginalSizeContents = enabled
                }
            });

            section.Add(new ComboBoxSetting(new AppSettingData <int>()
            {
                Title         = SystemUtil.GetStringResource("ContentTypes"),
                Guide         = SystemUtil.GetStringResource("ContentTypesGuide"),
                StateProvider = () => (int)ApplicationSettings.GetInstance().RemoteContentsSet,
                StateObserver = newValue =>
                {
                    if (newValue != -1)
                    {
                        ApplicationSettings.GetInstance().RemoteContentsSet = (ContentsSet)newValue;
                    }
                },
                Candidates = SettingValueConverter.FromContentsSet(EnumUtil <ContentsSet> .GetValueEnumerable())
            }));

            return(section);
        }
        private static SettingSection BuildGallerySection()
        {
            var section = new SettingSection(SystemUtil.GetStringResource("SettingSection_ContentsSync"));

            section.Add(new ToggleSetting(
                            new AppSettingData <bool>(SystemUtil.GetStringResource("Setting_PrioritizeOriginalSize"), SystemUtil.GetStringResource("Guide_PrioritizeOriginalSize"),
                                                      () => { return(ApplicationSettings.GetInstance().PrioritizeOriginalSizeContents); },
                                                      enabled => { ApplicationSettings.GetInstance().PrioritizeOriginalSizeContents = enabled; })));

            section.Add(new ComboBoxSetting(
                            new AppSettingData <int>(SystemUtil.GetStringResource("ContentTypes"), SystemUtil.GetStringResource("ContentTypesGuide"),
                                                     () => { return((int)ApplicationSettings.GetInstance().RemoteContentsSet); },
                                                     newValue =>
            {
                if (newValue != -1)
                {
                    ApplicationSettings.GetInstance().RemoteContentsSet = (ContentsSet)newValue;
                }
            },
                                                     SettingValueConverter.FromContentsSet(EnumUtil <ContentsSet> .GetValueEnumerable()))));

            section.Add(new ToggleSetting(
                            new AppSettingData <bool>(SystemUtil.GetStringResource("Setting_EnableSaveToOneDrive"), SystemUtil.GetStringResource("Guide_EnableSaveToOneDrive"),
                                                      () => { return(ApplicationSettings.GetInstance().SaveToOneDriveEnabled); },
                                                      enabled => { ApplicationSettings.GetInstance().SaveToOneDriveEnabled = enabled; })));

            return(section);
        }