コード例 #1
0
#pragma warning disable CA1801 // Review unused parameters
        public BaseColorSchemeSwitcherWithIconViewModel(IServiceLocator serviceLocator, IBaseColorSchemeService baseColorSchemeService)
#pragma warning restore CA1801 // Review unused parameters
        {
            Argument.IsNotNull(() => serviceLocator);
            Argument.IsNotNull(() => baseColorSchemeService);

            _serviceLocator         = serviceLocator;
            _baseColorSchemeService = baseColorSchemeService;

            var baseColorSchemes = new List <BaseColorScheme>();

            foreach (var baseColorSchemeFromService in _baseColorSchemeService.GetAvailableBaseColorSchemes())
            {
                var baseColorScheme = new BaseColorScheme
                {
                    Name     = baseColorSchemeFromService,
                    ImageUri = $"/Orc.Theming;component/Resources/Images/BaseColor_{baseColorSchemeFromService}.png"
                };

                baseColorSchemes.Add(baseColorScheme);
            }

            BaseColorSchemes = baseColorSchemes;

            var selected = _baseColorSchemeService.GetBaseColorScheme() ?? BaseColorSchemes[0].Name;

            SelectedBaseColorScheme = BaseColorSchemes.FirstOrDefault(x => x.Name == selected);
        }
コード例 #2
0
        private void OnBaseColorSchemeServiceBaseColorSchemeChanged(object sender, EventArgs e)
        {
            var newlySelected = _baseColorSchemeService.GetBaseColorScheme();

            SelectedBaseColorScheme = BaseColorSchemes.FirstOrDefault(x => x.Name == newlySelected);
        }