Fire() public method

public Fire ( object o, System args ) : bool
o object
args System
return bool
Ejemplo n.º 1
0
        public void Test0()
        {
            FireOnceEvent feo = new FireOnceEvent();

            int[] fired = new int[1];
            fired[0] = 0;
            feo.Add(delegate(object o, EventArgs args) { fired[0] = fired[0] + 1; });
            Assert.IsTrue(feo.Fire(null, null), "First fire test");
            Assert.IsFalse(feo.Fire(null, null), "Second fire test");
            Assert.IsFalse(feo.Fire(null, null), "Second fire test");
            Assert.IsFalse(feo.Fire(null, null), "Second fire test");
            Assert.AreEqual(fired[0], 1, "Fire event test 2");
        }
Ejemplo n.º 2
0
        /* **********************************************
         * Here all the methods
         */

        /**
         * Once this method is called, and the queue is emptied,
         * all future Dequeue's will throw exceptions
         * @return true if this is the first time Close was called
         */
        public virtual bool Close()
        {
            if (0 == Interlocked.Exchange(ref _closed, 1))
            {
                _close_event.Fire(this, null);
                return(true);
            }
#if BRUNET_DEBUG
            Console.Error.WriteLine("Close set");
#endif
            return(false);
        }
Ejemplo n.º 3
0
 public void Test0() {
   FireOnceEvent feo = new FireOnceEvent();
   int[] fired = new int[1];
   fired[0] = 0;
   feo.Add( delegate(object o, EventArgs args) { fired[0] = fired[0] + 1; });
   Assert.IsTrue( feo.Fire(null, null), "First fire test" );
   Assert.IsFalse( feo.Fire(null, null), "Second fire test" );
   Assert.IsFalse( feo.Fire(null, null), "Second fire test" );
   Assert.IsFalse( feo.Fire(null, null), "Second fire test" );
   Assert.AreEqual(fired[0], 1, "Fire event test 2");
 }
Ejemplo n.º 4
0
 /**
  * Subclasses call this to fire the finish event
  * @return true if this is the first time this method is called
  */
 protected bool FireFinished()
 {
     return(_finish_event.Fire(this, null));
 }