Exemple #1
0
 void OnVisualStateChanged(object sender, OverlayInfoState e)
 {
     if (_overlayInfo != null && HighlightEnabled)
     {
         VisualizeHighlight(_overlayInfo.IsSelected);
     }
 }
        public override bool?ShouldApply(IOverlayInfo overlayInfo, Size?overlaySize, OverlayInfoState state, OverlayEffectConfiguration config, bool presenterSelected)
        {
            _presenterSelected = presenterSelected;
            _toolTipMode       = (config as ToolTipEffect)?.ToolTipMode ?? ToolTipMode.Standard;

            return(state == OverlayInfoState.Selected && (presenterSelected || _toolTipMode == ToolTipMode.Extended));
        }
Exemple #3
0
        public void UpdateEffects(IOverlayInfo overlayInfo, Size?overlaySize, OverlayInfoState state, bool presenterSelected, IList <OverlayEffectConfiguration> effects)
        {
            foreach (var effect in effects)
            {
                if (_effects.ContainsKey(effect.GetType()))
                {
                    //get processor
                    var processor = _effects[effect.GetType()];

                    //determine if it should run
                    var shouldApply = processor.ShouldApply(overlayInfo, overlaySize, state, effect, presenterSelected);

                    if (shouldApply != null)
                    {
                        if (shouldApply.Value)
                        {
                            //apply effect
                            processor.ApplyEffect(overlayInfo, overlaySize, effect);
                        }
                        else
                        {
                            //remove effect
                            processor.RemoveEffect(overlayInfo, overlaySize, effect);
                        }
                    }
                }
            }
        }
Exemple #4
0
 public override bool?ShouldApply(IOverlayInfo overlayInfo, Size?overlaySize, OverlayInfoState state, OverlayEffectConfiguration config, bool presenterSelected)
 {
     //only works when not selected from the image
     if (!presenterSelected)
     {
         return(state == OverlayInfoState.Selected);
     }
     return(null);
 }
 void OnVisualStateChanged(object sender, OverlayInfoState e)
 {
     //update effects
     if (_presenter == null)
     {
         _presenter = OverlayItemsControl.GetParent <OverlayPresenter>(this);
     }
     if (_presenter != null)
     {
         _presenter.OverlayVisualStateChanged(this, e, Effects);
     }
 }
        public void OverlayVisualStateChanged(OverlayControl overlayControl, OverlayInfoState state, IList <OverlayEffectConfiguration> effects)
        {
            //validate
            var overlayInfo = overlayControl?.OverlayInfo;

            if (overlayInfo == null || effects == null || effects.Count == 0)
            {
                return;
            }

            //update effects
            _effectManager.UpdateEffects(overlayInfo, overlayInfo.OverlaySize ?? overlayControl.DefaultOverlaySize, state, _hasPresenterSelected, effects);
        }
Exemple #7
0
 public abstract bool?ShouldApply(IOverlayInfo overlayInfo, Size?overlaySize, OverlayInfoState state, OverlayEffectConfiguration config, bool presenterSelected);
Exemple #8
0
 void OnVisualStateChanged(object sender, OverlayInfoState e)
 {
     //set the visual state
     VisualStateManager.GoToState(this, e.ToString(), true);
 }