Example #1
0
        /// <summary>
        /// Handles the ModifierRemoved event of the Interface.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="ProjectMercury.EffectEditor.ModifierEventArgs"/> instance containing the event data.</param>
        public void Interface_ModifierRemoved(object sender, ModifierEventArgs e)
        {
            Trace.WriteLine("Removing modifier...", "CORE");

            try
            {
                foreach (Emitter emitter in this.ParticleEffect)
                {
                    foreach (Modifier modifier in emitter.Modifiers)
                    {
                        if (Object.ReferenceEquals(modifier, e.Modifier))
                        {
                            emitter.Modifiers.Remove(e.Modifier);

                            e.Result = CoreOperationResult.OK;

                            return;
                        }
                    }
                }

                e.Result = new CoreOperationResult(new Exception("Could not find the specified Modifier."));
            }
            catch (Exception error)
            {
                e.Result = new CoreOperationResult(error);
            }
        }
Example #2
0
        protected virtual void OnModifierRemoved(ModifierEventArgs e)
        {
            Trace.WriteLine("User requires removing a modifier...");

            using (new HourglassCursor())
            {
                var handler = Interlocked.CompareExchange(ref this.ModifierRemoved, null, null);

                if (handler != null)
                {
                    handler.Invoke(this, e);
                }
            }

            this.AssertOperationOK(e.Result);
        }
Example #3
0
        protected virtual void OnModifierRemoved(ModifierEventArgs e)
        {
            Trace.WriteLine("User requires removing a modifier...");

            using (new HourglassCursor())
            {
                var handler = Interlocked.CompareExchange(ref this.ModifierRemoved, null, null);

                if (handler != null)
                    handler.Invoke(this, e);
            }

            this.AssertOperationOK(e.Result);
        }
Example #4
0
        /// <summary>
        /// Handles the ModifierRemoved event of the Interface.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="ProjectMercury.EffectEditor.ModifierEventArgs"/> instance containing the event data.</param>
        public void Interface_ModifierRemoved(Object sender, ModifierEventArgs e)
        {
            Trace.WriteLine("Removing modifier...", "CORE");

            try
            {
                foreach (AbstractEmitter emitter in this.ParticleEffect.Emitters)
                {
                    foreach (AbstractModifier modifier in emitter.Modifiers)
                    {
                        if (Object.ReferenceEquals(modifier, e.Modifier))
                        {
                            emitter.Modifiers.Remove(e.Modifier);

                            e.Result = CoreOperationResult.OK;

                            return;
                        }
                    }
                }

                e.Result = new CoreOperationResult(new Exception("Could not find the specified Modifier."));
            }
            catch (Exception error)
            {
                e.Result = new CoreOperationResult(error);
            }
        }
 protected virtual void OnModifierRemoved(ModifierEventArgs e)
 {
     if (this.ModifierRemoved != null)
         this.ModifierRemoved(this, e);
 }
Example #6
0
        /// <summary>
        /// Handles the ModifierRemoved event of the Interface.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="ProjectMercury.EffectEditor.ModifierEventArgs"/> instance containing the event data.</param>
        public void Interface_ModifierRemoved(object sender, ModifierEventArgs e)
        {
            foreach (Emitter emitter in this.ParticleEffect)
            {
                foreach (Modifier modifier in emitter.Modifiers)
                {
                    if (Object.ReferenceEquals(modifier, e.Modifier))
                    {
                        emitter.Modifiers.Remove(e.Modifier);

                        return;
                    }
                }
            }

            throw new ApplicationException("Could not find the specified Modifier.");
        }