Example #1
0
 //constructor with both thicks and interval in seconds
 public Timer(int count, int interval, TimerEvent TE)
 {
     this.Count = count;
     this.Interval = interval;
     this.tE = TE;
     this.ticks = 0;
 }
Example #2
0
	// Constructor with two arguments => ticks and interval in seconds
	public Timer(int count, int interval, TimerEvent timerEvent)
	{
		this.Count = count;
		this.Interval = interval;
		this.Ticks = 0;
		this.timerEvent = timerEvent;
	}
Example #3
0
      public Event(IEventTimer timer, string name = null, TimerEvent body = null, TimeSpan? interval = null, IConfigSectionNode config = null) : base(timer)
      {
         if ((timer as IEventTimerImplementation) == null)
          throw new TimeException(StringConsts.ARGUMENT_ERROR + "Event.ctor(timer=null | timer!=IEventTimerImplementation)");

         m_Timer = timer;

         if (body!=null)
          Body += body;

         if (interval.HasValue)
          m_Interval = interval.Value;
      
         if (config!=null)
         {
           Configure(config);
           m_Name = config.AttrByName(Configuration.CONFIG_NAME_ATTR).Value;
         }
      
         if (name.IsNotNullOrWhiteSpace())
           m_Name = name;

         if (m_Name.IsNullOrWhiteSpace()) m_Name = Guid.NewGuid().ToString();

         ((IEventTimerImplementation)timer).__InternalRegisterEvent(this);
      }
Example #4
0
 public static int NextFrame(TimerEvent callback)
 {
     return Add(new TimerInfo
     {
         Event = () => { callback(); return true; }
     });
 }
        /// <summary>
        /// Creates a countdown timer on a GameObject.
        /// </summary>
        /// <param name="gameObject">The game object to add the timer to.</param>
        /// <param name="interval">How long the timer will run for.</param>
        /// <param name="id">ID of the timer.</param>
        /// <param name="timerEvent">The function to call when the timer runs out.</param>
		public static CountdownTimer CreateTimer(GameObject gameObject, float interval, string id, TimerEvent timerEvent)
        {
            CountdownTimer timer = gameObject.AddComponent<CountdownTimer>();
            timer.Initialize(interval, id);
            timer.TimeOut += new CountdownTimer.TimerEvent(timerEvent);
			return timer;
        }
Example #6
0
 public static int After(float seconds, TimerEvent callback)
 {
     return Add(new TimerInfo
     {
         Event = () => { callback(); return true; },
         Time = seconds
     });
 }
Example #7
0
        public TimerThread(TimerEvent timerHandler, object context = null, int periodMS = 1000)
        {
            m_ExitEvent = new AutoResetEvent(false);
            m_CompletionEvent = new AutoResetEvent(false);

            TimerHandler += timerHandler;
            m_PeriodMS = periodMS;

            m_Thread = new Thread(Run);
            m_Thread.Start(context);
        }
Example #8
0
 public void SetTimer(TimeSpan after, TimerEvent te)
 {
     TimerEventStruct evs = new TimerEventStruct();
     evs.time = after + elapsedTotal;
     evs.ev += te;
     for (int i = 0; i < events.Count; i++)
         if (events[i].time == (after + elapsedTotal))
         {
             events[i].ev += te;
             return;
         }
     events.Add(evs);
 }
Example #9
0
        public static void Main()
        {
            TimerEvent te1 = new TimerEvent(ExecuteEach3Seconds);
            Timer tm1 = new Timer(3, te1);

            TimerEvent te2 = new TimerEvent(SecondExecuteEach5Seconds);
            Timer tm2 = new Timer(5, te2);

            Timer tm3 = new Timer(new TimerEvent(delegate() { Console.WriteLine("One"); }));

            Thread timer1Thread = new Thread(new ThreadStart(tm1.Run));
            timer1Thread.Start();

            Thread timer2Thread = new Thread(new ThreadStart(tm2.Run));
            timer2Thread.Start();

            Thread timer3Thread = new Thread(new ThreadStart(tm3.Run));
            timer3Thread.Start();
        }
Example #10
0
    /// <summary>
    /// 添加一个Timer
    /// </summary>
    /// <param name="l_spaceTime">间隔时间</param>
    /// <param name="l_isIgnoreTimeScale">是否忽略时间缩放</param>
    /// <param name="l_callBackCount">重复调用的次数</param>
    /// <param name="l_timerName">Timer的名字</param>
    /// <param name="l_callBack">回调函数</param>
    /// <param name="l_objs">回调函数的参数</param>
    /// <returns></returns>
    public static TimerEvent AddTimer(float l_spaceTime, bool l_isIgnoreTimeScale, int l_callBackCount, string l_timerName,TimerCallBack l_callBack, params object[] l_objs)
    {
        TimerEvent l_te = new TimerEvent();

        l_te.m_timerName = l_timerName;

        l_te.m_currentTimer = 0;
        l_te.m_timerSpace = l_spaceTime;

        l_te.m_callBack = l_callBack;
        l_te.m_objs = l_objs;

        l_te.m_isIgnoreTimeScale = l_isIgnoreTimeScale;
        l_te.m_repeatCount = l_callBackCount;

        s_Instance.m_timers.Add(l_te);

        return l_te;
    }
Example #11
0
        string stringForZombieEvent(TimerEvent timerEvent)
        {
            switch (timerEvent)
            {
            case TimerEvent.BadProgramming:
                return("Bad programming! Too much memory used! (8MB)");

            case TimerEvent.AlmostInfiniteLoop:
                return("An infinite loop broke out! (15MB)");

            case TimerEvent.Leak:
                return("Memory leak! (3MB)");

            case TimerEvent.LogicBomb:
                return("A logic bomb went off in your code! (4MB)");

            case TimerEvent.OverRetain:
                return("An object was retained too many times (6MB)");

            case TimerEvent.StagnantReleasePool:
                return("Your release pools stopped draining! (23MB)");
            }
            return("");
        }
Example #12
0
 public PublishEventJob(RabbitMqEventBus bus, TimerEvent @event)
 {
     _bus   = bus;
     _event = @event;
 }
Example #13
0
 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(TimerEvent obj)
 {
     return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
 }
		string stringForZombieEvent (TimerEvent timerEvent)
		{
			switch (timerEvent) {
			case TimerEvent.BadProgramming:
				return "Bad programming! Too much memory used! (8MB)";
			case TimerEvent.AlmostInfiniteLoop:
				return "An infinite loop broke out! (15MB)";
			case TimerEvent.Leak:
				return  "Memory leak! (3MB)";
			case TimerEvent.LogicBomb:
				return "A logic bomb went off in your code! (4MB)";
			case TimerEvent.OverRetain:
				return "An object was retained too many times (6MB)";
			case TimerEvent.StagnantReleasePool:
				return  "Your release pools stopped draining! (23MB)";
			}
			return "";
		}
Example #15
0
        /// <summary>
        /// Creates a countdown timer on a GameObject.
        /// </summary>
        /// <param name="gameObject">The game object to add the timer to.</param>
        /// <param name="interval">How long the timer will run for.</param>
        /// <param name="id">ID of the timer.</param>
        /// <param name="timerEvent">The function to call when the timer runs out.</param>
        public static CountdownTimer CreateTimer(GameObject gameObject, float interval, string id, TimerEvent timerEvent)
        {
            CountdownTimer timer = gameObject.AddComponent <CountdownTimer>();

            timer.Initialize(interval, id);
            timer.TimeOut += new CountdownTimer.TimerEvent(timerEvent);
            return(timer);
        }
Example #16
0
 public static void After(float time, TimerEvent callback)
 {
     timers.Add(new TimerInfo {
         Event = () => { callback(); return(true); }, Time = time
     });
 }
Example #17
0
 //constructor with only interval in seconds and max thicks
 public Timer(int interval, TimerEvent TE)
     : this(int.MaxValue, interval, TE)
 {
 }
Example #18
0
 void Remove(TimerEvent timerEvent)
 {
     _timerEventList.Remove(timerEvent);
     WorldManager.Instance.PoolMgr.Release(timerEvent);
 }
Example #19
0
 public static void ResetTimer(TimerEvent l_timer)
 {
     if(s_instance.m_timers.Contains(l_timer))
     {
         l_timer.ResetTimer();
     }
     else
     {
         Debug.LogError("Timer ResetTimer error: dont exist timer "+ l_timer);
     }
 }
Example #20
0
 public static void DestroyTimer(TimerEvent l_timer)
 {
     if(s_instance.m_timers.Contains(l_timer))
     {
         s_instance.m_timers.Remove(l_timer);
     }
     else
     {
         Debug.LogError("Timer DestroyTimer error: dont exist timer " + l_timer);
     }
 }
Example #21
0
 public void EventManager(TimerEvent timerEvent)
 {
     if(timerEvent != null)
     {
         switch (timerEvent.Type)
         {
             case EventType.BombExplode:
                 var b = (Bomb)timerEvent.InvolvedObject;
                 if (TheCurrentMap.GetBomb(b.X, b.Y) != null)
                 {
                     switch(b.Type)
                     {
                         case BombType.Normal:
                             b.Explode(this);
                             break;
                         case BombType.Cataclysm:
                             b.ExplodeCata(this);
                             break;
                         case BombType.Flower:
                             b.ExplodeFlower(this);
                             break;
                         case BombType.Freeze:
                             b.ExplodeFreeze(this);
                             break;
                         case BombType.Dark:
                             b.ExplodeDark(this);
                             break;
                         default:
                             b.Explode(this);
                             break;
                     }
                 }
                 break;
             case EventType.BombMove:
                 var be = (Bomb)timerEvent.InvolvedObject;
                 if (!be.Move())
                 {
                     timerEvent.Timer.Stop();
                 }
                 break;
             case EventType.BombTeleport:
                 var bo = (Bomb)timerEvent.InvolvedObject;
                 if (TheCurrentMap.GetBomb(bo.X, bo.Y) != null)
                 {
                     var bt = bo.Teleport(TheCurrentMap);
                     if(!bt)
                     {
                         timerEvent.Timer.AutoReset = false;
                     }
                 }else
                 {
                     timerEvent.Timer.AutoReset = false;
                 }
                 break;
             case EventType.BombReturns:
                 var br = (Bomb)timerEvent.InvolvedObject;
                 Texture._.Mw.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(() => br.Opacity = 1));
                 TimerManager._.AddNewTimer(true, 15, true, null, br.LandBomb);
                 break;
             case EventType.Malediction:
                 var p = (Player)timerEvent.InvolvedObject;
                 p.InvertedDirections = false;
                 p.changeFace(Texture._.TypetextureList[Texture._.GetTextureKey(p)]);
                 break;
         }
     }
 }
Example #22
0
 public void OnCDTimerEnd(TimerEvent timerEvent)
 {
     mCDTimeList.Remove((uint)timerEvent.param);
 }
Example #23
0
 public int Schedule(TimerEvent task,long delay)
 {
     return Schedulemms(task,delay*1000*1000);
 }
Example #24
0
 protected void Init(float setTime, TimerEvent eventFunction, int loops, bool startTimer)
 {
     SET_TIME = setTime;
     timer = SET_TIME;
     SET_LOOPS = loops;
     loopCount = SET_LOOPS;
     timerEvent = eventFunction;
     running = false;
     if (startTimer)
         Start();
 }
Example #25
0
 //CONSTRUCTORS
 //default constructor
 public Timer(TimerEvent TE)
     : this(int.MaxValue, 1, TE)
 {
 }
Example #26
0
 public Timer(float setTime, TimerEvent eventFunction)
 {
     Init(setTime, eventFunction, 1, false);
 }
Example #27
0
        private void ProcessTimeEvent(TimerEvent theEvent)
        {
            if (theEvent is TimerControlEvent)
            {
                var tce = (TimerControlEvent)theEvent;
                if (tce.ClockType == TimerControlEvent.ClockTypeEnum.CLOCK_INTERNAL)
                {
                    Log.Warn("Timer control events are not processed by the isolated runtime as the setting is always external timer.");
                }
                return;
            }

            // Evaluation of all time events is protected from statement management
            if ((ExecutionPathDebugLog.IsEnabled) && (Log.IsDebugEnabled) && (ExecutionPathDebugLog.IsTimerDebugEnabled))
            {
                Log.Debug(".processTimeEvent Setting time and evaluating schedules");
            }

            long currentTime;

            if (theEvent is CurrentTimeEvent)
            {
                var current = (CurrentTimeEvent)theEvent;

                currentTime = current.Time;
                if (currentTime == _services.SchedulingService.Time)
                {
                    Log.Warn("Duplicate time event received for currentTime {0}", currentTime);
                }

                _services.SchedulingService.Time = currentTime;

                ProcessSchedule();

                // Let listeners know of results
                Dispatch();

                // Work off the event queue if any events accumulated in there via a route()
                ProcessThreadWorkQueue();

                return;
            }

            // handle time span
            var span               = (CurrentTimeSpanEvent)theEvent;
            var targetTime         = span.TargetTime;
            var optionalResolution = span.OptionalResolution;

            currentTime = _services.SchedulingService.Time;

            if (targetTime < currentTime)
            {
                Log.Warn("Past or current time event received for currentTime {0}", targetTime);
            }

            // Evaluation of all time events is protected from statement management
            if ((ExecutionPathDebugLog.IsEnabled) && (Log.IsDebugEnabled) && (ExecutionPathDebugLog.IsTimerDebugEnabled))
            {
                Log.Debug(".processTimeEvent Setting time span and evaluating schedules for time " + targetTime + " optional resolution " + span.OptionalResolution);
            }

            while (currentTime < targetTime)
            {
                if ((optionalResolution != null) && (optionalResolution > 0))
                {
                    currentTime += optionalResolution.Value;
                }
                else
                {
                    var nearest = _services.SchedulingService.NearestTimeHandle;
                    if (nearest == null)
                    {
                        currentTime = targetTime;
                    }
                    else
                    {
                        currentTime = nearest.Value;
                    }
                }
                if (currentTime > targetTime)
                {
                    currentTime = targetTime;
                }

                // Evaluation of all time events is protected from statement management
                if ((ExecutionPathDebugLog.IsEnabled) && (Log.IsDebugEnabled) &&
                    (ExecutionPathDebugLog.IsTimerDebugEnabled))
                {
                    Log.Debug(".processTimeEvent Setting time and evaluating schedules for time " + currentTime);
                }

                _services.SchedulingService.Time = currentTime;

                ProcessSchedule();

                // Let listeners know of results
                Dispatch();

                // Work off the event queue if any events accumulated in there via a route()
                ProcessThreadWorkQueue();
            }
        }
Example #28
0
 public Timer(float setTime, TimerEvent eventFunction, bool startTimer)
 {
     Init(setTime, eventFunction, 1, startTimer);
 }
Example #29
0
 public Timer(float d, TimerEvent e, string name)
 {
     duration  = d;
     onFire    = e;
     timerName = name;
 }
Example #30
0
 public Timer(float setTime, TimerEvent eventFunction, int loops, bool startTimer)
 {
     Init(setTime, eventFunction, loops, startTimer);
 }
Example #31
0
 /**
  * Verifies that the {@code timerEvent}'s state is {@link State#START}.
  *
  * @param timerEvent the {@link TimerEvent} to verify
  */
 private void VerifyStartState(TimerEvent timerEvent)
 {
     Assert.AreEqual(State.START, timerEvent.GetState());
     Assert.AreEqual(Duration.Zero, timerEvent.GetDuration());
     Assert.AreEqual(Duration.Zero, timerEvent.GetElapsed());
 }
Example #32
0
 public void SetEventFunction(TimerEvent eventFunction)
 {
     timerEvent = eventFunction;
 }
 public UserTimer2(TimerEvent newEv)
 {
     newEv.StopTimer+= TimerStart2;
 }
		/// <summary>
		/// Creates a repetition timer on a GameObject.
		/// </summary>
		/// <param name="gameObject">The game object to add the timer to.</param>
		/// <param name="interval">How long the timer will run for.</param>
		/// <param name="id">ID of the timer.</param>
		/// <param name="timerEvent">The function to call when the timer runs out.</param>
		public static void CreateTimer(GameObject gameObject, float interval, string id, TimerEvent timerEvent)
		{
			RepetitionTimer timer = gameObject.AddComponent<RepetitionTimer>();
			timer.Initialize(interval, id);
			timer.TimeOut += new RepetitionTimer.TimerEvent(timerEvent);
		}
Example #35
0
 private void Start()
 {
     zombie.GetComponent <HealthSystem>().health = 6;
     zombie.GetComponent <AILerp>().speed        = 2;
     increase = GameObject.FindGameObjectWithTag("Round Controller").GetComponent <TimerEvent>();
 }
		float zombieFactorForEvent (TimerEvent timerEvent)
		{
			switch (timerEvent) {
			case TimerEvent.BadProgramming:
				return .08f;
			case TimerEvent.AlmostInfiniteLoop:
				return .15f;
			case TimerEvent.Leak:
				return .03f;
			case TimerEvent.LogicBomb:
				return .04f;
			case TimerEvent.OverRetain:
				return .06f;
			case TimerEvent.StagnantReleasePool:
				return .23f;
			default:
				return 0.0f;
			}
		}
Example #37
0
 public Timer(byte ticks, int secs, TimerEvent tE)
 {
     this.Ticks = ticks;
     this.Interval = secs;
     this.Event = tE;
 }
 /// <summary>
 /// Creates a timed event which, when disposed, adds to the total time of that event type.
 /// </summary>
 /// <param name="e">The type of event</param>
 /// <returns>A timed event</returns>
 public static TimedEvent Time(TimerEvent e)
 {
     EnsureValid();
     return(new TimedEvent(_state.Watch.ElapsedTicks, e));
 }
Example #39
0
 /// <summary>
 /// 微秒级的时间
 /// </summary>
 /// <param name="task"></param>
 /// <param name="delay"></param>
 /// <returns></returns>
 private int Schedulemms(TimerEvent task, long delay)
 {
     lock (missions)
     {
           int id = AddIndex;
     TimerTaskModel model = new TimerTaskModel(id,DateTime.Now.Ticks + delay,task);
     missions.Add(id,model);
     return id;
     }
 }
Example #40
0
 public void OnCDTimerEnd(TimerEvent timerEvent)
 {
     mItemCdList.Remove((int)timerEvent.param);
 }
Example #41
0
 public int Schedule(TimerEvent task, DateTime time)
 {
     long t = time.Ticks - DateTime.Now.Ticks;
     t = Math.Abs(t);
     return Schedulemms(task,t);
 }
Example #42
0
        public override void OnInitGeometry()
        {
            var rbCmp = Arena.Owner.RigidBodyCmp;

            float width      = ConvertUnits.ToSimUnits(Arena.ArenaHalfSize.X);
            float height     = ConvertUnits.ToSimUnits(Arena.ArenaHalfSize.Y);
            float goalWidth  = ConvertUnits.ToSimUnits(100);
            float goalHeight = ConvertUnits.ToSimUnits(80);

            rbCmp.Body.CollidesWith        = (Category)CollisionType.All | (Category)CollisionType.Ball;
            rbCmp.Body.CollisionCategories = (Category)CollisionType.Wall;

            m_mobileObjs = new GameObject[2];

            for (int i = 0; i < m_mobileObjs.Length; i++)
            {
                m_mobileObjs[i] = new GameObject("Arena Mobile Object");
                Sprite mobileObjAOSprite = Sprite.CreateFromTexture("Arenas/ArenaMobLarge/AOMob.png");
                mobileObjAOSprite.Scale = 0.5f * Vector2.One;
                ColorMaskedSprite mobileObjColorSprite = new ColorMaskedSprite(mobileObjAOSprite, "ArenaOverlay3");


                var texAsset = Engine.AssetManager.GetAsset <Texture2D>("Arenas/ArenaMobLarge/materialMob" + i + ".png");
                mobileObjColorSprite.Mask   = texAsset.Content;
                mobileObjColorSprite.Color1 = Arena.ColorScheme.Color2;
                mobileObjColorSprite.Color2 = Ball.Game.GameManager.Teams[i].ColorScheme.Color1.SetSaturation(0.5f); //mettre en public depuis Arena
                mobileObjColorSprite.Color3 = Ball.Game.GameManager.Teams[i].ColorScheme.Color1.SetSaturation(0.5f);

                m_mobileObjs[i].Attach(mobileObjColorSprite);

                Asset <Texture2D>   textureAsset        = Engine.AssetManager.GetAsset <Texture2D>("Arenas/ArenaMobLarge/collisionMob.png");
                CollisionDefinition collisionDefinition = CollisionDefinitionHelper.FromTexture(textureAsset.Content, 2.0f);
                for (int iCol = 0; iCol < collisionDefinition.Entries.Length; iCol++)
                {
                    Engine.Log.Write(String.Format("Collision {0}: {1} vertices", iCol, collisionDefinition.Entries[iCol].Vertices.Length));
                }

                RigidBodyComponentParameters parameters = new RigidBodyComponentParameters {
                    Collision = collisionDefinition
                };

                RigidBodyComponent rigidBodyCmp = new RigidBodyComponent(new Asset <RigidBodyComponentParameters>(parameters));
                m_mobileObjs[i].Attach(rigidBodyCmp);

                m_mobileObjs[i].RigidBodyCmp.Body.CollidesWith        = (Category)CollisionType.Player | (Category)CollisionType.Ball;
                m_mobileObjs[i].RigidBodyCmp.Body.CollisionCategories = (Category)CollisionType.Wall;
            }

            m_mobileObjs[0].Position    = new Vector2(-mobileObjsPosX, 0);
            m_mobileObjs[1].Position    = new Vector2(mobileObjsPosX, 0);
            m_mobileObjs[0].Orientation = 0;
            m_mobileObjs[1].Orientation = 0;

            Engine.World.EventManager.AddListener((int)EventId.FirstPeriod, OnFirstPeriod);
            Engine.World.EventManager.AddListener((int)EventId.HalfTime, OnHalfTime);
            Engine.World.EventManager.AddListener((int)EventId.HalfTimeTransition, OnHalfTimeTransition);
            Engine.World.EventManager.AddListener((int)EventId.SecondPeriod, OnSecondPeriod);
            Engine.World.EventManager.AddListener((int)EventId.MatchEnd, OnMatchEnd);

            m_rotateTimer         = new Timer(Engine.GameTime.Source, m_timeFirstMS, TimerBehaviour.Restart);
            m_rotateTimerEvent    = new TimerEvent(StartRotation);
            m_rotateTimer.OnTime += m_rotateTimerEvent;
        }
Example #43
0
	// Empty constructor with interval value = 1 second and ticks value = int.MaxValue
	public Timer(TimerEvent timerEvent)
		: this(int.MaxValue, 1, timerEvent)
	{
	}
Example #44
0
 /// <summary>
 /// Creates an active timer with a certain delay.
 /// Doesn't add this to the global queue.
 /// </param>
 public Timer(int millis, TimerEvent te) : this(millis, te, false)
 {
 }
Example #45
0
    public bool PPGEvent(Context in_ctxt)
    {
        try
        {
            PPGEventContext ppgctxt = (PPGEventContext)in_ctxt;
            siPPGEventID    eventID = ppgctxt.EventID;

            if (eventID == siPPGEventID.siParameterChange)
            {
                // The Source of the event is the parameter itself
                Parameter changed = (Parameter)ppgctxt.Source;
                if ("ProcessReqTimer" == changed.ScriptName)
                {
                    int        interval = (int)changed.GetValue2(null);
                    TimerEvent evTimer  = (TimerEvent)GetXSI().EventInfos["sIBL_GUI_XSI_Server_ProcessRequestsTimerEvent"];
                    evTimer.Reset(interval, 0);
                }
                else if ("EnableRequests" == changed.ScriptName)
                {
                    bool      bValue  = (bool)changed.GetValue2(null);
                    EventInfo evTimer = GetXSI().EventInfos["sIBL_GUI_XSI_Server_ProcessRequestsTimerEvent"];
                    evTimer.Mute = bValue == false;
                }
            }
            else if (eventID == siPPGEventID.siButtonClicked)
            {
                String buttonPressed = (String)ppgctxt.GetAttribute("Button");

                if (buttonPressed == "GetHostAddress")
                {
                    // Set host param with this host address
                    IPHostEntry hostEntry   = Dns.GetHostEntry(Dns.GetHostName());
                    IPAddress[] ipAddresses = hostEntry.AddressList;

                    Property  prop = (Property)ppgctxt.Source;
                    Parameter adr  = prop.Parameters["Address"];
                    adr.PutValue2(null, ipAddresses[0].ToString());
                }
                else if (buttonPressed == "GetLocalHostAddress")
                {
                    // Set host param with this host address
                    Property  prop = (Property)ppgctxt.Source;
                    Parameter adr  = prop.Parameters["Address"];
                    adr.PutValue2(null, "127.0.0.1");
                }
                else if (buttonPressed == "LogRequests")
                {
                    Info("Logging all requests ...");
                    ClientRequests requests = new ClientRequests();
                    requests.Log();
                }
                else if (buttonPressed == "ClearRequests")
                {
                    Info("Removing all requests ...");
                    ClientRequests requests = new ClientRequests();
                    requests.Clear();
                }
                else if (buttonPressed == "StartServer" || buttonPressed == "StopServer")
                {
                    TimerEvent evTimer = (TimerEvent)GetXSI().EventInfos["sIBL_GUI_XSI_Server_ProcessRequestsTimerEvent"];
                    if (buttonPressed == "StartServer")
                    {
                        // Start server
                        Info("sIBL_GUI_XSI_Server | Server Started!");
                        Property prop = (Property)ppgctxt.Source;
                        sIBL_GUI_XSI_Server.Start((String)prop.Parameters["Address"].GetValue2(null),
                                                  (int)prop.Parameters["Port"].GetValue2(null),
                                                  (int)prop.Parameters["MaxCnx"].GetValue2(null));
                        evTimer.Mute = false;
                    }
                    else if (buttonPressed == "StopServer")
                    {
                        Info("sIBL_GUI_XSI_Server | Server Stopped!");
                        sIBL_GUI_XSI_Server.Stop();
                        evTimer.Mute = true;
                    }
                }
            }
        }
        catch (Exception e)
        {
            Error(e.ToString());
        }

        return(true);
    }
Example #46
0
 /// <summary>
 /// 移除时间;
 /// </summary>
 public void RemoveTimer()
 {
     mTimer.IsFinish = true;
     mTimer.RemoveCallBackFunc();
     mTimer = null;
 }
 /// <summary>
 /// Returns the total number of CPU ticks spent in the specified timer so far.
 /// </summary>
 internal static long GetTicks(TimerEvent e)
 {
     return(_state.TickTotals == null ? 0 : _state.TickTotals[(int)e]);
 }
Example #48
0
 public static void NextFrame(TimerEvent callback)
 {
     timers.Add(new TimerInfo {
         Event = () => { callback(); return(true); }
     });
 }
 public TimedEvent(long ticks, TimerEvent evt)
 {
     _ticksBegin = ticks;
     _event      = evt;
 }
Example #50
0
 public void addEventListener(TimerEvent id, TimerEventHandler handler)
 {
     this.handlers[(int)id] = handler;
 }
Example #51
0
    public void AddTimer(float d, TimerEvent e)
    {
        Timer t = new Timer(d, e);

        timers.Add(t);
    }
Example #52
0
 public void removeEventListener(TimerEvent id)
 {
     this.handlers[(int)id] = null;
 }
Example #53
0
 /// <summary>
 /// Creates an active timer with a certain delay.
 /// Addthis adds this to to the global queue.
 /// </param>
 public Timer(int millis, TimerEvent te, bool addthis) : this(te, addthis)
 {
     delay  = tick = millis / 1000f;
     Active = true;
 }
Example #54
0
 public int Schedule(TimerEvent task, long delay)
 {
     return(Schedulemms(task, delay * 1000 * 1000));
 }
Example #55
0
 public TimerHandler(TimerEvent timer)
 {
     mTimer = timer;
 }
Example #56
0
 /**
  * Verifies that the {@code timerEvent}'s state is {@code expectedState} and that this is the
  * first lap for the timer.
  *
  * @param timerEvent the {@link TimerEvent} to verify
  * @param expectedState the expected {@link State}
  */
 private void VerifyStateFirstLap(TimerEvent timerEvent, State expectedState)
 {
     Assert.AreEqual(expectedState, timerEvent.GetState());
     Assert.IsTrue(timerEvent.GetDuration() > Duration.Zero, timerEvent.GetDuration().ToString());
     Assert.AreEqual(timerEvent.GetElapsed(), timerEvent.GetDuration());
 }
Example #57
0
 public Timer(float d, TimerEvent e)
 {
     duration = d;
     onFire   = e;
 }
Example #58
0
 /**
  * Verifies that the {@code timerEvent}'s state is {@code expectedState} and that this is not the
  * first lap for the timer.
  *
  * @param timerEvent the {@link TimerEvent} to verify
  * @param expectedState the expected {@link State}
  */
 private void VerifyStateNotFirstLap(TimerEvent timerEvent, State expectedState)
 {
     Assert.AreEqual(expectedState, timerEvent.GetState());
     Assert.IsTrue(timerEvent.GetDuration().CompareTo(Duration.Zero) > 0);
     Assert.IsTrue(timerEvent.GetElapsed().CompareTo(timerEvent.GetDuration()) > 0);
 }
Example #59
0
 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(TimerEvent obj)
 {
     return((obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr);
 }
Example #60
0
 /**
  * Verifies that the {@code timerEvent}'s description is {@code expectedDescription}.
  *
  * @param timerEvent the {@link TimerEvent} to verify
  * @param expectedDescription the expected description
  */
 private void VerifyDescription(TimerEvent timerEvent, string expectedDescription)
 {
     Assert.AreEqual(expectedDescription, timerEvent.GetDescription());
 }