Exemplo n.º 1
0
        public IList <TriggerStatusModel> GetAllTriggerStatus(string groupName)
        {
            IScheduler sched = quartzInstance.GetQuartzScheduler();

            string[] triggerNames = sched.GetTriggerKeys(GroupMatcher <TriggerKey> .GroupEquals(groupName)).Result.Select(p => p.Name).ToArray();// .GetTriggerNames(groupName);
            List <TriggerStatusModel> triggerStatuses = new List <TriggerStatusModel>();

            foreach (string triggerName in triggerNames)
            {
                ITrigger       trig         = sched.GetTrigger(new TriggerKey(triggerName, groupName)).Result;
                TriggerState   st           = sched.GetTriggerState(new TriggerKey(triggerName, groupName)).Result;
                DateTimeOffset?nextFireTime = trig.GetNextFireTimeUtc();
                DateTimeOffset?lastFireTime = trig.GetPreviousFireTimeUtc();


                triggerStatuses.Add(new TriggerStatusModel()
                {
                    TriggerName  = triggerName,
                    GroupName    = groupName,
                    State        = st,
                    NextFireTime = nextFireTime.HasValue?nextFireTime.Value.ToLocalTime().ToString():"",
                    LastFireTime = lastFireTime.HasValue ? lastFireTime.Value.ToLocalTime().ToString() : "",
                    JobName      = trig.JobKey.Name
                });
            }

            return(triggerStatuses);
        }
 protected override void Perform(TriggerState state)
 {
     if (state.active && state.just)
     {
         SceneTransition.LoadScene(scene.name);
     }
 }
Exemplo n.º 3
0
        /// <summary>
        /// トリガーファイルのタイムスタンプからトリガーの状態を判別、設定する。
        /// </summary>
        /// <param name="triggerFile">トリガーファイル名</param>
        /// <returns>トリガー状態</returns>
        public TriggerState SetTriggerState(string triggerFile)
        {
            // 指定されたファイル名にベースパスを連結、ファイルの存在確認
            FileInfo fi = new FileInfo(Path.Combine(TargetDirectory, triggerFile));

            if (fi.Exists)
            {
                // ローカルのトリガーファイルに対応したS3上のトリガーファイルを取得
                var key = procDirectoryName(fi.FullName);
                var om  = findS3(key);
                // S3トリガーファイルが存在するならローカルトリガーとタイムスタンプを比較
                if (null != om)
                {
                    if (om.LastModified == fi.LastAccessTimeUtc)
                    {
                        triggerState = TriggerState.Same;
                    }
                    else
                    {
                        triggerState = om.LastModified <= fi.LastWriteTimeUtc ? TriggerState.Local : TriggerState.S3;
                    }
                }
                else
                {
                    // ローカルのみに存在するのでローカル側優先とする
                    triggerState = TriggerState.Local;
                }
            }
            else
            {
                // ローカルに指定されたトリガーファイルが存在しないなら例外
                throw new Exception(string.Format("トリガーファイル[{0}]が存在しません。", triggerFile));
            }
            return(triggerState);
        }
Exemplo n.º 4
0
        // Perform a phase change on the action. Visible to observers.
        private void ChangePhaseOfAction(Phase newPhase, ref TriggerState trigger)
        {
            ThrowIfPhaseTransitionIsInvalid(m_CurrentPhase, newPhase, trigger.bindingIndex, trigger.modifierIndex);

            m_CurrentPhase = newPhase;

            // Store trigger info.
            m_LastTrigger       = trigger;
            m_LastTrigger.phase = newPhase;

            // Let listeners know.
            switch (newPhase)
            {
            case Phase.Started:
                CallListeners(ref m_OnStarted);
                break;

            case Phase.Performed:
                CallListeners(ref m_OnPerformed);
                m_CurrentPhase = Phase.Waiting;     // Go back to waiting after performing action.
                break;

            case Phase.Cancelled:
                CallListeners(ref m_OnCancelled);
                m_CurrentPhase = Phase.Waiting;     // Go back to waiting after cancelling action.
                break;
            }
        }
Exemplo n.º 5
0
        public override void ActivateEvent(TriggerState triggerState)
        {
            base.ActivateEvent(triggerState);

            if (triggerState == TriggerState.Triggered)
            {
                if (defaultActive)
                {
                    Deactivate();
                }
                else
                {
                    Activate();
                }
            }
            else
            {
                if (!defaultActive)
                {
                    Deactivate();
                }
                else
                {
                    Activate();
                }
            }
        }
Exemplo n.º 6
0
        public static string GetJobStatus(this IScheduler scheduler, IJobDetail job)
        {
            IList <ITrigger> jobTriggers = scheduler.GetTriggersOfJob(job.Key);
            var triggerStates            = new List <TriggerState>();

            foreach (ITrigger trigger in jobTriggers)
            {
                TriggerState state = scheduler.GetTriggerState(trigger.Key);
                triggerStates.Add(state);
            }

            var distinctTriggerState = triggerStates.Distinct().Count();
            var status = "Indeterminate";

            switch (distinctTriggerState)
            {
            case 0:
                status = "Unscheduled";
                break;

            case 1:
                status = triggerStates.First().ToString();
                break;

            default:
                break;
            }

            return(status);
        }
Exemplo n.º 7
0
        /// <summary>
        /// Quartz的Trigger状态转换为任务状态
        /// </summary>
        /// <param name="triggerState">Quartz的Trigger状态</param>
        /// <returns></returns>
        private JobState TriggerState2JobState(TriggerState triggerState)
        {
            switch (triggerState)
            {
            case TriggerState.Normal:
                return(JobState.Normal);

            case TriggerState.Paused:
                return(JobState.Paused);

            case TriggerState.Complete:
                return(JobState.Complete);

            case TriggerState.Error:
                return(JobState.Error);

            case TriggerState.Blocked:
                return(JobState.Blocked);

            case TriggerState.None:
                return(JobState.None);

            default:
                return(JobState.None);
            }
        }
 protected override void Perform(TriggerState state)
 {
     if (state.active && state.just)
     {
         PlayerControler.instance.dashUnlocked = true;
     }
 }
 protected override void Perform(TriggerState state)
 {
     if (state.active && state.just)
     {
         Time.timeScale = timeScale;
     }
 }
Exemplo n.º 10
0
 protected override void CalledOnFire(TriggerState TriggerState)
 {
     if (onFire != null)
     {
         onFire(TriggerState);
     }
 }
Exemplo n.º 11
0
        static public void continueTrigger(string TriggerName, string TriggerGroup)
        {
            TriggerKey   objTrigerKey = new TriggerKey(TriggerName, TriggerGroup);
            TriggerState objState     = _scheduler.GetTriggerState(objTrigerKey);

            _scheduler.ResumeTrigger(objTrigerKey);
        }
Exemplo n.º 12
0
 protected override void Perform(TriggerState state)
 {
     if (state.just && state.active)
     {
         TextboxUI.instance.StartConversation(conversation);
     }
 }
Exemplo n.º 13
0
        public IList <TriggerStatusModel> GetAllTriggerStatus(string groupName)
        {
            IScheduler sched = quartzInstance.GetQuartzScheduler();

            string[] triggerNames = sched.GetTriggerNames(groupName);
            List <TriggerStatusModel> triggerStatuses = new List <TriggerStatusModel>();

            foreach (string triggerName in triggerNames)
            {
                Trigger      trig         = sched.GetTrigger(triggerName, groupName);
                TriggerState st           = sched.GetTriggerState(triggerName, groupName);
                DateTime?    nextFireTime = trig.GetNextFireTimeUtc();
                DateTime?    lastFireTime = trig.GetPreviousFireTimeUtc();


                triggerStatuses.Add(new TriggerStatusModel()
                {
                    TriggerName  = triggerName,
                    GroupName    = groupName,
                    State        = st,
                    NextFireTime = nextFireTime.HasValue?nextFireTime.Value.ToLocalTime().ToString():"",
                    LastFireTime = lastFireTime.HasValue ? lastFireTime.Value.ToLocalTime().ToString() : "",
                    JobName      = trig.JobName
                });
            }

            return(triggerStatuses);
        }
Exemplo n.º 14
0
        private static int ChangeState(TriggerState triggerState)
        {
            switch (triggerState)
            {
            case TriggerState.None:
                return(-1);

            case TriggerState.Normal:
                return(0);

            case TriggerState.Paused:
                return(1);

            case TriggerState.Complete:
                return(2);

            case TriggerState.Error:
                return(3);

            case TriggerState.Blocked:
                return(4);

            default:
                return(-1);
            }
        }
Exemplo n.º 15
0
 private void CheckCallerState()
 {
     if (CurrentTriggerState.Equals(TriggerState.PAUSE))
     {
         CurrentTriggerState = TriggerState.IDLE;
     }
 }
Exemplo n.º 16
0
        /// <summary>
        /// 获取状态的描述
        /// </summary>
        /// <param name="state"></param>
        /// <returns></returns>
        public static string GetTriggerState(this TriggerState state)
        {
            switch (state)
            {
            case TriggerState.Blocked:
                return("阻塞");

            case TriggerState.Complete:
                return("完成");

            case TriggerState.Error:
                return("错误");

            case TriggerState.None:
                return("无状态");

            case TriggerState.Normal:
                return("正常");

            case TriggerState.Paused:
                return("暂停");

            default:
                return(state.ToString());
            }
        }
Exemplo n.º 17
0
        public void ShedulerRepeatStart(int CountSeconds, object val_MeasTask, List <int> SensorIDS, string ActionType, bool isOnline)
        {
            IScheduler sched = schedFact.GetScheduler();

            if (sched.IsStarted == false)
            {
                sched.Start();
            }
            IJobDetail job = JobBuilder.Create <SimpleJob>()
                             .WithIdentity(ShedulerStatic.Name_job_meas_task_scan, ShedulerStatic.Name_group_meas_task_scan)
                             .Build();
            ITrigger trigger = TriggerBuilder.Create()
                               .WithIdentity(ShedulerStatic.Name_trigger_meas_task_scan, ShedulerStatic.Name_group_meas_task_scan)
                               .WithSimpleSchedule(x => x.WithIntervalInSeconds(CountSeconds).RepeatForever())
                               .Build();

            sched.Context.Add(new KeyValuePair <string, object>("val_MeasTask", val_MeasTask));
            sched.Context.Add(new KeyValuePair <string, object>("val_SensorIds", SensorIDS));
            sched.Context.Add(new KeyValuePair <string, object>("val_ActionType", ActionType));
            sched.Context.Add(new KeyValuePair <string, object>("val_isOnline", isOnline));
            TriggerState state = sched.GetTriggerState(trigger.Key);

            if (state == TriggerState.None)
            {
                sched.ScheduleJob(job, trigger);
            }
            else
            {
                sched.Clear(); sched = schedFact.GetScheduler();
                if (sched.IsStarted == false)
                {
                    sched.Start();
                }
            }
        }
Exemplo n.º 18
0
        public void InitTrigger(ListViewItem Item, ITrigger Trigger)
        {
            Item.SubItems.Clear();
            TriggerState ts = scheduler.GetScheduler().GetTriggerState(Trigger.Key);

            Item.Text = ts.ToString();
            Item.SubItems.Add(Trigger.Key.Name);
            Item.SubItems.Add(Trigger.Key.Group);
            string express = "";

            if (Trigger is SimpleTriggerImpl)
            {
                express = string.Format("repeate {0} times;repeat-interval {1}ms", (Trigger as ISimpleTrigger).RepeatCount,
                                        (Trigger as ISimpleTrigger).RepeatInterval);
            }
            else
            {
                express = (Trigger as ICronTrigger).CronExpressionString;
            }

            Item.SubItems.Add(express);
            Item.SubItems.Add(FormatTime(Trigger.StartTimeUtc));
            Item.SubItems.Add(FormatTime2(Trigger.EndTimeUtc));
            Item.SubItems.Add(FormatTime2(Trigger.GetPreviousFireTimeUtc()));
            Item.SubItems.Add(FormatTime2(Trigger.GetNextFireTimeUtc()));
        }
 public tPS5000ACondition(
     Channel source,
     TriggerState condition)
 {
     this.source    = source;
     this.condition = condition;
 }
Exemplo n.º 20
0
        public async Task TestPauseAndResumeTriggers()
        {
            IJobDetail jobDetail = JobBuilder.Create <NoOpJob>()
                                   .WithIdentity("test")
                                   .Build();

            ITrigger trigger = TriggerBuilder.Create()
                               .WithIdentity("test", "abc")
                               .WithCronSchedule("* * * * * ?")
                               .Build();

            await scheduler.ScheduleJob(jobDetail, trigger);

            TriggerState state = await scheduler.GetTriggerState(new TriggerKey("test", "abc"));

            Assert.That(state, Is.EqualTo(TriggerState.Normal));
            Assert.That(state, Is.Not.EqualTo(TriggerState.Paused));

            await scheduler.PauseTriggers(GroupMatcher <TriggerKey> .GroupEquals("abc"));

            state = await scheduler.GetTriggerState(new TriggerKey("test", "abc"));

            Assert.That(state, Is.EqualTo(TriggerState.Paused));
            Assert.That(state, Is.Not.EqualTo(TriggerState.Normal));

            await scheduler.ResumeTriggers(GroupMatcher <TriggerKey> .GroupEquals("abc"));

            state = await scheduler.GetTriggerState(new TriggerKey("test", "abc"));

            Assert.That(state, Is.EqualTo(TriggerState.Normal));
            Assert.That(state, Is.Not.EqualTo(TriggerState.Paused));
        }
        public void TestRisingEdge()
        {
            //Test for A1 on rising edge of 0.5
            _test.Reset();

            var signal = new Signal()
            {
                Name = "A1"
            };
            var statement = new LogialAnalyzerTrigger.Statement.RisingEdge(signal, 0.5);
            var triggerStateForkedStatement = new TriggerStateForkedState(statement);

            triggerStateForkedStatement.AddTriggerStateThenOperations(TriggerStateThenOperations.Trigger);

            var triggerstate = new TriggerState();

            triggerstate.AddTriggerStateForkedStatement(triggerStateForkedStatement);

            var trigger = new Trigger();

            trigger.AddTriggerState(triggerstate);

            var engine = new TriggerEngine();

            engine.AddTrigger(trigger);
            engine.TriggeredUnitTest += engine_Triggered;

            engine.LogValueChange(signal, 0, DateTime.Now.Ticks);

            Assert.IsFalse(_test.WaitOne(10));

            engine.LogValueChange(signal, 1, DateTime.Now.Ticks);

            Assert.IsTrue(_test.WaitOne(10));
        }
Exemplo n.º 22
0
        public override void ActivateEvent(TriggerState ts)
        {
            switch (doorType)
            {
                case DoorType.Opening:
                    if (ts == TriggerState.Triggered)
                    {
                        Open();
                    }
                    else
                    {
                        Close();
                    }
                    break;
                case DoorType.Fading:

                    if (ts == TriggerState.Triggered)
                    {
                        Disappear();
                        foreach (MagicTile tile in tileList)
                        {
                            tile.ActivateEvent(ts);
                        }
                    }
                    else
                    {
                        Appear();
                        foreach (MagicTile tile in tileList)
                        {
                            tile.ActivateEvent(ts);
                        }
                    }
                    break;
            }
        }
Exemplo n.º 23
0
        public static IEnumerable <BaseInfo> GetCompletionInfos(
            MSBuildResolveResult rr,
            TriggerState trigger, MSBuildValueKind kind,
            ExpressionNode triggerExpression, int triggerLength,
            MSBuildRootDocument doc)
        {
            switch (trigger)
            {
            case TriggerState.Value:
                return(MSBuildCompletionExtensions.GetValueCompletions(kind, doc, rr));

            case TriggerState.Item:
                return(doc.GetItems());

            case TriggerState.Metadata:
                return(doc.GetMetadata(null, true));

            case TriggerState.Property:
                return(doc.GetProperties(true));

            case TriggerState.MetadataOrItem:
                return(((IEnumerable <BaseInfo>)doc.GetItems()).Concat(doc.GetMetadata(null, true)));

            case TriggerState.DirectorySeparator:
                return(MSBuildCompletionExtensions.GetFilenameCompletions(kind, doc, triggerExpression, triggerLength));;

            case TriggerState.MethodName:
                return(FunctionCompletion.GetMethodNameCompletions(triggerExpression));
            }
            throw new InvalidOperationException();
        }
Exemplo n.º 24
0
 public SimpleTrigger(ISimpleTrigger trigger, TriggerState state, string instanceName)
     : base(trigger, state, instanceName)
 {
     RepeatCount    = trigger.RepeatCount;
     RepeatInterval = trigger.RepeatInterval;
     TimesTriggered = trigger.TimesTriggered;
 }
Exemplo n.º 25
0
        public void ReceiveTrigger(BaseTrigger trigger, TriggerState state)
        {
            if(ActivatesOnce && IsActivated)
                return;

            switch(state)
            {
            case TriggerState.Activated:
                if (!ActivatedTriggers.Contains(trigger))
                    ActivatedTriggers.Add(trigger);
                break;
            case TriggerState.Deactivated:
                if (ActivatedTriggers.Contains(trigger))
                    ActivatedTriggers.Remove(trigger);
                break;
            default:
                return;
            }

            if(CheckRequirements())
            {
                IsActivated = true;
                DispatchResult(true);
            }
            else if(!ActivatesOnce && IsActivated)
            {
                IsActivated = false;
                DispatchResult(false);
            }
        }
        public void TestResumeJobsBeforeAddJobs()
        {
            scheduler.PauseJobs(GroupMatcher <JobKey> .GroupEquals("abc"));
            scheduler.ResumeJobs(GroupMatcher <JobKey> .GroupEquals("abc"));

            IJobDetail jobDetail = JobBuilder.Create <NoOpJob>()
                                   .WithIdentity("test", "abc")
                                   .Build();

            ITrigger trigger = TriggerBuilder.Create()
                               .WithIdentity("test", "abc")
                               .WithCronSchedule("* * * * * ?")
                               .Build();

            scheduler.ScheduleJob(jobDetail, trigger);

            TriggerState state = scheduler.GetTriggerState(new TriggerKey("test", "abc"));

            Assert.That(state, Is.EqualTo(TriggerState.Normal));
            Assert.That(state, Is.Not.EqualTo(TriggerState.Paused));

            scheduler.PauseJobs(GroupMatcher <JobKey> .GroupEquals("abc"));
            state = scheduler.GetTriggerState(new TriggerKey("test", "abc"));
            Assert.That(state, Is.EqualTo(TriggerState.Paused));
            Assert.That(state, Is.Not.EqualTo(TriggerState.Normal));

            scheduler.ResumeJobs(GroupMatcher <JobKey> .GroupEquals("abc"));
            state = scheduler.GetTriggerState(new TriggerKey("test", "abc"));
            Assert.That(state, Is.EqualTo(TriggerState.Normal));
            Assert.That(state, Is.Not.EqualTo(TriggerState.Paused));
        }
 public TriggerConditions(
     Channel source,
     TriggerState condition)
 {
     this.Source    = source;
     this.Condition = condition;
 }
Exemplo n.º 28
0
        public void ShedulerRepeatStart(int CountSeconds, object sens)
        {
            IScheduler sched = schedFact.GetScheduler();

            if (sched.IsStarted == false)
            {
                sched.Start();
            }
            IJobDetail job = JobBuilder.Create <SimpleJob>()
                             .WithIdentity(ShedulerStatic.Name_job_CheckStatusF, ShedulerStatic.Name_group_CheckStatusF)
                             .Build();
            ITrigger trigger = TriggerBuilder.Create()
                               .WithIdentity(ShedulerStatic.Name_trigger_CheckStatusF, ShedulerStatic.Name_group_CheckStatusF)
                               .WithSimpleSchedule(x => x.WithIntervalInSeconds(CountSeconds).RepeatForever())
                               .Build();

            sched.Context.Add(new KeyValuePair <string, object>("val_check", sens));
            TriggerState state = sched.GetTriggerState(trigger.Key);

            if (state == TriggerState.None)
            {
                sched.ScheduleJob(job, trigger);
            }
            else
            {
                sched.Clear(); sched = schedFact.GetScheduler();
                if (sched.IsStarted == false)
                {
                    sched.Start();
                }
            }
        }
        public void ShedulerRepeatStart(int CountSeconds)
        {
            IScheduler sched = schedFact.GetScheduler();

            if (sched.IsStarted == false)
            {
                sched.Start();
            }
            IJobDetail job = JobBuilder.Create <SimpleJob>()
                             .WithIdentity(ShedulerStatic.Name_job_CheckActivitySensor, ShedulerStatic.Name_group_CheckActivitySensor)
                             .Build();
            ITrigger trigger = TriggerBuilder.Create()
                               .WithIdentity(ShedulerStatic.Name_trigger_CheckActivitySensor, ShedulerStatic.Name_group_CheckActivitySensor)
                               .WithSimpleSchedule(x => x.WithIntervalInSeconds(CountSeconds).RepeatForever())
                               .Build();
            TriggerState state = sched.GetTriggerState(trigger.Key);

            if (state == TriggerState.None)
            {
                sched.ScheduleJob(job, trigger);
            }
            else
            {
                sched.Clear(); sched = schedFact.GetScheduler();
                if (sched.IsStarted == false)
                {
                    sched.Start();
                }
            }
        }
    public void SetDefault()
    {
        Enter                = Exit = null;
        m_Conditions         = null;
        m_IgnoreTriggerEnter = false;
        Clear();
        StopAllCoroutines();
        OnSetDefault();
        bool active = enabled && gameObject.activeInHierarchy;

        if (m_State == TriggerState.Active)
        {
            if (!active)
            {
                m_State = TriggerState.Deactive;
            }
        }
        else
        {
            if (active)
            {
                m_State = TriggerState.Active;
            }
        }
    }
Exemplo n.º 31
0
        public void ReceiveTrigger(BaseTrigger trigger, TriggerState state)
		{
			if(ActivatesOnce && IsActivated)
				return;
			
			switch(state)
			{
			case TriggerState.Activated:
                if (!ActivatedTriggers.Contains(trigger))
                    ActivatedTriggers.Add(trigger);
				break;
			case TriggerState.Deactivated:
                if (ActivatedTriggers.Contains(trigger))
                    ActivatedTriggers.Remove(trigger);
				break;
			default:
				return;
			}
			
			if(CheckRequirements())
			{
				IsActivated = true;
				DispatchResult(true);
			}
			else if(!ActivatesOnce && IsActivated)
			{
				IsActivated = false;
				DispatchResult(false);
			}
		}
Exemplo n.º 32
0
 //public void CheckForResident(PhysObj obj)
 //{
 //    //if (obj.hitBox.Bottom() + 1 <= hitBox.Top() && obj.hitBox.Left() < hitBox.Right() && obj.hitBox.Right() > hitBox.Left())
 //    //{
 //    //    residents.Add(obj);
 //    //}
 //    CollisionBox checkBox = new CollisionBox(null, hitBox.Size - new Vector2(2, 0));
 //    checkBox.SetPosition(hitBox.GetPosition() + new Vector2(0, -1));
 //    if (checkBox.GetAABB().CheckAABBCollision(obj.hitBox.GetAABB()))
 //    {
 //        residentList.Add(obj);
 //    }
 //}
 public override void ActivateEvent(TriggerState ts)
 {
     if (platformerMode == PlatformMode.PressToReverse)
     {
         int currentTime = duration;
         if (am.animating) currentTime = am.animateTime;
         if (ts == TriggerState.Triggered)
         {
             am.StartNewAnimation(type, startPosition, endPosition, duration);
             am.animateTime = duration - currentTime;
         }
         else
         {
             am.StartNewAnimation(type, endPosition, startPosition, duration);
             am.animateTime = duration - currentTime;
         }
     }
     else if (platformerMode == PlatformMode.PressToActivate)
     {
         if (ts == TriggerState.Triggered)
         {
             moving = true;
         }
         else
         {
             moving = false;
         }
     }
 }
Exemplo n.º 33
0
 public override void Shoot(TriggerState state, Vector2 position, Vector2 direction)
 {
     if (state != TriggerState.Released && currentAmmo > 0)
     {
         ObjectManager.AddObject(new Rocket(position, direction));
         currentAmmo--;
     }
 }
 private void ReportDown() {
   if (currentTriggerState == TriggerState.Up) {
     currentTriggerState = TriggerState.Down;
     OnDown(this);
     if (vibrateOnDown) Handheld.Vibrate();
     clickStartTime = Time.time;
   }
 }
Exemplo n.º 35
0
 public void SetTriggerState(TriggerState triggerState)
 {
     triggerID               = triggerState.id;
     state                   = triggerState.state;
     isTriggered             = triggerState.isTriggered;
     isReadyToBeTriggered    = triggerState.isReadyToBeTriggered;
     canReset                = triggerState.canReset;
 }
Exemplo n.º 36
0
        /// <summary>
        /// 根据组名获取任务
        /// </summary>
        /// <param name="GroupName"></param>
        /// <returns></returns>
        public static List <TaskEntity> GetTasks(string GroupName)
        {
            List <TaskEntity> jobs = new List <TaskEntity>();

            foreach (JobKey job in _scheduler.GetJobKeys(GroupMatcher <JobKey> .GroupEquals(GroupName)))
            {
                IJobDetail jobDetail = _scheduler.GetJobDetail(job);
                if (jobDetail != null)
                {
                    IList <ITrigger> triggers = GetTriggersOfJob(jobDetail.Key);
                    TaskEntity       task     = new TaskEntity();


                    TriggerState State = _scheduler.GetTriggerState(triggers[0].Key);


                    task.Name  = jobDetail.Key.Name;
                    task.Group = jobDetail.Key.Group;
                    //task.Description = jobDetail.Description;
                    task.AssemblyName = jobDetail.JobType.Namespace.ToString();
                    task.ClassName    = jobDetail.JobType.FullName.ToString();
                    task.BeginTime    = triggers[0].StartTimeUtc;
                    if (triggers[0].EndTimeUtc != null)
                    {
                        task.EndTime = triggers[0].EndTimeUtc;
                    }
                    else
                    {
                        task.EndTime = null;
                    }
                    if (triggers[0] is SimpleTriggerImpl)
                    {
                        task.Type           = 0;
                        task.RepeatCount    = ((SimpleTriggerImpl)triggers[0]).RepeatCount;
                        task.RepeatInterval = ((SimpleTriggerImpl)triggers[0]).RepeatInterval;
                        task.FiredCount     = ((SimpleTriggerImpl)triggers[0]).TimesTriggered;
                        task.Description    = ((SimpleTriggerImpl)triggers[0]).Description;
                    }
                    else if (triggers[0] is CronTriggerImpl)
                    {
                        task.Type           = 1;
                        task.CronExpression = ((CronTriggerImpl)triggers[0]).CronExpressionString.ToString();
                        task.Description    = ((CronTriggerImpl)triggers[0]).Description;
                    }
                    if (triggers[0].GetNextFireTimeUtc() != null)
                    {
                        task.NextFireTime = triggers[0].GetNextFireTimeUtc();
                    }
                    else
                    {
                        task.NextFireTime = null;
                    }
                    task.State = State.ToString();
                    jobs.Add(task);
                }
            }
            return(jobs);
        }
 public TriggerState GetTriggerState()
 {
     var triggerSate = new TriggerState();
     foreach (TriggerForkedStateDataModel triggerForkedStateDataModel in _triggerForkedStateDataModels)
     {
         triggerSate.AddTriggerStateForkedStatement(triggerForkedStateDataModel.GetTriggerForkedState());
     }
     return triggerSate;
 }
Exemplo n.º 38
0
 public override void ActivateEvent(TriggerState triggerState)
 {
     base.ActivateEvent(triggerState);
     if (emitter != null)
     {
         emitter.isActive = false;
     }
     AudioManager.portalItem.Play();
 }
Exemplo n.º 39
0
 public override void ActivateEvent(TriggerState triggerState)
 {
     if (triggerState == TriggerState.Triggered)
     {
         goodMode = true;
         pulse.color = Color.White;
         ChangeAnimationBounds(1, 1, 8);
     }
 }
Exemplo n.º 40
0
        public override void ActivateEvent(TriggerState triggerState)
        {
            base.ActivateEvent(triggerState);

            foreach (EventTrigger eventTrigger in triggerList)
            {
                eventTrigger.ActivateEvent(triggerState);
            }
        }
Exemplo n.º 41
0
        /// <summary>
        /// Sets the trigger to a triggered state using the provided data.
        /// </summary>
        /// <param name="data">The data to set the trigger with. Defaults to null.</param>
        public void Set(object data = null)
        {
            if (State == TriggerState.Set)
            {
                throw new Exception("The trigger has already been set.");
            }

            Data = data;
            State = TriggerState.Set;
        }
Exemplo n.º 42
0
 internal void Fire(TriggerState TriggerState)
 {
     fired = true;
     this.TriggerState = TriggerState;
     if (CheckConditionToFire())
     {
         CalledOnFire(TriggerState);
         if (OnFire != null)
             OnFire(this);
     }
     fired = false;
 }
Exemplo n.º 43
0
        public override void ActivateEvent(TriggerState triggerState)
        {
            base.ActivateEvent(triggerState);

            if (triggerState == TriggerState.Triggered)
            {
                visible = true;
            }
            else
            {
                visible = false;
            }
        }
  public void Update() {
    TrimMagnetWindow();
    AddToMagnetWindow();
    currentMagnetWindow = CaptureMagnetWindow();

    TriggerState newTriggerState = CheckTriggerState();
    isStable = CheckStability();
    if (!isStable) ResetState();

    if (isStable && newTriggerState != TriggerState.Neutral && triggerState != newTriggerState) {
      isDown = !isDown;
      triggerState = newTriggerState;
    }
  }
Exemplo n.º 45
0
        public override void ActivateEvent(TriggerState triggerState)
        {
            base.ActivateEvent(triggerState);

            if (triggerState == TriggerState.Triggered)
            {
                //Fade Out
                am.StartFade(30, alpha, 0);
            }
            else
            {
                //Fade in
                am.StartFade(30, alpha, 255);
            }
        }
 public override void HandleSync(ISFSObject obj)
 {
     if(obj.ContainsKey("trigger_state")){
         int newState = obj.GetInt("trigger_state");
         switch(newState){
         case 0:
             state = TriggerState.LEFT;
             break;
         case 1:
             state = TriggerState.MIDDLE;
             break;
         case 2:
             state = TriggerState.RIGHT;
             break;
         }
     }
 }
Exemplo n.º 47
0
 public override void ActivateEvent(TriggerState triggerState)
 {
     if (triggerState == TriggerState.Triggered)
     {
         foreach (EventTrigger eventTrigger in triggerList)
         {
             eventTrigger.ActivateEvent(TriggerState.Triggered);
         }
         ticking = true;
     }
     else
     {
         foreach (EventTrigger eventTrigger in triggerList)
         {
             eventTrigger.ActivateEvent(TriggerState.Untriggered);
         }
     }
 }
Exemplo n.º 48
0
        public override void ActivateEvent(TriggerState triggerState)
        {
            base.ActivateEvent(triggerState);

            if (platformMode == PlatformMode.PressToReverse)
            {
                increment = -increment;
            }
            else if (platformMode == PlatformMode.PressToActivate)
            {
                if (triggerState == TriggerState.Triggered)
                {
                    moving = true;
                }
                else
                {
                    moving = false;
                }
            }
        }
Exemplo n.º 49
0
        public override void ActivateEvent(int eventID, TriggerState triggerState)
        {
            base.ActivateEvent(eventID, triggerState);

            switch (eventID)
            {
                case 0:
                    if (triggerState == TriggerState.Triggered)
                    {
                        bool isGood = true;
                        foreach (Portal portal in gsPlay.portalList)
                        {
                            if (portal.goodMode == false) isGood = false;
                        }
                        if (isGood) gsPlay.gameStateManager.goodness++;
                        else gsPlay.gameStateManager.goodness--;
                        gsPlay.gameStateManager.currentLevel = 50;
                        gsPlay.gameStateManager.SwitchToGSPlay();
                    }
                    break;
            }
        }
Exemplo n.º 50
0
        public void ActivateEvent()
        {
            //this.triggerState = triggerState;

            foreach (EventObject eventObj in eventObjList)
            {
                if (eventObj.triggerState == TriggerState.Triggered)
                    eventObj.ActivateEvent(TriggerState.Untriggered);
                else
                    eventObj.ActivateEvent(TriggerState.Triggered);
                //if (eventObj == null)
                //    level.ActivateEvent(eventID, triggerState);
                //else
                //    eventObj.ActivateEvent(triggerState);
            }

            if (eventID != -1)
            {
                if (triggerState == TriggerState.Triggered)
                {
                    triggerState = TriggerState.Untriggered;
                    level.ActivateEvent(eventID, triggerState);
                }
                else
                {
                    triggerState = TriggerState.Triggered;
                    level.ActivateEvent(eventID, triggerState);
                }

            }

            if (eventLightning != null)
            {
                eventLightning.SetActive(!eventLightning.isActive);
            }
        }
Exemplo n.º 51
0
 public void Close()
 {
     this.State = TriggerState.Closed ;
 }
Exemplo n.º 52
0
 public PwqConditions(
     TriggerState channelA,
     TriggerState channelB,
     TriggerState channelC,
     TriggerState channelD,
     TriggerState external,
     TriggerState aux)
 {
     this.ChannelA = channelA;
     this.ChannelB = channelB;
     this.ChannelC = channelC;
     this.ChannelD = channelD;
     this.External = external;
     this.Aux = aux;
 }
Exemplo n.º 53
0
 public TriggerConditions(
     TriggerState channelA,
     TriggerState channelB,
     TriggerState channelC,
     TriggerState channelD,
     TriggerState external,
     TriggerState aux,
     TriggerState pwq)
 {
     this.ChannelA = channelA;
     this.ChannelB = channelB;
     this.ChannelC = channelC;
     this.ChannelD = channelD;
     this.External = external;
     this.Aux = aux;
     this.Pwq = pwq;
 }
Exemplo n.º 54
0
 public override void ActivateEvent(TriggerState triggerState)
 {
     visible = false;
     triggerList.Clear();
 }
Exemplo n.º 55
0
 private void CheckMagnet()
 {
     if (currentTriggerState == TriggerState.Up
         && magnet.IsDown ()) {
         currentTriggerState = TriggerState.Down;
         ReportDown ();
     } else if (currentTriggerState == TriggerState.Down
                && magnet.IsUp()) {
         currentTriggerState = TriggerState.Up;
         ReportUp();
     }
 }
 public void ResetState() {
   triggerState = TriggerState.Neutral;
   isDown = false;
 }
 /// <summary>
 /// Called on triggers fire.
 /// </summary>
 /// <param name="TriggerState">State of the trigger.</param>
 protected override void CalledOnFire(TriggerState TriggerState)
 {
     if (onFire != null)
         onFire(TriggerState);
 }
Exemplo n.º 58
0
 private void ReportUp()
 {
     if (currentTriggerState == TriggerState.Down) {
       currentTriggerState = TriggerState.Up;
       OnUp(this);
       if (vibrateOnUp) Handheld.Vibrate();
       CheckForClick();
     }
 }
Exemplo n.º 59
0
 public void Active()
 {
     this.State = TriggerState.Active ;
 }
Exemplo n.º 60
0
 public void Initialize()
 {
     this.State = TriggerState.UnActive ;
 }