Example #1
0
        private void ListenToSystemColorChanges()
        {
            var uiSettings = new UISettings();

            _systemBackground = uiSettings.GetColorValue(UIColorType.Background).ToColor();
            _systemAccent     = uiSettings.GetColorValue(UIColorType.Accent).ToColor();

            uiSettings.ColorValuesChanged += (sender, args) =>
            {
#if DEBUG
                //for (int i = 0; i <= 8; i++)
                //{
                //    var colorType = (UIColorType)i;
                //    Debug.WriteLine(colorType + " = " + sender.GetColorValue(colorType));
                //}
#endif
                var background = sender.GetColorValue(UIColorType.Background).ToColor();
                if (_systemBackground != background)
                {
                    _systemBackground = background;
                    BackgroundColorChanged?.Invoke(null, EventArgs.Empty);
                }

                var accent = sender.GetColorValue(UIColorType.Accent).ToColor();
                if (_systemAccent != accent)
                {
                    _systemAccent = accent;
                    AccentColorChanged?.Invoke(null, EventArgs.Empty);
                }
            };

            _uiSettings = uiSettings;
        }
Example #2
0
 /// <summary>
 ///
 /// </summary>
 protected virtual void OnBackgroundColorChanged(Color Value)
 {
     BackgroundColorChanged?.Invoke(this, new EventArgs <Color>(Value));
 }