Exemple #1
0
 private void OnAfterPlugInRun(object sender, ChoPlugInRunEventArgs e)
 {
     AfterPlugInRun.Raise(sender, e);
 }
Exemple #2
0
        public object Run(object value)
        {
            try
            {
                if (Enabled)
                {
                    ChoPlugInRunEventArgs e = new ChoPlugInRunEventArgs()
                    {
                        Value = value, IsLastPlugIn = Next == null
                    };
                    _beforeRun.Raise(this, e);
                    if (e.Cancel)
                    {
                        return(e.Value);
                    }

                    value = e.Value;

                    if (_stopRequested)
                    {
                        throw new ChoPlugInStopRequestedException();
                    }

                    bool cancel = false;

                    Validate();
                    value = Execute(value, out cancel);
                    if (cancel)
                    {
                        return(value);
                    }

                    e = new ChoPlugInRunEventArgs()
                    {
                        Value = value, IsLastPlugIn = Next == null
                    };
                    _afterRun.Raise(this, e);
                    if (cancel)
                    {
                        return(e.Value);
                    }

                    value = e.Value;
                }

                if (Next != null)
                {
                    return(Next.Run(value));
                }
                else
                {
                    return(value);
                }
            }
            finally
            {
                if (Enabled)
                {
                    CleanUp();
                }
            }
        }
Exemple #3
0
 private void OnBeforePlugInRun(object sender, ChoPlugInRunEventArgs e)
 {
     ActivePlugIn = sender as ChoPlugIn;
     BeforePlugInRun.Raise(sender, e);
 }