public void CancelSkill() { this.so.EventGroup.FireEvent((int)Event.Cancelskill, so, EventGroup.NewArg <EventSingleArgs <string>, string>(RunningSkill.SourceData.path)); RunningSkill.Cancel(); Pool.SP.Recycle(RunningSkill); RunningSkill = null; }
public async Task <IHttpActionResult> PutEventGroup(Guid id, EventGroup eventGroup) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != eventGroup.id) { return(BadRequest()); } db.Entry(eventGroup).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!EventGroupExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
private void treeView1_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e) { if (e.Button == MouseButtons.Right && e.Node != null) { _contextNode = e.Node; ContextMenu menu = new ContextMenu(); menu.MenuItems.Add("Add Event Group to End").Click += OnAddEventGroup; if (e.Node.Tag is EventGroup) { EventGroup eg = (EventGroup)e.Node.Tag; menu.MenuItems.Add("Create Event Group Before").Click += OnCreateEventGroupBefore; menu.MenuItems.Add("Create Event Group After").Click += OnCreateEventGroupAfter; if (eg.stopCondition == null) { menu.MenuItems.Add("-"); MenuItem mi = menu.MenuItems.Add("Add Stop Condition"); mi.Click += OnAddStopCondition; } } else if (e.Node.Text == "Events") { menu.MenuItems.Add("-"); menu.MenuItems.Add("Add Event").Click += OnAddEvent; } menu.Show(treeView1, e.Location); } }
/// <summary> /// Enqueues an event to the actor with the specified id. /// </summary> private EnqueueStatus EnqueueEvent(Actor actor, Event e, Actor sender, EventGroup group, SendOptions options) { EventOriginInfo originInfo; string stateName = null; if (sender is StateMachine senderStateMachine) { originInfo = new EventOriginInfo(sender.Id, senderStateMachine.GetType().FullName, NameResolver.GetStateNameForLogging(senderStateMachine.CurrentState)); stateName = senderStateMachine.CurrentStateName; } else if (sender is Actor senderActor) { originInfo = new EventOriginInfo(sender.Id, senderActor.GetType().FullName, string.Empty); } else { // Message comes from the environment. originInfo = new EventOriginInfo(null, "Env", "Env"); } EventInfo eventInfo = new EventInfo(e, originInfo) { MustHandle = options?.MustHandle ?? false, Assert = options?.Assert ?? -1 }; Guid opId = group == null ? Guid.Empty : group.Id; this.LogWriter.LogSendEvent(actor.Id, sender?.Id.Name, sender?.Id.Type, stateName, e, opId, isTargetHalted: false); return(actor.Enqueue(e, group, eventInfo)); }
private async Task CreateGroupAndAssignStudentAndEventAsync(string studentId, string eventId) { var group = new Group() { Name = "group", CreatorId = Guid.NewGuid().ToString(), }; await this.DbContext.Groups.AddAsync(group); var studentGroup = new StudentGroup() { StudentId = studentId, GroupId = group.Id }; await this.DbContext.StudentsGroups.AddAsync(studentGroup); var eventGroup = new EventGroup() { EventId = eventId, GroupId = group.Id }; await this.DbContext.EventsGroups.AddAsync(eventGroup); await this.DbContext.SaveChangesAsync(); this.DbContext.Entry <EventGroup>(eventGroup).State = EntityState.Detached; this.DbContext.Entry <Group>(group).State = EntityState.Detached; this.DbContext.Entry <StudentGroup>(studentGroup).State = EntityState.Detached; }
public async Task <IHttpActionResult> PostEventGroup(EventGroup eventGroup) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.EventGroups.Add(eventGroup); try { await db.SaveChangesAsync(); } catch (DbUpdateException) { if (EventGroupExists(eventGroup.id)) { return(Conflict()); } else { throw; } } return(CreatedAtRoute("DefaultApi", new { id = eventGroup.id }, eventGroup)); }
private void EleGroup_EditClick(object sender, RoutedEventArgs e) { EventGroup eventGroup = (EventGroup)((FrameworkElement)sender).DataContext; EventGroupEditPageViewModel eventGroupViewModel = new EventGroupEditPageViewModel(eventGroup, viewModel.GetAllGroups()); Frame.Navigate(typeof(EventGroupEditPage), eventGroupViewModel); }
/// <summary> /// Finds the active event at any give time for a certain event group using a binary search in a per event collection /// </summary> /// <remarks>This collection is updated by UpdateMap</remarks> public Event GetEffectAtTime(TimeDivisionReference time, EventGroup group) { var collection = precomputedEvents[(int)group]; if (collection.Count == 0) { return(null); } int left = 0; int right = collection.Count - 1; while (left < right) { int mid = left + (right - left) / 2; var middle = collection[mid]; if (middle.Position.CompareTo(time) < 0) { left = mid + 1; } else { right = mid; } } return(collection[left].Event); }
internal void Init(CreateInfo createInfo) { EventGroup = new EventGroup(); Team = createInfo.Team; Pool.SP.Recycle(createInfo); createInfo = null; }
public void MapEventGroup_EntityWithNoAssociated_SomeMapped() { var entity = new EventGroup { Id = 1, EventParentId = 1, UserId = "foo", Name = "bar", Description = "baz" }; var expected = new EventGroupModel { Id = 1, EventParentId = 1, Name = "bar", Description = "baz" }; var actual = target.Map <EventGroupModel>(entity); Assert.AreEqual(expected.Id, actual.Id); Assert.AreEqual(expected.EventParentId, actual.EventParentId); Assert.AreEqual(expected.EventParentName, actual.EventParentName); Assert.AreEqual(expected.Name, actual.Name); Assert.AreEqual(expected.Description, actual.Description); }
private async void EleGroup_RemoveClick(object sender, RoutedEventArgs e) { EventGroup eventGroup = (EventGroup)((FrameworkElement)sender).DataContext; await AskRemove(viewModel.Settings.Groups.Collection, eventGroup, $"Do you want to remove group:\n{eventGroup.Name}"); }
private void OnLoadUI(string uiName, UnityEngine.Object obj) { PendingViewInfo info = default(PendingViewInfo); for (int i = _waitingForLoadView.Count - 1; i >= 0; i--) { var pendingViewInfo = _waitingForLoadView[i]; if (pendingViewInfo.UiName.Equals(uiName)) { info = pendingViewInfo; _waitingForLoadView.RemoveAt(i); break; } } if (!info.Equals(default(PendingViewInfo)) && info.UiName.Equals(uiName)) { GameObject go = UnityEngine.Object.Instantiate(obj) as GameObject; go.transform.parent = Main.SP.UIParent; var v = Activator.CreateInstance(info.UiType) as View; _views.Add(v); v.name = uiName; v.Init(go); v.Show(info.Param); FireEvent((int)UIEventList.OnShowUI, this, EventGroup.NewArg <EventSingleArgs <View>, View>(v)); } }
/// <summary> /// Creates a new actor of the specified <see cref="Type"/> and name, using the specified /// unbound actor id, and passes the specified optional <see cref="Event"/>. This event /// can only be used to access its payload, and cannot be handled. The method returns only /// when the actor is initialized and the <see cref="Event"/> (if any) is handled. /// </summary> internal Task <ActorId> CreateActorAndExecuteAsync(ActorId id, Type type, string name, Event initialEvent = null, EventGroup group = null) { var creatorOp = this.Scheduler.GetExecutingOperation <ActorOperation>(); return(this.CreateActorAndExecuteAsync(id, type, name, initialEvent, creatorOp?.Actor, group)); }
private void HideUI(object sender, EventMsg e) { var v = e as EventSingleArgs <View>; v.value.OnHide(); FireEvent((int)UIEventList.OnHideUI, this, EventGroup.NewArg <EventSingleArgs <View>, View>(v.value)); }
/// <inheritdoc/> internal override void SendEvent(ActorId targetId, Event e, Actor sender, EventGroup group, SendOptions options) { if (e is null) { string message = sender != null? string.Format("{0} is sending a null event.", sender.Id.ToString()) : "Cannot send a null event."; this.Assert(false, message); } if (sender != null) { this.Assert(targetId != null, "{0} is sending event {1} to a null actor.", sender.Id, e); } else { this.Assert(targetId != null, "Cannot send event {1} to a null actor.", e); } this.AssertExpectedCallerActor(sender, "SendEvent"); EnqueueStatus enqueueStatus = this.EnqueueEvent(targetId, e, sender, group, options, out Actor target); if (enqueueStatus is EnqueueStatus.EventHandlerNotRunning) { this.RunActorEventHandler(target, null, false, null); } }
public int Add(EventGroupModel model) { try { var user = new EventGroup() { EventId = model.EventId, GroupId = model.GroupId, CreatedBy = model.CreatedBy, CreatedOn = UnixTimeBaseClass.UnixTimeNow }; _db.EventGroups.Add(user); _db.SaveChanges(); return(user.EventGroupId); } catch (Exception ex) { JavaScriptSerializer js = new JavaScriptSerializer(); string json = js.Serialize(model); Log.Error("EventGroup - Add - " + json, ex); throw; } }
public ServiceResult InsertEventGroup(INode n) { if (!this.DataAccessAuthorized(n, "post", false)) { return(ServiceResponse.Error("You are not authorized this action.")); } n.Initialize(this._requestingUser.UUID, this._requestingUser.AccountUUID, this._requestingUser.RoleWeight); var s = (EventGroup)n; s.Name = s.Name.Trim(); using (var context = new GreenWerxDbContext(this._connectionKey)) { EventGroup dbU = context.GetAll <EventGroup>()?.FirstOrDefault(wu => (wu.Name?.EqualsIgnoreCase(s.Name) ?? false) && wu.AccountUUID == s.AccountUUID); if (dbU != null) { return(ServiceResponse.Error("EventGroup already exists.")); } if (context.Insert <EventGroup>(s)) { return(ServiceResponse.OK("", s)); } } return(ServiceResponse.Error("An error occurred inserting EventGroup " + s.Name)); }
/// <summary> /// Initializes a new instance of the <see cref="MockStateMachineManager"/> class. /// </summary> internal MockStateMachineManager(ControlledRuntime runtime, StateMachine instance, EventGroup group) { this.Runtime = runtime; this.Instance = instance; this.IsEventHandlerRunning = true; this.ProgramCounter = 0; this.CurrentEventGroup = group; }
public void Init() { InitConfig(); LockFrameMgr = new LockFrameMgr(); SceneManager = new SceneManager(); EventGroup = new EventGroup(); _timeStep = 1f / LockFrameMgr.FixedFrameRate; }
protected virtual void OnHit(SceneObject receiver) { var _battleScene = LogicCore.SP.SceneManager.CurrentScene as BattleScene; EventManager.TriggerEvent(ProjectileAction.hitEvent, new RuntimeData(Sender, receiver, Data)); EventGroup.FireEvent((int)ProjectileEvent.OnHit, this, null); _battleScene.RemoveSceneObject(this.Id); }
internal override IRule ToRule() { var group = new EventGroup(); group.Bookings = new DbBookingDao().GetByEvents(EventIds); group.Events = new DbEventDao().GetBy(EventIds); return(new EventGroupRule(group, AvailabilityStatus.Booked)); }
private void IbnAddGroup_Click(object sender, RoutedEventArgs e) { EventGroup eventGroup = new EventGroup(); EventGroupEditPageViewModel eventGroupViewModel = new EventGroupEditPageViewModel(eventGroup, viewModel.GetAllGroups()); viewModel.Settings.Groups.Collection.Add(eventGroup); Frame.Navigate(typeof(EventGroupEditPage), eventGroupViewModel); }
protected void StartListenerTask(EventGroup eventGroups) { _uiSyncContext = SynchronizationContext.Current; _listenerCancellationTokenSource = new CancellationTokenSource(); _listenerTask = new Task(() => HandleArgusTVEvents(_listenerCancellationTokenSource.Token), _listenerCancellationTokenSource.Token, TaskCreationOptions.LongRunning); _listenerTask.Start(); }
/// <summary> /// Lay ra danh sach cac su kien trong nhom su kien nay /// </summary> /// <param name="mmEventGroup">mã nhóm sự kiện được chọn </param> /// <Modified> /// Author Date Comments /// Cuongdb 18/2/2008 Tạo mới /// </Modified> public void BindData(int mmEventGroup) { DataTable dt; //DataRow arow; mEventGroup = new EventGroup(mmEventGroup); dt = mEventGroup.GetEvents(); grdSuKien.DataSource = dt; }
private void OnAddStopCondition(object sender, EventArgs e) { EventGroup eg = (EventGroup)_contextNode.Tag; eg.stopCondition = new StopCondition(); TreeNode stopCondition = _contextNode.Nodes.Add("Stop Condition"); stopCondition.Tag = eg.stopCondition; SetDirty(); }
/// <summary> /// Initializes a new instance of the <see cref="MockActorManager"/> class. /// </summary> internal MockActorManager(ControlledRuntime runtime, Actor instance, EventGroup group) { this.Runtime = runtime; this.Instance = instance; this.IsEventHandlerRunning = true; this.ProgramCounter = 0; this.IsTransitionStatementCalledInCurrentAction = false; this.IsInsideOnExit = false; this.CurrentEventGroup = group; }
/// <inheritdoc/> public void OnReceiveEvent(Event e, EventGroup group, EventInfo eventInfo) { if (group != null) { // Inherit the event group of the receive operation, if it is non-null. this.CurrentEventGroup = group; } this.Runtime.NotifyReceivedEvent(this.Instance, e, eventInfo); }
public void SendCommand(LockFrameCommand cmd) { #if LocalDebug cmd.Execute(); return; #endif NetDataWriter w = new NetDataWriter(true); cmd.Serialize(w); EventDispatcher.FireEvent(UIEventList.SendNetMsg.ToInt(), this, EventGroup.NewArg <EventSingleArgs <NetDataWriter>, NetDataWriter>(w)); }
/// <summary> /// Name: ValidDeparment /// Description: Method to check if department is valid /// </summary> private void ValidDeparment(IEnumerable <EventGroup> currentEventGroups, EventGroup eventGroup) { foreach (EventGroup currentEventGroup in currentEventGroups) { if (currentEventGroup.Name.ToLower().Equals(eventGroup.Name.ToLower())) { throw new ManagerException(ERROR_EVENTGROUP_ALREADY_EXIST, new System.Exception(string.Format("A event group with name: {0}, already exist", eventGroup.Name))); } } }
public void PreloadGroup(string name) { EventGroup group = null; RESULT result = eventSystem.getGroup(name, true, ref group); fmodErrorCheck(result); result = group.loadEventData(); fmodErrorCheck(result); }
/// <summary> /// Subscribe your client to a group of ARGUS TV events using a polling mechanism. /// </summary> /// <param name="uniqueClientId">The unique ID (e.g. your DNS hostname combined with a constant GUID) to identify your client.</param> /// <param name="eventGroups">The event group(s) to subscribe to (flags can be OR'd).</param> public async Task SubscribeServiceEvents(string uniqueClientId, EventGroup eventGroups) { var request = NewRequest(HttpMethod.Post, "ServiceEvents/{0}/Subscribe/{1}", uniqueClientId, eventGroups); await ExecuteAsync(request).ConfigureAwait(false); }
protected void StartListenerTask(EventGroup eventGroups) { _uiSyncContext = SynchronizationContext.Current; _listenerCancellationTokenSource = new CancellationTokenSource(); _listenerTask = new Task(() => HandleArgusTVEvents(_listenerCancellationTokenSource.Token), _listenerCancellationTokenSource.Token, TaskCreationOptions.LongRunning); _listenerTask.Start(); }
public static void LogEvent(EventGroup eg, string name) { LogEvent(eg.ToString(), name); }
public RegionGroup(Region Region) { _Events = new EventGroup(); _Region = Region; }
public EventGroupsWithSubGroups(EventGroup grp, EventGroupSubType[] subGrps) { EventGroup = grp; SubGroups = subGrps; }