Bloom.ToPalaso.BetterToolTip.ApplyLocalizationToString C# (CSharp) Method

ApplyLocalizationToString() public method

L10NSharp will call this for each localized string so that the component can set the correct value in the control.
public ApplyLocalizationToString ( object control, string id, string localization ) : void
control object The control that was returned via the LocalizingInfo in /// GetAllLocalizingInfoObjects(). Will be null if that value was null.
id string a key into the ILocalizableComponent allowing it to know what /// string to localize
localization string the actual localized string
return void
        public void ApplyLocalizationToString(object control, string id, string localization)
        {
            if ((control as Control) == null || string.IsNullOrEmpty(id) || string.IsNullOrEmpty(localization))
                return;

            var subControl = control as Control;
            var normalTip = GetToolTip(subControl);
            SetToolTip(subControl, null); // setting the tooltip to null helps us get it to refresh dynamically
            var isDisabledToolTip = id.EndsWith(DISABLED_TIP);
            if (isDisabledToolTip)
            {
                // setting an existing TipWhenDisabled throws a dictionary exception,
                // so we need to remove the existing one first
                SetToolTipWhenDisabled(subControl, null);
                SetToolTipWhenDisabled(subControl, localization);
                SetToolTip(subControl, normalTip);
            }
            else
            {
                SetToolTip(subControl, localization);
            }
        }