public async Task Pause(TimeSpan timeout) { await Stop(); Status = AgentStatus.Paused; _tracker.Publish(new ShardState(_projectionShard, ShardAction.Paused)); #pragma warning disable 4014 // ReSharper disable once MethodSupportsCancellation Task.Run(async() => #pragma warning restore 4014 { // ReSharper disable once MethodSupportsCancellation await Task.Delay(timeout); _cancellationSource = new CancellationTokenSource(); _cancellation = _cancellationSource.Token; await _daemon.TryAction(this, async() => { try { await Start(_daemon); } catch (Exception e) { _logger.LogError(e, "Error trying to start shard '{ShardName}' after pausing", _projectionShard.Name); throw new ShardStartException(_projectionShard.Name, e); } }, _cancellation); }); }
public void Reinitialize() { visualObject.gameObject.SetActive(true); status = AgentStatus.None; rigidBody.velocity = Vector3.zero; transform.position = originalPosition; }
/// <summary> /// Event arguments for changing Agent's Status. /// </summary> /// <param name="from">Status from which agent is changing.</param> /// <param name="to">Status to which agent is changing.</param> /// <param name="time">Time stamp of status change.</param> /// <param name="message">Detailed message.</param> public AgentStatusChangeEventArgs(AgentStatus from, AgentStatus to, DateTime time, string message = "") { this.From = from; this.To = to; this.Time = time; this.Message = message; }
public AgentTransition(AgentIdentity id, ulong timestamp, AgentStatus src, AgentStatus dst) { Agent = id; Timestamp = timestamp; SourceState = src; TargetState = dst; }
public AgentStatusViewModel(MerkatoDbContext context, AgentStatus B) : this(context) { this.Id = B.Id; this.Code = B.Code; this.Name = B.Name; this.Description = B.Description; }
public async Task <IActionResult> Edit(int id, [Bind("Id,Code,Name,Description,UserId,LastDateModified")] AgentStatus agentStatus) { if (id != agentStatus.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(agentStatus); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!AgentStatusExists(agentStatus.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(agentStatus)); }
// // A remote version of Evaluate // protected override string Evaluate(string input) { ns.WriteString(input); while (true) { AgentStatus s = (AgentStatus)ns.ReadByte(); switch (s) { case AgentStatus.PARTIAL_INPUT: return(input); case AgentStatus.ERROR: string err = ns.GetString(); Console.Error.WriteLine(err); break; case AgentStatus.RESULT_NOT_SET: return(null); case AgentStatus.RESULT_SET: string res = ns.GetString(); Console.WriteLine(res); return(null); } } }
public NavAgentComponent( float3 position, Quaternion rotation, float stoppingDistance = 0f, float moveSpeed = 4f, float acceleration = 1f, float rotationSpeed = 360f, int areaMask = -1 ) { this.nextWayPoint = false; this.stoppingDistance = stoppingDistance; this.moveSpeed = moveSpeed; this.acceleration = acceleration; this.rotationSpeed = rotationSpeed; this.areaMask = areaMask; destination = Vector3.zero; currentMoveSpeed = 0; queryVersion = 0; status = AgentStatus.Idle; this.position = position; this.rotation = rotation; nextPosition = new float3(Mathf.Infinity, Mathf.Infinity, Mathf.Infinity); remainingDistance = 0; currentWaypoint = Vector3.zero; nextWaypointIndex = 0; totalWaypoints = 0; }
public AgentRecord(int id, Process p, RemoteTestAgent a, AgentStatus s) { this.Id = id; this.Process = p; this.Agent = a; this.Status = s; }
void move() { // set the speed float speed = 3.0f; //move along the time float step = speed * Time.deltaTime; if (path.Count > 0) { var target = path[path.Count - 1]; // pick the vertex and move towards to it transform.position = Vector3.MoveTowards(transform.position, target, step); // move to the chosen place and cut it from the path plan. if (Vector3.Distance(transform.position, target) < 0.005f) { path.RemoveAt(path.Count - 1); } } else { status = AgentStatus.Reached; Helper.NumOfSuccess(); status = AgentStatus.Awaiting; Invoke(nameof(moveToNewDest), Random.Range(0.2f, 1)); return; } //Debug.Log("MoveSuccess"); }
/// <summary> /// Sets up an agent to move from one world space location to another, independent of the actual NavMesh data involved /// </summary> /// <param name="startPosition">Where the motion begins</param> /// <param name="endPosition">Where the motion will complete</param> void SetupDynamicMotion(Vector3 startPosition, Vector3 endPosition) { m_AgentStatus = AgentStatus.Dynamic; m_DynamicMotionStart = startPosition; m_DynamicMotionDestination = endPosition; var speed = m_Agent.speed; m_DynamicMotionTime = (endPosition - startPosition).magnitude / speed; m_DynamicMotionTimer = m_DynamicMotionTime; m_CurrentSpeed = speed; m_LastValidPathEnd = m_LastValidDestination; if (m_DynamicMotion == BackupMotion.DriveWithEvent) { if (m_DynamicMotionProvider == null) { Debug.LogWarning("Set to use script-driven dynamic motion but no ICustomDynamicMotionProvider available. Using snap action instead."); m_DynamicMotion = BackupMotion.SnapToValidPoint; } else { m_DynamicMotionProvider.Complete = false; m_DynamicMotionProvider.DynamicMotionBegin(m_DynamicMotionStart, m_DynamicMotionDestination); } } }
public async Task <long> Start(ProjectionDaemon daemon) { _logger.LogInformation("Starting projection agent for '{ShardName}'", _projectionShard.Name); var singleFile = new ExecutionDataflowBlockOptions { EnsureOrdered = true, MaxDegreeOfParallelism = 1, CancellationToken = _cancellation, }; _commandBlock = new ActionBlock <Command>(processCommand, singleFile); _loader = new TransformBlock <EventRange, EventRange>(loadEvents, singleFile); _tracker = daemon.Tracker; _daemon = daemon; _fetcher = new EventFetcher(_store, _projectionShard.EventFilters); _hopper = _projectionShard.Start(this, _logger, _cancellation); _loader.LinkTo(_hopper, e => e.Events.Any()); var lastCommitted = await _store.Advanced.ProjectionProgressFor(_projectionShard.Name, _cancellation); _commandBlock.Post(Command.Started(_tracker.HighWaterMark, lastCommitted)); _subscription = _tracker.Subscribe(this); _logger.LogInformation("Projection agent for '{ShardName}' has started from sequence {LastCommitted} and a high water mark of {HighWaterMark}", _projectionShard.Name, lastCommitted, _tracker.HighWaterMark); Status = AgentStatus.Running; Position = lastCommitted; return(lastCommitted); }
public void ResetAgent() { this.agentID = 0; this.agentName = ""; this.loginName = ""; this.password = ""; this.phoneNumber = ""; this.shortDescription = ""; this.isAdministrator = false; this.allowManualDial = false; this.verificationAgent = false; this.inBoundAgent = false; this.isDeleted = false; this.agentActivityID = 0; this.campaignID = 0; this.agentStatusID = 0; this.receiptModeID = 0; this.loginTime = DateTime.Now; this.logoutTime = DateTime.Now; this.dateCreated = DateTime.Now; this.dateModified = DateTime.Now; this.status = AgentStatus.NoStatus; this.outboundCallerID = ""; this.stationNumber = ""; this.allwaysOffHook = false; this.campaignDB = ""; this.pauseInformed = false; this.idleInformed = false; this.phoneInformed = false; this.isReset = false; this.callUniqueKey = 0; }
public AgentRecord(Guid id, Process p, ITestAgent a, AgentStatus s) { this.Id = id; this.Process = p; this.Agent = a; this.Status = s; }
public void UpdateStatus(AgentStatus status) { if (lbStatus.InvokeRequired) { var refresh = new RefreshAgentStatus(UpdateStatus); this.Invoke(refresh, new object[] { status }); } else { if (status == AgentStatus.ONLINE) { if (!string.Equals(lbStatus.Text, status.ToString())) { lbStatus.Text = status.ToString(); lbStatus.BackColor = System.Drawing.Color.LimeGreen; lbStatus.ForeColor = System.Drawing.Color.Black; } } else { if (status == AgentStatus.ERROR || status == AgentStatus.OFFLINE) { if (!string.Equals(lbStatus.Text, status.ToString())) { lbStatus.Text = status.ToString(); lbStatus.BackColor = System.Drawing.Color.Red; lbStatus.ForeColor = System.Drawing.Color.White; } } } } }
// Token: 0x06000935 RID: 2357 RVA: 0x00042533 File Offset: 0x00040733 private static EngineComponentStatus ToEngineStatus(AgentStatus agentStatus) { if (!RemoteCollectorEngineComponent.EngineUpStatuses.Contains(agentStatus)) { return(EngineComponentStatus.Down); } return(EngineComponentStatus.Up); }
public AgentController(ConfigController config, CryptoController crypto, ICommModule commModule) { AgentStatus = AgentStatus.Starting; Config = config; Crypto = crypto; CommModule = commModule; }
void Start() { fighterBody = GetComponent <Rigidbody>(); agentStatus = GetComponent <AgentStatus>(); fighterWeaponFire = GetComponentInChildren <FighterWeaponFire>(); gameManager = GameObject.Find("GameManager"); cityGenerator = gameManager.GetComponent <CityGenerator>(); SetModel(fighterCaptureBehavior, CaptureArtifact); }
public bool InitializeOpenVR() { EVRInitError initError = EVRInitError.None; vrSystem = OpenVR.Init(ref initError, EVRApplicationType.VRApplication_Background); status = initError == EVRInitError.None ? AgentStatus.Ready : AgentStatus.Error; // TODO: specify, why error happened. return(initError == EVRInitError.None); }
private void DoBehaviour() { switch (status) { case AgentStatus.InPatrolling: Patrol(); break; case AgentStatus.InWaitingTime: waitTimer -= Time.deltaTime; if (waitTimer <= 0) { status = AgentStatus.InPatrolling; previous_status = AgentStatus.InWaitingTime; waitTimer = waitTime; } break; case AgentStatus.InSearching: if (searchPath == null || searchPath.Count == 0) { //exit search mode status = previous_status; previous_status = AgentStatus.InSearching; break; } // if we are not at the path destination, we move to there Vector3 dest = new Vector3(searchPath[searchPath.Count - 1].pos.x, 0, searchPath[searchPath.Count - 1].pos.z); if (Vector3.SqrMagnitude(dest - transform.position) > threshold) { //transform.position = Vector3.MoveTowards(transform.position, dest, searchSpeed); gameObject.GetComponent <NavMeshAgent>().SetDestination(dest); //Debug.Log(dest + " " + Vector3.SqrMagnitude(searchPath[0].pos - transform.position)); } else { //searchPath.RemoveAt(0); searchPath.Clear(); } break; case AgentStatus.InControlled: break; default: break; } }
public AgentStatus GetModel() { AgentStatus b = new AgentStatus(); b.Id = this.Id; b.Code = this.Code; b.Name = this.Name; b.Description = this.Description; return(b); }
public void ReportStatus(int pid, AgentStatus status) { AgentRecord r = agentData[pid]; if (r == null) { throw new ArgumentException("Specified process is not in the agency database", "pid"); } r.Status = status; }
/// <summary> /// Updates the agent status. /// </summary> /// <param name="agentStatus">The agent status.</param> private void UpdateAgentStatus(AgentStatus agentStatus) { _agent.Status = agentStatus.ToString(); Task task = Task.Run(async() => { await _apiClient.AgentProcessor.Update(_agent); }, _mainCancellationToken); task.Wait(_mainCancellationToken); }
public async Task <IActionResult> Create([Bind("Id,Code,Name,Description,UserId,LastDateModified")] AgentStatus agentStatus) { if (ModelState.IsValid) { _context.Add(agentStatus); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(agentStatus)); }
void UpdateStatus() { if (agentStatus != null) { agentStatus.UnregisterAction(UpdateInfo); } agentStatus = selectedAgent.Value.status; if (agentStatus != null) { agentStatus.RegisterAction(UpdateInfo); } }
void moveAlongPath() { //generateDest(); path = PathFinding.FindPath(rvg, transform.position, dest); UnityEngine.Assertions.Assert.IsTrue(dest != null, "dest is null"); UnityEngine.Assertions.Assert.IsTrue(rvg != null, "rvg is null"); UnityEngine.Assertions.Assert.IsTrue(transform.position != null, "agent position is null"); status = AgentStatus.Moving; move(); }
public void SetAnxietyLevel(float level) { m_anxietyLevel = level; if (m_anxietyLevel > MAX_ANXIETY_LEVEL * 0.75f) { m_status = AgentStatus.ANXIOUS; } else { m_status = AgentStatus.NORMAL; } }
/* * public async Task<ConversationStatus[]> QueryConversationStatusAsync(Func<ConversationStatus, bool> func) * { * var tableClient = StorageAccount.CreateCloudTableClient(); * var tableRef = tableClient.GetTableReference(TABLENAME_AGENT_CONVERSATION_STATUS); * await tableRef.CreateIfNotExistsAsync(); * try * { * try * { * var query = tableRef.CreateQuery<ConversationStatus>().Where(func); * * return query.ToArray(); * } * catch (Exception exp) * { * throw exp; * } * finally * { * * } * } * catch (Exception exp) * { * throw; * } * finally * { * } * } * * public async Task<ConversationStatus[]> QueryConversationStatusAsync(string agentId) * { * return await QueryConversationStatusAsync(x => x.AgentID == agentId); * } */ public async Task <TableResult> UpdateAgentStatusAsync(AgentStatus obj) { var tableClient = StorageAccount.CreateCloudTableClient(); var tableRef = tableClient.GetTableReference(TABLENAME_AGENT_SIGNIN_STATUS); await tableRef.CreateIfNotExistsAsync(); var blobClient = StorageAccount.CreateCloudBlobClient(); var blobContainer = blobClient.GetContainerReference(CONTAINERNAME_AGNET_LEASE_LOCK); blobContainer.CreateIfNotExists(); var lockBlob = blobContainer.GetBlockBlobReference($"{obj.ConversationId}.lock"); if (!lockBlob.Exists()) { lockBlob.UploadText(""); } try { var leaseId = lockBlob.AcquireLease( TimeSpan.FromSeconds(15), null); try { var tableOperation = TableOperation.InsertOrMerge(obj); var result = tableRef.Execute(tableOperation); var newRecord = tableRef.Execute(TableOperation.Retrieve <DynamicTableEntity> ( obj.PartitionKey, obj.RowKey )); return(newRecord); } catch (Exception exp) { throw; } finally { lockBlob.ReleaseLease(AccessCondition.GenerateLeaseCondition(leaseId)); } } catch (Exception exp) { throw; } finally { } }
public void ReportStatus(Guid agentId, AgentStatus status) { AgentRecord r = _agentData[agentId]; if (r == null) { throw new ArgumentException( string.Format("Agent {0} is not in the agency database", agentId), "agentId"); } r.Status = status; }
public void OnVRApplicationChange(uint appPid) { Console.WriteLine(appPid); if (appPid > 0) { currentPid = appPid; status = AgentStatus.AppRunning; } else if (currentPid != launcherPid) { RunImmersionVR(); } }
public AgentRecord( int id, Process p, RemoteTestAgent a, AgentStatus s ) { this.Id = id; this.Process = p; this.Agent = a; this.Status = s; }
public void ReportStatus( int pid, AgentStatus status ) { AgentRecord r = agentData[pid]; if ( r == null ) throw new ArgumentException( "Specified process is not in the agency database", "pid" ); r.Status = status; }
public Agent UpdateOperator(Guid operatorId, AgentStatus? status, bool? allowOutgoingCalls, bool? record, AnswerType? answerType, string redirectToNumber) { if (!CRMSecurity.IsAdmin && !operatorId.Equals(SecurityContext.CurrentAccount.ID)) throw CRMSecurity.CreateSecurityException(); var dao = DaoFactory.GetVoipDao(); var phone = dao.GetNumbers().FirstOrDefault(r => r.Settings.Operators.Exists(a => a.Id == operatorId)).NotFoundIfNull(); var oper = phone.Settings.Operators.Find(r => r.Id == operatorId); if (status.HasValue) { oper.Status = status.Value; } if (allowOutgoingCalls.HasValue) { oper.AllowOutgoingCalls = phone.Settings.AllowOutgoingCalls && allowOutgoingCalls.Value; } if (record.HasValue) { oper.Record = phone.Settings.Record && record.Value; } if (answerType.HasValue) { oper.Answer = answerType.Value; } if (!string.IsNullOrEmpty(redirectToNumber)) { oper.RedirectToNumber = redirectToNumber; } dao.SaveOrUpdateNumber(phone); return oper; }
/// <summary> /// Initializes the Agent /// </summary> public void Initialize() { //try //{ _status = AgentStatus.Init; Logger.WriteLine("Initializing Agent...", Logger.Severity.Debug, LOGNAME); //Get the Agent from the event reference Illuminate.Tools.Invoker inv = new Illuminate.Tools.Invoker(); _agent = (Illuminate.Interfaces.IAgent)inv.Invoke(_agentPath, typeof(Illuminate.Interfaces.IAgent)); Logger.WriteLine("Agent Invoked...", Logger.Severity.Debug, LOGNAME); if (_agent != null) { Logger.WriteLine("Initializing Invoked Plugin...", Logger.Severity.Debug, LOGNAME); Logger.WriteLine("Starting Agent...", Logger.Severity.Debug); Contexts.AgentContext context = new Contexts.AgentContext(_nodeId, _sectionName, AgentId, _com, this); context.LogName = LOGNAME; _standard = (AgentStandard)_agent; _standard.InitializeAgent(context); _agent.InitializeAgent(context); Logger.WriteLine("Invoked Plugin Initialized...", Logger.Severity.Debug, LOGNAME); } else { Logger.WriteLine("Invoked Agent is NULL...", Logger.Severity.Debug, LOGNAME); } //} //catch (Exception e) //{ // _status = AgentStatus.ErrorInitializing; // string ErrorMsg = "Error trying to initialize agent: " + _agentPath + " " + e.Message.Replace("\r", "").Replace("\n", ""); // throw new Illuminate.Exceptions.ErrorException(ErrorMsg); //} }
public void KillAgent() { if (_agentThread != null) { _stopAgent = true; _agentThread.Abort(); while (true) { Thread.Sleep(1); if (_agentThread.ThreadState == System.Threading.ThreadState.Aborted) break; if (_agentThread.ThreadState == System.Threading.ThreadState.Stopped) break; } _status = AgentStatus.Killed; } }
/// <summary> /// Starts the timer if the Agent is enabled. /// </summary> public void Start() { Logger.WriteLine("Starting Agent...", Logger.Severity.Debug, LOGNAME); Logger.WriteLine("Status = " + _status.ToString() + "...", Logger.Severity.Debug, LOGNAME); Logger.WriteLine("Continuing Initialization", Logger.Severity.Debug, LOGNAME); _status = AgentStatus.Starting; Initialize(); //Initialize the timer bool timerStarted = InitializeTimer(); //If the timer was initialized, enable the timer. if (timerStarted) { _stopAgent = false; _status = AgentStatus.Started; } else { _status = AgentStatus.Error; } }
/// <summary> /// Stops the timer /// </summary> public void Stop() { lock (this) { //if this agent did not initialize, it is already stopped (thread was never started) //ErrorInitializing is different from Error (With Error, the thread was started) if (_status == AgentStatus.ErrorInit || _status == AgentStatus.NotInit) _status = AgentStatus.Stopped; else _status = AgentStatus.Stopping; _stopAgent = true; } }
/// <summary> /// Event fired when the timer interval has completed /// </summary> /// <param name="sender"></param> /// <param name="e"></param> /// object sender, System.Timers.ElapsedEventArgs e void timer_Elapsed() { _nativeThreadId = AppDomain.GetCurrentThreadId(); while(!_stopAgent) { try { _status = AgentStatus.Executing; _startExecutionTime = DateTime.Now; //Run standard Run first _standard.Run(); //Run the event task _agent.Run(); _lastExecutionTime = DateTime.Now; _runCount++; //WriteStatusToFile(); } catch (Illuminate.Exceptions.CriticalException er) { _status = AgentStatus.Error; _errorMessage = er.Message + "\n" + er.StackTrace; _stopAgent = true; Tools.Logger.WriteLine("Critical Error: " + er.Message, Illuminate.Tools.Logger.Severity.Fatal, LOGNAME); } catch (Illuminate.Exceptions.ErrorException er) { _status = AgentStatus.Error; Tools.Logger.WriteLine("Error: " + er.Message, Illuminate.Tools.Logger.Severity.Error, LOGNAME); } catch (Exception er) { _status = AgentStatus.Error; Tools.Logger.WriteLine("Error: " + er.Message + " " + er.StackTrace.ToString(), Illuminate.Tools.Logger.Severity.Error, _nodeId); } finally { if (!_stopAgent) { _nextExecutionTime = DateTime.Now.AddMilliseconds(_agent.GetInterval()); _status = AgentStatus.Sleeping; //Set the next run time and the last run time for the event Logger.WriteLine("Waiting: " + _agent.GetInterval().ToString(), Logger.Severity.Debug, LOGNAME); Wait(); } } } //while if (_status != AgentStatus.Error || _status != AgentStatus.Killed) { try { //agent is stopping, perform any necessary cleanup _agent.Cleanup(); _standard.Cleanup(); } catch (Exception er) { if (_agentThread.ThreadState != System.Threading.ThreadState.Stopped && _agentThread.ThreadState != System.Threading.ThreadState.Aborted && _agentThread.ThreadState != System.Threading.ThreadState.AbortRequested) { Logger.WriteLine("Error occurred during agent cleanup: " + er.Message + " " + er.StackTrace, Logger.Severity.Error, _nodeId); } } _status = AgentStatus.Stopped; } }
public AgentRecord( Guid id, Process p, ITestAgent a, AgentStatus s ) { this.Id = id; this.Process = p; this.Agent = a; this.Status = s; }
public void ReportStatus( Guid agentId, AgentStatus status ) { AgentRecord r = _agentData[agentId]; if ( r == null ) throw new ArgumentException( string.Format("Agent {0} is not in the agency database", agentId), "agentId" ); r.Status = status; }