/// <summary>
        /// The main function. If the match function of the current strategy matches the module element:
        /// It 1) Creates the UIElement
        /// 2) Runs all amplify functions upon the element
        /// 3) Does something (such as push the element into a stackpanel) depending on the strategy definition
        /// </summary>
        /// <param name="item"></param>
        /// <param name="memberGroupType"></param>
        /// <param name="module"></param>
        /// <param name="target"></param>
        /// <returns></returns>
        public bool Execute(MemberInfo item, string memberGroupType, IModule module, UIElementCollection target)
        {
            if (this.Match(memberGroupType, item))
            {
                var e = Create(item, module, this.Options);
                Amplify.ForEach(a => e = a(e));
                this.Spawn(e, target);
                return(true);
            }

            return(false);
        }
Example #2
0
        /// <summary>
        /// Runs the filter on the image using the specific filter
        /// type's ProcessBlock method.
        /// </summary>
        private void RunFilter(String filter, EffectParameters param, ref FloatToInt[] input, ref FloatToInt[] output, int length)
        {
            switch (filter)
            {
            case "Echo":
                Echo echo = new Echo((EchoParameters)param);
                echo.ProcessBlock(ref input, ref output, input.Length);
                break;

            case "Amplify":
                Amplify amplify = new Amplify((AmplifyParameters)param);
                amplify.ProcessBlock(ref input, ref output, input.Length);
                break;

            case "Bass Boost":
                BassBoost BassBoost = new BassBoost((BassBoostParameters)param);
                BassBoost.ProcessBlock(ref input, ref output, input.Length);
                break;

            case "Phaser":
                Phaser Phaser = new Phaser((PhaserParameters)param);
                Phaser.ProcessBlock(ref input, ref output, input.Length);
                break;

            case "Fade In":
                FadeIn FadeIn = new FadeIn((FadeInParameters)param);
                FadeIn.ProcessBlock(ref input, ref output, input.Length);
                break;

            case "Fade Out":
                FadeOut FadeOut = new FadeOut((FadeOutParameters)param);
                FadeOut.ProcessBlock(ref input, ref output, input.Length);
                break;

            case "Distortion":
                Distortion distortion = new Distortion((DistortionParameters)param);
                distortion.ProcessBlock(ref input, ref output, input.Length);
                break;

            default:
                StatusText.Content = "Invalid filter";
                break;
            }
        }