• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# IEvent类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中IEvent的典型用法代码示例。如果您正苦于以下问题:C# IEvent类的具体用法?C# IEvent怎么用?C# IEvent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



IEvent类属于命名空间,在下文中一共展示了IEvent类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: InvokeHandlers

        private void InvokeHandlers(IEvent @event, IEnumerable<HandlerMethod> handlers)
        {
            foreach (var method in handlers)
            {
                object handler;

                try
                {
                    handler = HandlerActivator.CreateInstance(method.ReflectedType);
                }
                catch (Exception ex)
                {
                    throw new EventHandlerException("Fail to activate event handler: " + method.ReflectedType + ". See inner exception for details.", ex);
                }

                try
                {
                    method.Invoke(handler, @event);
                }
                catch (Exception ex)
                {
                    throw new EventHandlerException("Fail to execute event handler: " + method.ReflectedType + ". See inner exception for details.", ex);
                }
            }
        }
开发者ID:mouhong,项目名称:Taro,代码行数:25,代码来源:InProcessEventTransport.cs


示例2: FireEvent

        public void FireEvent(
			IEvent @event)
        {
            string namespaceUri = @event.NamespaceUri;
            string eventType = @event.Type;
            for (int i = 0; i < count; i++)
            {
            // Check if the entry was added during this phase
            if (entries[i].Locked)
              continue;

                string entryNamespaceUri = entries[i].NamespaceUri;
                string entryEventType = entries[i].Type;

                if (entryNamespaceUri != null && namespaceUri != null)
                {
                    if (entryNamespaceUri != namespaceUri)
                    {
                        continue;
                    }
                }

                if (entryEventType != eventType)
                {
                    continue;
                }

                entries[i].Listener(@event);
            }
        }
开发者ID:codebutler,项目名称:savagesvg,代码行数:30,代码来源:EventListenerMap.cs


示例3: EmulatorQuit

 public void EmulatorQuit(IEvent e)
 {
     foreach (var a in _gameEndedActions)
     {
         a.Invoke();
     }
 }
开发者ID:PhilipBrockmeyer,项目名称:Wren,代码行数:7,代码来源:GameEventAggregator.cs


示例4: TryParse

        /// <summary>
        /// Tries to parse the given data to the target <see cref="IEvent"/>.
        /// </summary>
        /// <param name="eventParams">List of string-parameters to parse.</param>
        /// <param name="target">Target instance to parse the data to.</param>
        /// <returns><c>true</c> if the parsing was succesful, otherwise <c>false</c> is returned.</returns>
        public bool TryParse(List<string> eventParams, IEvent target)
        {
            if (eventParams.Count < 4)
            {
                return false;
            }

            if (string.IsNullOrEmpty(eventParams[0]))
            {
                return false;
            }

            float posX, posY, posZ;
            if( !float.TryParse(eventParams[1], out posX) ||
                !float.TryParse(eventParams[2], out posY) ||
                !float.TryParse(eventParams[3], out posZ) )
            {
                return false;
            }

            if (!target.HasProperty("EntityName") || !target.HasProperty("Target"))
            {
                return false;
            }

            UnityEngine.Vector3 targetPosition = new UnityEngine.Vector3();
            targetPosition.x = posX;
            targetPosition.y = posY;
            targetPosition.z = posZ;

            target.SetProperty("EntityName", eventParams[0]);
            target.SetProperty("Target", targetPosition);
            return true;
        }
开发者ID:haleox,项目名称:mortar,代码行数:40,代码来源:EntityNameVector3Parser.cs


示例5: DefaultEvent

		/// <summary>
		/// Copy constructor
		/// </summary>
		protected DefaultEvent(IEvent ev)
			: base(ev)
		{
			this.addAccessor = ev.AddAccessor;
			this.removeAccessor = ev.RemoveAccessor;
			this.invokeAccessor = ev.InvokeAccessor;
		}
开发者ID:constructor-igor,项目名称:cudafy,代码行数:10,代码来源:DefaultEvent.cs


示例6: Publish

 public void Publish(IEvent eventMessage)
 {
     foreach (var bus in _wrappedBuses)
     {
         bus.Publish(eventMessage);
     }
 }
开发者ID:HAXEN,项目名称:ncqrs,代码行数:7,代码来源:CompositeEventBus.cs


示例7: SendEventToClient

    /// <summary>
    /// This method will handle sending an event to a client.
    /// </summary>
    public static void SendEventToClient(string ipAddress, int port, IEvent evnt)
    {
      try
      {
        var client = new TcpClient(ipAddress, port);

        // TODO: Serialize the event into json...
        string json = JsonConvert.SerializeObject(evnt);
        byte[] data = System.Text.Encoding.Unicode.GetBytes(json);

        // Get a client stream for reading and writing.
        var stream = client.GetStream();
        stream.Write(data, 0, data.Length);

        Console.WriteLine("Sent: {0}", json);

        // Close everything.
        stream.Close();
        client.Close();
      }
      catch (ArgumentNullException e)
      {
        Console.WriteLine("ArgumentNullException: {0}", e);
      }
      catch (SocketException e)
      {
        Console.WriteLine("SocketException: {0}", e);
      }
    }
开发者ID:pcewing,项目名称:ChatApplication,代码行数:32,代码来源:EventManager.cs


示例8:

 void IEventHelpers.RegisterSocketRead(IEvent e, BufferedSocket socket, IEventHandler protocol,
                                       ReadFunction callback)
 {
     //Contract.Requires(socket != null);
     Contract.Requires(protocol != null);
     Contract.Requires(callback != null);
 }
开发者ID:splitice,项目名称:EventCore,代码行数:7,代码来源:IEventHelpers.cs


示例9: EventMessage

        public EventMessage(IEvent source)
        {
            if (source == null)
                throw new ArgumentNullException("source");

            sourceMeta = new Dictionary<string, object>();
            eventMeta = new Dictionary<string, object>();

            var eventSource = source.EventSource;
            while (eventSource != null) {
                foreach (var meta in source.EventSource.Metadata) {
                    sourceMeta[meta.Key] = meta.Value;
                }

                eventSource = eventSource.ParentSource;
            }

            if (source.EventData != null) {
                foreach (var pair in source.EventData) {
                    eventMeta[pair.Key] = pair.Value;
                }
            }

            TimeStamp = source.TimeStamp;
        }
开发者ID:deveel,项目名称:deveeldb,代码行数:25,代码来源:EventMessage.cs


示例10: run

 public void run(IEvent e)
 {
     BoardMovedNotify notify = new BoardMovedNotify();
     this.boardMachine.fireStateChangedNotification(notify);
     LOG.Info(NAME);
     this.boardMachine.consumeEvent(new BoardReadyEvent());
 }
开发者ID:hoangchunghien,项目名称:ChineseChessLearning,代码行数:7,代码来源:BoardMovedState.cs


示例11: CreateEvent

        public static bool CreateEvent(IEvent thisEvent)
        {
            if (Connect())
            {
                try
                {
                    SqlCommand Command = Connection.CreateCommand();
                    Command.CommandType = CommandType.StoredProcedure;
                    Command.CommandText = "fif_event_create";

                    Command.Parameters.AddWithValue("name", thisEvent.Name);
                    Command.Parameters.AddWithValue("price", thisEvent.Price);
                    Command.Parameters.AddWithValue("description", thisEvent.Description);
                    Command.Parameters.AddWithValue("start_period", thisEvent.StartPeriod);
                    Command.Parameters.AddWithValue("end_period", thisEvent.EndPeriod);
                    Command.Parameters.AddWithValue("max_number_of_participants", thisEvent.MaxNumberOfParticipants);

                    Command.Parameters.Add("@activity_id", SqlDbType.Int, 0, "activity_id");
                    Command.Parameters["@activity_id"].Direction = ParameterDirection.Output;

                    Command.ExecuteNonQuery();

                    thisEvent.ActivityId = int.Parse(Command.Parameters["@activity_id"].Value.ToString());

                    Disconnect();
                    return true;
                }
                catch
                {
                    Disconnect();
                    return false;
                }
            }
            return false;
        }
开发者ID:TheMrCaira,项目名称:FjordagerTaekwando,代码行数:35,代码来源:EventPersistence2.cs


示例12: LoadIEvent

        private void LoadIEvent()
        {
            if (_ievent == null)
            {
                if (this.ScheduleType == null)
                {
                    Logger.LogInfo("计划任务没有定义其 type 属性");
                    
                }

                Type type = Type.GetType(this.ScheduleType);
                if (type == null)
                {
                    Logger.LogInfo(string.Format("计划任务 {0} 无法被正确识别", this.ScheduleType));
                }
                else
                {
                    _ievent = (IEvent)Activator.CreateInstance(type);
                    if (_ievent == null)
                    {
                        Logger.LogInfo(string.Format("计划任务 {0} 未能正确加载", this.ScheduleType));
                    }
                }
            }
        }
开发者ID:iraychen,项目名称:LCLFramework,代码行数:25,代码来源:Event.cs


示例13: EventToString

        /// <summary>
        /// Converts event to <c>string</c> representation.
        /// </summary>
        /// <param name="Event">Event to be converted to <c>string</c></param>
        /// <returns>Returns resulting <c>string</c>.</returns>
        public static string EventToString( IEvent Event )
        {
            StringBuilder builder = new StringBuilder( 200 );
            builder.Append( "[Type=" );
            builder.Append( Event.Type.ToString() );

            if( Event.Description!=null )
            {
                builder.Append( "][Message=" );
                builder.Append( Event.Description );
            }

            if( Event.Sender != null )
            {
                builder.Append( "][ModelID=" );
                builder.Append( ((ILinkableComponent) Event.Sender).ModelID );
            }

            if( Event.SimulationTime != null )
            {
                builder.Append( "][SimTime=" );
                builder.Append( CalendarConverter.ModifiedJulian2Gregorian(Event.SimulationTime.ModifiedJulianDay).ToString() );
            }

            builder.Append( ']' );

            return( builder.ToString() );
        }
开发者ID:KangChaofan,项目名称:OOC,代码行数:33,代码来源:Utils.cs


示例14:

 /// <summary>
 /// Listen for VirtualBox events.
 /// </summary>
 /// <param name="aEvent">VirtualBox event</param>
 void IEventListener.HandleEvent(IEvent aEvent)
 {
     if (aEvent.Type == VBoxEventType.VBoxEventType_OnMachineStateChanged)
     {
         vboxServer.UpdateServersState();
     }
 }
开发者ID:forrest79,项目名称:devel79tray,代码行数:11,代码来源:VirtualBoxServer.cs


示例15: GetEventDataAsString

        /// <summary>
        /// Gets a string of all data properties of the passed <see cref="IEvent"/>.
        /// Format-Example: Name0: Value0, ..., NameN: ValueN
        /// </summary>
        /// <param name="e"><see cref="IEvent"/> to create data string from.</param>
        /// <returns>String representing the <see cref="IEvent"/> data.</returns>
        public static string GetEventDataAsString(IEvent e)
        {
            string data = "";

            if (e != null)
            {
                int i = 0;
                foreach (PropertyInfo property in e.GetType().GetProperties())
                {
                    if (GetNamesOfProperties().Contains(property.Name))
                    {
                        continue;
                    }

                    if (i > 0)
                    {
                        data += ", ";
                    }
                    data += string.Format("{0}: {1}", property.Name, property.GetValue(e, null));
                    i++;
                }
            }

            return data;
        }
开发者ID:haleox,项目名称:mortar,代码行数:31,代码来源:Event.cs


示例16: Action

        /// <summary>
        /// Deconstructs the contexts request into a set of prameters for the context.
        /// </summary>
        /// <remarks>
        /// The deafult implementation uses the convention of `/area/concern/action.aspc/tail?querystring`
        /// </remarks>
        /// <param name="ev">The vent that was considered for this action.</param>
        /// <param name="context">The context to act upon.</param>
        public override void Action(IEvent ev, IWebContext context)
        {
            // eliminate the app directory from the path
            string path = _appDirectory.Length > 0 ? context.Request.UrlInfo.AppPath.Trim('/').Replace(_appDirectory, "") : context.Request.UrlInfo.AppPath;
            path = path.Trim('/');

            if (!String.IsNullOrEmpty(context.Request.UrlInfo.File)) {
                context.Params["action"] = context.Request.UrlInfo.File.Split('.')[0].ToLower();

                string[] parts = path.Split('/');
                if (parts.Length >= 2) {
                    context.Params["area"] = parts[parts.Length - 2].ToLower();
                    context.Params["concern"] = parts[parts.Length - 1].ToLower();
                } else if (parts.Length == 1) {
                    context.Params["area"] = parts[0];
                }
            }

            // import query string and form values
            context.Params.Import(context.Request.Params.Where(kv => !kv.Key.StartsWith("_")));
            // establish flags
            foreach (string flag in context.Request.Flags.Where(f => !f.StartsWith("_"))) {
                context.Flags.Add(flag);
            }
            context.Params.Import(context.Request.Headers);
            // note method and tail
            context.Params["method"] = context.Request.Method;
            context.Params["tail"] = context.Request.UrlInfo.Tail;
            string requestViews = String.Join(";", context.Request.UrlInfo.Tail.Split(new string[] {"/"}, StringSplitOptions.RemoveEmptyEntries));
            if (!String.IsNullOrEmpty(requestViews)) {
                context.Params["views"] = requestViews;
            }
        }
开发者ID:guy-murphy,项目名称:inversion-vnext-dev,代码行数:41,代码来源:ParseRequestBehaviour.cs


示例17: ProcessEvent

 public void ProcessEvent(IEvent Event)
 {
     lock (_milliSeconds)
     {
         //_milliSeconds.Enqueue(DateTime.Now.Subtract(((InboundConnectionClosedEvent)Event).StartTime).TotalMilliseconds);
     }
 }
开发者ID:marquismark,项目名称:freeswitchconfig,代码行数:7,代码来源:ConnectionEventMonitor.cs


示例18: ValidateEvent

 protected override IValidationResultCollection ValidateEvent(IEvent evt)
 {
     return ValidationResult.GetCompositeResults(
         ResourceManager,
         new PropertyCountValidation(ResourceManager, evt, "VEVENT", "LAST-MODIFIED")
     );
 }
开发者ID:ddaysoftware,项目名称:icalvalid,代码行数:7,代码来源:EventLastModPropertyValidator.cs


示例19: Execute

 public void Execute(IEvent eEvent)
 {
     if (UserSettings.Instance.IsFirstRun())
     {
         Plugin.Instance.OpenInfoWindow();
     }
 }
开发者ID:jmath222,项目名称:mbrc-plugin,代码行数:7,代码来源:ShowFirstRunDialogCommand.cs


示例20: HandleEvent

    public bool HandleEvent(IEvent @event)
    {
        var sceneChangeEvent = @event as SceneChangeEvent;
        if (sceneChangeEvent == null)
        {
            return true;
        }

        var data = @event.GetData() as string;
        if (data == null)
        {
            return true;
        }

        try
        {
            this.currentScene = (SceneNames)Enum.Parse(typeof(SceneNames), data, ignoreCase: true);
        }
        catch
        {
            // do nothing
        }

        return true;
    }
开发者ID:Archanium,项目名称:ngj,代码行数:25,代码来源:NeonlightRandomBigBuzz.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# IEventAggregator类代码示例发布时间:2022-05-24
下一篇:
C# IEvaluator类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap