本文整理汇总了C#中EventContext类的典型用法代码示例。如果您正苦于以下问题:C# EventContext类的具体用法?C# EventContext怎么用?C# EventContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
EventContext类属于命名空间,在下文中一共展示了EventContext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnClickList
void OnClickList(EventContext context)
{
//find out if there is an item in edit status
//查找是否有项目处于编辑状态
int cnt = _list.numChildren;
for (int i = 0; i < cnt; i++)
{
GButton item = _list.GetChildAt(i).asButton;
if (item.scrollPane.posX != 0)
{
//Check if clicked on the button
if (item.GetChild("b0").asButton.IsAncestorOf(GRoot.inst.touchTarget)
|| item.GetChild("b1").asButton.IsAncestorOf(GRoot.inst.touchTarget))
{
return;
}
item.scrollPane.SetPosX(0, true);
//avoid scroll pane default behavior
//取消滚动面板可能发生的拉动。
item.scrollPane.CancelDragging();
_list.scrollPane.CancelDragging();
break;
}
}
}
示例2: ChangingAnEventDisconnectedDoesNotCreateDuplicates
public void ChangingAnEventDisconnectedDoesNotCreateDuplicates()
{
Event e;
using (var context = new EventContext())
{
var eventUoW = new EventUnitOfWork(context);
e = new Event();
e.Brief = "Test";
e.Detailed = "Test";
e.ModificationState = ModificationState.Added;
e.AppUser = context.Users.Single(t => t.UserName == "TestUser");
eventUoW.Events.Attach(e);
eventUoW.Save();
}
e.Brief = "MyBrief";
e.Detailed = "MyDetailed";
e.ModificationState = ModificationState.Modified;
using (var context = new EventContext())
{
var eventUoW = new EventUnitOfWork(context);
eventUoW.Events.Attach(e);
eventUoW.Save();
}
using (var context = new EventContext())
{
context.Invoking(t => t.Events.Single()).ShouldNotThrow();
}
}
示例3: OnRotate
void OnRotate(EventContext context)
{
DOTween.Kill(_ball);
RotationGesture gesture = (RotationGesture)context.sender;
_ball.Rotate(Vector3.forward, -gesture.delta, Space.World);
}
示例4: EvaluateOnTold
public double EvaluateOnTold(Character perspectiveCharacter, Character evaluateCharacter, Game game)
{
//The perspectiveCharacter is the character performing the query.
//The evaluateCharacter is the character whose opinion on the information we care about.
EventContext observeContext = new EventContext(evaluateCharacter, parameters);
return information.OnTold.Evaluate(game, observeContext, evaluateCharacter.GetWeights(perspectiveCharacter));
}
示例5: ExecuteEvents
private void ExecuteEvents(object ex = null)
{
var dict = new Dictionary<string, string>();
foreach(var i in _dataProviders) {
var results = i.AfterEvent();
if(results != null) {
foreach(var j in results) {
dict[j.Key] = j.Value;
}
}
}
var eventContext = new EventContext(dict)
{
Name = _eventMetadata.Name,
Exception = ex
};
foreach(var i in _eventHandlers) {
i.OnEvent(eventContext);
}
}
示例6: EventProcessing
public override void EventProcessing(EventContext context) {
if (Settings.Current.WebsiteMode == WebsiteMode.Dev)
return;
// Throttle errors by client ip address to no more than X every 5 minutes.
var ri = context.Event.GetRequestInfo();
if (ri == null || String.IsNullOrEmpty(ri.ClientIpAddress))
return;
string throttleCacheKey = String.Concat("bot:", ri.ClientIpAddress, ":", DateTime.Now.Floor(_throttlingPeriod).Ticks);
var requestCount = _cacheClient.Get<int?>(throttleCacheKey);
if (requestCount != null) {
_cacheClient.Increment(throttleCacheKey, 1);
requestCount++;
} else {
_cacheClient.Set(throttleCacheKey, 1, _throttlingPeriod);
requestCount = 1;
}
if (requestCount < Settings.Current.BotThrottleLimit)
return;
Log.Info().Message("Bot throttle triggered. IP: {0} Time: {1} Project: {2}", ri.ClientIpAddress, DateTime.Now.Floor(_throttlingPeriod), context.Event.ProjectId).Project(context.Event.ProjectId).Write();
// the throttle was triggered, go and delete all the errors that triggered the throttle to reduce bot noise in the system
Task.Run(() => _eventRepository.RemoveAllByClientIpAndDateAsync(ri.ClientIpAddress, DateTime.Now.Floor(_throttlingPeriod), DateTime.Now.Ceiling(_throttlingPeriod)));
context.IsCancelled = true;
}
示例7: OnKeyDown
void OnKeyDown(EventContext context)
{
if (context.inputEvent.keyCode == KeyCode.Escape)
{
Application.Quit();
}
}
示例8: AsyncLocalNotifyUpdateCallback
/// <summary>
/// Constructor
/// </summary>
/// <param name="listener"></param>
/// <param name="data"></param>
public AsyncLocalNotifyUpdateCallback(ICacheEventsListener listener, object key, object entry, OperationContext operationContext, EventContext eventContext)
{
_listener = listener;
_key = key;
_entry = entry;
_operationContext = operationContext;
_eventContext = eventContext;
}
示例9: OnPinch
void OnPinch(EventContext context)
{
DOTween.Kill(_ball);
FairyGUI.PinchGesture gesture = (FairyGUI.PinchGesture)context.sender;
float newValue = Mathf.Clamp(_ball.localScale.x + gesture.delta, 0.3f, 2);
_ball.localScale = new Vector3(newValue, newValue, newValue);
}
示例10: EventUnitOfWork
public EventUnitOfWork(EventContext context)
{
this.context = context;
Events = new EventRepository(context);
Users = new UserRepository(context, new UserManager<AppUser, string>(new UserStore<AppUser>(context)));
Invites = new InviteRepository(context);
InviteLinks = new InviteLinkRepository(context);
}
示例11: Calculate
public double Calculate(EventContext context, Game game)
{
double result = 0.0;
foreach(var part in parts)
{
result += part.Calculate(context, game);
}
return result;
}
示例12: AsyncBroadcastCustomNotifyRemoval
/// <summary>
/// Constructor
/// </summary>
/// <param name="listener"></param>
/// <param name="data"></param>
public AsyncBroadcastCustomNotifyRemoval(ClusterCacheBase parent, object key, CacheEntry entry, ItemRemoveReason reason, OperationContext operationContext, EventContext eventContext)
{
_parent = parent;
_key = key;
_entry = entry;
_reason = reason;
_operationContext = operationContext;
_eventContext = eventContext;
}
示例13: __joystickMove
void __joystickMove(EventContext context)
{
float degree = (float)context.data;
//-90:up 0:right 90:down 180/-180:left
if (degree > -90 && degree < 90) //right
_npc.Translate(0.01f, 0, 0, Space.World);
else
_npc.Translate(-0.01f, 0, 0, Space.World);
}
示例14: Initialize
public static void Initialize(TestContext testContext)
{
var context = new EventContext();
context.Database.Delete();
var configuration = new TestMigrationConfiguration();
var migrator = new DbMigrator(configuration);
migrator.Update();
}
示例15: Evaluate
public bool Evaluate(EventContext context, Game game)
{
for(int i = 0; i < subexpressions.Length; ++i)
{
if (!subexpressions[i].Evaluate(context, game))
return false;
}
return true;
}