本文整理汇总了C#中Event类的典型用法代码示例。如果您正苦于以下问题:C# Event类的具体用法?C# Event怎么用?C# Event使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Event类属于命名空间,在下文中一共展示了Event类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetResourceHandleFromEvent
protected override uint GetResourceHandleFromEvent(Event ev)
{
if (ev is CreateEvent)
{
CreateEvent createEvent = ev as CreateEvent;
return createEvent.Result;
}
else if (ev is CloseEvent)
{
CloseEvent closeEvent = ev as CloseEvent;
return closeEvent.Socket;
}
else if (ev is ConnectEvent)
{
ConnectEvent connEvent = ev as ConnectEvent;
return connEvent.Socket;
}
else if (ev is SendEvent)
{
SendEvent sendEvent = ev as SendEvent;
return sendEvent.Socket;
}
else if (ev is ReceiveEvent)
{
ReceiveEvent recvEvent = ev as ReceiveEvent;
return recvEvent.Socket;
}
else
{
throw new NotImplementedException("Should not get here");
}
}
示例2: Save
public ActionResult Save(Event updatedEvent, FormCollection formData)
{
var action = new DataAction(formData);
try
{
switch (action.Type)
{
case DataActionTypes.Insert: // your Insert logic
_db.Events.Add(updatedEvent);
break;
case DataActionTypes.Delete: // your Delete logic
updatedEvent = _db.Events.SingleOrDefault(ev => ev.id == updatedEvent.id);
_db.Events.Remove(updatedEvent);
break;
default:// "update" // your Update logic
updatedEvent = _db.Events.SingleOrDefault(
ev => ev.id == updatedEvent.id);
UpdateModel(updatedEvent);
break;
}
_db.SaveChanges();
action.TargetId = updatedEvent.id;
}
catch (Exception e)
{
action.Type = DataActionTypes.Error;
}
return (new AjaxSaveResponse(action));
}
示例3: Create
public async Task<IdentityResult> Create(Event item)
{
item.Id = Guid.NewGuid().ToString();
context.Events.Add(item);
var result = await SaveChangesAsync();
return result;
}
示例4: DelayedEvent
public DelayedEvent(IEventable target, Event<IEventable> @event, int delay, object[] parameters)
{
Target = target;
Event = @event;
_delay = delay;
Parameters = parameters;
}
示例5: DragRezult
public DragRezult(Event onDrag, Event onEndDrag, EventPaint onPaint)
{
mRezult = Rezult.Drag;
mOnDrag = onDrag;
mOnEndDrag = onEndDrag;
mOnPaint = onPaint;
}
示例6: Create
public ActionResult Create(CreateEventViewModel eventToRegister)
{
if(!this.ModelState.IsValid)
{
return this.View(eventToRegister);
}
var userId = this.User.Identity.GetUserId();
var eventToCreate = new Event()
{
Name = eventToRegister.Name,
Description = eventToRegister.Description,
CreatedOn = DateTime.Now,
StartDate = eventToRegister.StartDate,
OrganiserId = userId,
Coordinates = eventToRegister.Coordinates,
LocationId = 1
};
var createdEvent = this.eventsServices.CreateEvent(eventToCreate);
IIdentifierProvider provider = new IdentifierProvider();
string encodedId = provider.EncodeId(createdEvent.Id);
return this.Redirect("~/Events/" + encodedId);
}
示例7: ProcessAsync
public async Task<IEnumerable<Event>> ProcessAsync(Event evnt)
{
var shardKeyArrived = evnt.GetBody<ShardKeyArrived>();
TheTrace.TraceInformation("Got {0} from {1}", shardKeyArrived.ShardKey,
shardKeyArrived.Source.TypeName);
var account = CloudStorageAccount.Parse(shardKeyArrived.Source.ConnectionString);
var client = account.CreateCloudTableClient();
var table = client.GetTableReference(shardKeyArrived.Source.DynamicProperties["TableName"].ToString());
var entities = table.ExecuteQuery(new TableQuery().Where(
TableQuery.GenerateFilterCondition("PartitionKey", "eq", shardKeyArrived.ShardKey)));
bool hasAnything = false;
foreach (var entity in entities)
{
await _pusher.PushAsync(entity, shardKeyArrived.Source);
hasAnything = true;
}
if (hasAnything)
{
await _pusher.FlushAsync();
}
return Enumerable.Empty<Event>();
}
示例8: WhenCreatingEvent_ThenCanCastToCovariantBase
public void WhenCreatingEvent_ThenCanCastToCovariantBase()
{
IEvent<FooArgs> args = new Event<object, FooArgs>(this, new FooArgs());
var covariant = (IEvent<EventArgs>)args;
Assert.NotNull(covariant);
}
示例9: AddEvent
public void AddEvent(DateTime date, string title, string location)
{
Event newEvent = new Event(date, title, location);
this.dictByTitle.Add(title.ToLower(), newEvent);
this.orderedByDate.Add(newEvent);
Messages.EventAdded(this.Output);
}
示例10: Create_Event
public void Create_Event()
{
var ebEvent = new Event
{
Name = new MultipartTextField { Html = "Test event" },
Description = new MultipartTextField { Html = "Test event description" },
Start = new DateTimeTimezoneField { Timezone = "Europe/London" },
End = new DateTimeTimezoneField { Timezone = "Europe/London" },
OnlineEvent = true,
Currency = "GBP",
CategoryId = 108,
SubcategoryId = 8001
};
ebEvent.TicketClasses.Add(new TicketClass
{
Name = "General admission ticket",
Cost = new CurrencyField { Currency = "GBP", Value = 10, Display = "£10".UrlEncode() },
Free = false,
Fee = new CurrencyField { Currency = "GBP", Value = 10, Display = "£10".UrlEncode() },
QuantityTotal = 1000,
MinimumQuantity = 1,
MaximumQuantity = 10
});
// post
Assert.DoesNotThrow(() => Context.Create<Event>(ebEvent));
Assert.That(ebEvent, Is.Not.Null);
Assert.Greater(ebEvent.Id, 0);
}
示例11: StateHistory
/// <summary>
/// Creates a new assetSchedule from and old assetSchedule and a new Event
/// </summary>
/// <param name="oldSchedule"></param>
/// <param name="newEvent"></param>
public StateHistory(StateHistory oldSchedule, Event newEvent)
{
Events = new Stack<Event>(oldSchedule.Events);
InitialState = oldSchedule.InitialState; //Should maybe be a deep copy -->not for this one
Events.Push(newEvent);
// Asset = newAssetSched.Asset;
}
示例12: AddOutlookID
public static void AddOutlookID(ref Event ev, AppointmentItem ai)
{
//Add the Outlook appointment ID into Google event.
//This will make comparison more efficient and set the scene for 2-way sync.
addOGCSproperty(ref ev, oEntryID, OutlookCalendar.Instance.IOutlook.GetGlobalApptID(ai));
}
示例13: SendImmediateEvent
// sends an event to be processed immediately, warning: use with caution!
public void SendImmediateEvent(Event ev)
{
for (int i = 0; i < m_lsUpdateStack.Count; i++)
{
m_lsUpdateStack[i].obj.ProcessEvent(ev);
}
}
示例14: GetHeader
/// <summary>
/// Returns an header from an InfoEvent.
/// </summary>
/// <param name="Event"></param>
/// <returns></returns>
public short GetHeader(Event Event)
{
using (DictionaryAdapter<string, short> DA = new DictionaryAdapter<string, short>(InfoEvents))
{
return DA.TryPopValue(Event.GetType().Name);
}
}
示例15: FireEvent
public override void FireEvent(Event e)
{
if (e.Type == EventType.Render)
{
Console.WriteLine(e.Parameters["text"]);
}
}