当前位置: 首页>>代码示例>>C#>>正文


C# Event类代码示例

本文整理汇总了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");
     }
 }
开发者ID:SayHalou,项目名称:ospy,代码行数:32,代码来源:TagFactory.cs

示例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));
        }
开发者ID:tylerablake,项目名称:developerUniversity,代码行数:30,代码来源:EventController.cs

示例3: Create

 public async Task<IdentityResult> Create(Event item)
 {             
     item.Id = Guid.NewGuid().ToString();            
     context.Events.Add(item);
     var result = await SaveChangesAsync();
     return result;
 }
开发者ID:Dierme,项目名称:smartcalendarHELP,代码行数:7,代码来源:EventRepository.cs

示例4: DelayedEvent

 public DelayedEvent(IEventable target, Event<IEventable> @event, int delay, object[] parameters)
 {
     Target = target;
     Event = @event;
     _delay = delay;
     Parameters = parameters;
 }
开发者ID:ndech,项目名称:Alpha,代码行数:7,代码来源:DelayedEvent.cs

示例5: DragRezult

 public DragRezult(Event onDrag, Event onEndDrag, EventPaint onPaint)
 {
     mRezult = Rezult.Drag;
     mOnDrag = onDrag;
     mOnEndDrag = onEndDrag;
     mOnPaint = onPaint;
 }
开发者ID:Arhirat,项目名称:Relative,代码行数:7,代码来源:ButtonStateVar.cs

示例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);
        }
开发者ID:DareDev1l,项目名称:Organizr,代码行数:26,代码来源:CreateController.cs

示例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>();
        }
开发者ID:nicolagaletti,项目名称:ConveyorBelt,代码行数:27,代码来源:ShardKeyActor.cs

示例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);
		}
开发者ID:netfx,项目名称:extensions,代码行数:7,代码来源:EventSpec.cs

示例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);
 }
开发者ID:MarKamenov,项目名称:TelerikAcademy,代码行数:7,代码来源:EventHolder.cs

示例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);
        }
开发者ID:Ultimatium,项目名称:Eventbrite.NET,代码行数:30,代码来源:EventTests.cs

示例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;
 }
开发者ID:emehiel,项目名称:Horizon,代码行数:12,代码来源:StateHistory.cs

示例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));
        }
开发者ID:dsuess,项目名称:OutlookGoogleSync,代码行数:7,代码来源:GoogleCalendar.cs

示例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);
     }
 }
开发者ID:meds,项目名称:ChicksnVixens,代码行数:8,代码来源:EventManager.cs

示例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);
     }
 }
开发者ID:habb0,项目名称:PiciEmulator,代码行数:12,代码来源:GameClient.cs

示例15: FireEvent

 public override void FireEvent(Event e)
 {
     if (e.Type == EventType.Render)
     {
         Console.WriteLine(e.Parameters["text"]);
     }
 }
开发者ID:hotdiggitydoddo,项目名称:ECS,代码行数:7,代码来源:ConsoleRendererComponent.cs


注:本文中的Event类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。