/// <summary> /// Handles the EmitterRemoved event of the Interface. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="ProjectMercury.EffectEditor.EmitterEventArgs"/> instance containing the event data.</param> public void Interface_EmitterRemoved(object sender, EmitterEventArgs e) { Trace.WriteLine("Removing emitter...", "CORE"); try { foreach (Emitter emitter in this.ParticleEffect) { if (Object.ReferenceEquals(emitter, e.Emitter)) { this.ParticleEffect.Remove(e.Emitter); e.Result = CoreOperationResult.OK; return; } } e.Result = new CoreOperationResult(new Exception("Could not find the specified Emitter.")); } catch (Exception error) { e.Result = new CoreOperationResult(error); } }
protected virtual void OnEmitterRemoved(EmitterEventArgs e) { Trace.WriteLine("User requires removing an emitter...", "UI"); using (new TraceIndenter()) { Trace.WriteLine("Emitter: " + e.Emitter.Name); } using (new HourglassCursor()) { var handler = Interlocked.CompareExchange(ref this.EmitterRemoved, null, null); if (handler != null) { handler.Invoke(this, e); } } this.AssertOperationOK(e.Result); }
protected virtual void OnEmitterRemoved(EmitterEventArgs e) { Trace.WriteLine("User requires removing an emitter...", "UI"); using (new TraceIndenter()) { Trace.WriteLine("Emitter: " + e.Emitter.Name); } using (new HourglassCursor()) { var handler = Interlocked.CompareExchange(ref this.EmitterRemoved, null, null); if (handler != null) handler.Invoke(this, e); } this.AssertOperationOK(e.Result); }
/// <summary> /// Handles the EmitterRemoved event of the Interface. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="ProjectMercury.EffectEditor.EmitterEventArgs"/> instance containing the event data.</param> public void Interface_EmitterRemoved(Object sender, EmitterEventArgs e) { Trace.WriteLine("Removing emitter...", "CORE"); try { foreach (AbstractEmitter emitter in this.ParticleEffect.Emitters) { if (Object.ReferenceEquals(emitter, e.Emitter)) { this.ParticleEffect.Emitters.Remove(e.Emitter); e.Result = CoreOperationResult.OK; return; } } e.Result = new CoreOperationResult(new Exception("Could not find the specified Emitter.")); } catch (Exception error) { e.Result = new CoreOperationResult(error); } }
protected virtual void OnEmitterRemoved(EmitterEventArgs e) { if (this.EmitterRemoved != null) this.EmitterRemoved(this, e); }
/// <summary> /// Handles the EmitterRemoved event of the Interface. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="ProjectMercury.EffectEditor.EmitterEventArgs"/> instance containing the event data.</param> public void Interface_EmitterRemoved(object sender, EmitterEventArgs e) { foreach (Emitter emitter in this.ParticleEffect) { if (Object.ReferenceEquals(emitter, e.Emitter)) { this.ParticleEffect.Remove(e.Emitter); return; } } throw new ApplicationException("Could not find the specified Emitter."); }