Beispiel #1
0
        private void OnFontChanged(EventArgs e)
        {
            TextureValid = false;

            GetSize();

            if (FontChanged != null)
            {
                FontChanged.Invoke(this, e);
            }
        }
Beispiel #2
0
        private void OnFontChanged(EventArgs e)
        {
            TextureValid = false;

            if (DXFont != null && !DXFont.Disposed)
            {
                DXFont.Dispose();
            }

            if (Font != null)
            {
                DXFont = new Microsoft.DirectX.Direct3D.Font(DXManager.Device, Font);
            }

            if (FontChanged != null)
            {
                FontChanged.Invoke(this, e);
            }
        }
Beispiel #3
0
        private void AggregateFont()
        {
            compareFont.Family = Aggregate(p => p.FontFace);
            compareFont.Color  = Aggregate(p => p.TextColor);
            compareFont.Style  = Aggregate(p => p.FontStyle);
            compareFont.Size   = Aggregate(p => p.FontSize);

            if (compareFont.IsEmpty)
            {
                font = new Font(display.ParentFont);
            }
            else if (!compareFont.Equals(fontProperties) || ParentFontChanged())
            {
                Swap(ref fontProperties, ref compareFont);

                if (string.IsNullOrWhiteSpace(fontProperties.Family))
                {
                    font = new Font(display.ParentFont);
                }
                else if (display.Fonts.HasFont(fontProperties.Family) &&
                         !fontProperties.Family.Equals(Font?.Name, StringComparison.OrdinalIgnoreCase))
                {
                    font = new Font(display.Fonts[fontProperties.Family]);
                }
                else if (Font == null)
                {
                    font = new Font(display.ParentFont);
                }

                font.Color = fontProperties.Color ?? display.ParentFont?.Color ?? Font.Color;
                font.Style = fontProperties.Style ?? display.ParentFont?.Style ?? Font.Style;
                font.Size  = fontProperties.Size ?? display.ParentFont?.Size ?? Font.Size;
            }

            parentFontProperties.CopyFrom(display.ParentFont);

            FontChanged?.Invoke();
        }
        /// <summary>
        /// Starts observing system settings for changes.
        /// </summary>
        /// <remarks>
        /// System settings events will be never invoked before calling this method.
        /// </remarks>
        public void StartListening()
        {
            SystemSettings.LocaleCountryChanged +=
                (s, e) => { LocaleChanged?.Invoke(s, new EventArgs()); };
            SystemSettings.LocaleLanguageChanged +=
                (s, e) => { LocaleChanged?.Invoke(s, new EventArgs()); };
            SystemSettings.LocaleTimeFormat24HourSettingChanged +=
                (s, e) => { LocaleChanged?.Invoke(s, new EventArgs()); };
            SystemSettings.LocaleTimeZoneChanged +=
                (s, e) => { LocaleChanged?.Invoke(s, new EventArgs()); };

            try
            {
                SystemSettings.IncomingCallRingtoneChanged +=
                    (s, e) => { UserSettingsChanged?.Invoke(s, new EventArgs()); };
            }
            catch (NotSupportedException e)
            {
                Log.Warn("SystemInfo", e.Message);
            }

            try
            {
                SystemSettings.EmailAlertRingtoneChanged +=
                    (s, e) => { UserSettingsChanged?.Invoke(s, new EventArgs()); };
            }
            catch (NotSupportedException e)
            {
                Log.Warn("SystemInfo", e.Message);
            }

            try
            {
                SystemSettings.WallpaperHomeScreenChanged +=
                    (s, e) => { UserSettingsChanged?.Invoke(s, new EventArgs()); };
            }
            catch (NotSupportedException e)
            {
                Log.Warn("SystemInfo", e.Message);
            }

            try
            {
                SystemSettings.WallpaperLockScreenChanged +=
                    (s, e) => { UserSettingsChanged?.Invoke(s, new EventArgs()); };
            }
            catch (NotSupportedException e)
            {
                Log.Warn("SystemInfo", e.Message);
            }

            SystemSettings.FontSizeChanged += (s, e) => { FontChanged?.Invoke(s, new EventArgs()); };
            SystemSettings.FontTypeChanged += (s, e) => { FontChanged?.Invoke(s, new EventArgs()); };

            SystemSettings.SoundLockSettingChanged +=
                (s, e) => { SoundChanged?.Invoke(s, new EventArgs()); };
            SystemSettings.SoundSilentModeSettingChanged +=
                (s, e) => { SoundChanged?.Invoke(s, new EventArgs()); };
            SystemSettings.SoundTouchSettingChanged +=
                (s, e) => { SoundChanged?.Invoke(s, new EventArgs()); };
            SystemSettings.SoundNotificationRepetitionPeriodChanged +=
                (s, e) => { SoundChanged?.Invoke(s, new EventArgs()); };

            SystemSettings.DeviceNameChanged    += (s, e) => { OtherChanged?.Invoke(s, new EventArgs()); };
            SystemSettings.MotionSettingChanged += (s, e) => { OtherChanged?.Invoke(s, new EventArgs()); };
        }
Beispiel #5
0
 static public void ChangeFont(FontSize fontSize)
 {
     FontChanged?.Invoke(null, null);
 }
Beispiel #6
0
 /// <summary>
 /// Raises XamlChanged event notifying Noesis that it should reload the specified xaml
 /// </summary>
 public void RaiseFontChanged(Uri baseUri, string familyName, FontWeight weight,
                              FontStretch stretch, FontStyle style)
 {
     FontChanged?.Invoke(baseUri, familyName, weight, stretch, style);
     Noesis_RaiseFontChanged(swigCPtr, baseUri.OriginalString, familyName, (int)weight, (int)stretch, (int)style);
 }
 public void SendFontChanged()
 {
     FontChanged?.Invoke(this, EventArgs.Empty);
 }
Beispiel #8
0
 protected virtual void OnFontChanged()
 {
     FontChanged?.Invoke(this);
 }
 /// <summary>
 /// Invoke FontChanged event
 /// </summary>
 /// <param name="target">Type of element of this font (homework, test, subject)</param>
 /// <param name="font">New font</param>
 internal static void Call_FontChanged(FontTarget target, FontGroup font)
 {
     FontChanged?.Invoke(target, font);
 }
Beispiel #10
0
 protected virtual void OnFontChanged(EventArgs e) => FontChanged?.Invoke(this, e);
Beispiel #11
0
 private void OnFontChanged(EventArgs e) => FontChanged?.Invoke(this, e);
Beispiel #12
0
 /// <summary>
 /// Raises the <see cref="FontChanged"/> event.
 /// </summary>
 protected virtual void OnFontChanged(FontPicker sender, EventArgs e) => FontChanged?.Invoke(sender, e);
Beispiel #13
0
 /// <summary>
 /// Invoked on font size change.
 /// </summary>
 /// <param name="s">Object that sent event.</param>
 /// <param name="e">Event parameters.</param>
 private void OnFontSizeChanged(object s, FontSizeChangedEventArgs e)
 {
     FontChanged?.Invoke(s, new EventArgs());
 }
Beispiel #14
0
 /// <summary>
 /// Raises the <see cref="FontChanged"/> event.
 /// </summary>
 protected virtual void OnFontChanged(FontPicker sender) => FontChanged?.Invoke(sender);
Beispiel #15
0
 public static void SetFont(string family, float baseSize)
 {
     FontChanged?.Invoke(null, EventArgs.Empty);
 }