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


C# EventType.ToString方法代码示例

本文整理汇总了C#中EventType.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# EventType.ToString方法的具体用法?C# EventType.ToString怎么用?C# EventType.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在EventType的用法示例。


在下文中一共展示了EventType.ToString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Send

        public static bool Send(EventType eventType, string wfId, ulong taskId, string comment = "")
        {
            var eventing = Discovery.GetEventingService();

            try
            {
                WFStateUpdatedEvent wfEvent = new WFStateUpdatedEvent();
                wfEvent.WFStepCode = taskId.ToString();
                wfEvent.WFRunCode = wfId;
                wfEvent.Comment = comment;

                switch (eventType)
                {
                    case EventType.TaskStarted:
                        wfEvent.WFStateUpdatedType = WFStateUpdatedTypeEnum.WFStepStarted;
                        break;
                    case EventType.TaskCompleted:
                        wfEvent.WFStateUpdatedType = WFStateUpdatedTypeEnum.WFStepFinished;
                        break;
                    case EventType.TaskFailed:
                        wfEvent.WFStateUpdatedType = WFStateUpdatedTypeEnum.WFStepError;
                        break;
                    default:
                        throw new ArgumentOutOfRangeException("eventType");
                }

                EventReport eventArgs = new EventReport()
                {
                    Source = "Execution",
                    Body =  Easis.Eventing.EventReportSerializer.SerializeObject(wfEvent, typeof(WFStateUpdatedEvent)),
                    SchemeUri = "http://escience.ifmo.ru/easis/eventing/schemes/WFStateUpdatedEvent.xsd",
                    Timestamp = DateTime.Now,
                    Topic = "WFStateUpdatedEvent"
                };

                eventing.FireEvent(eventArgs);
                eventing.Close();

                Log.Debug(String.Format("Event sent: {0}. WfId = {1}, TaskId = {2}", eventType.ToString(), wfId, taskId));
                return true;
            }
            catch (Exception e)
            {
                eventing.Abort();

                Log.Warn(String.Format("Event was NOT sent: {0}, WfId = {1}, TaskId = {2}: {3}",
                    eventType.ToString(), wfId, taskId, e.ToString()
                ));
                return false;
            }
        }
开发者ID:kbochenina,项目名称:Kraken,代码行数:51,代码来源:Eventing.cs

示例2: CreateDataPackage

        private JsonObject CreateDataPackage(string actuatorId, EventType eventType)
        {
            JsonObject data = new JsonObject();
            data.SetNamedValue("timestamp", JsonValue.CreateStringValue(DateTime.Now.ToString("O")));
            data.SetNamedValue("type", JsonValue.CreateStringValue(eventType.ToString()));
            data.SetNamedValue("actuator", JsonValue.CreateStringValue(actuatorId));

            return data;
        }
开发者ID:rishabhbanga,项目名称:CK.HomeAutomation,代码行数:9,代码来源:AzureEventHubPublisher.cs

示例3: EventMarket

        //use for subscribing
        internal EventMarket(EventType evtType, CorrelationID corr, IEnumerable<Subscription> subscriptions)
        {
            this._messages = new List<Message>();

            switch (evtType)
            {
                case EventType.SESSION_STATUS:
                    base._type = evtType;
                    MessageMarketSessionOpened msgSessionOpened = new MessageMarketSessionOpened();
                    this._messages.Add(msgSessionOpened);
                    break;

                case EventType.SERVICE_STATUS:
                    base._type = evtType;
                    MessageMarketServiceStatus msgServiceStatus = new MessageMarketServiceStatus(corr);
                    this._messages.Add(msgServiceStatus);
                    break;

                case EventType.SUBSCRIPTION_STATUS:
                    base._type = evtType;
                    foreach (var item in subscriptions)
                    {
                        bool securityError = Types.Rules.IsSecurityError(item.Security);
                        if (securityError)
                        {
                            MessageMarketSubscriptionFailure msgError = new MessageMarketSubscriptionFailure(item);
                            this._messages.Add(msgError);
                        }
                        else
                        {
                            MessageMarketSubscriptionStarted msgSubStatus = new MessageMarketSubscriptionStarted(item);
                            this._messages.Add(msgSubStatus);
                        }
                    }
                    break;

                case EventType.SUBSCRIPTION_DATA:
                    base._type = evtType;
                    foreach (var item in subscriptions)
                    {
                        bool securityError = Types.Rules.IsSecurityError(item.Security);
                        if (!securityError)
                        {
                            MessageMarketSubscriptionData msgSubData = new MessageMarketSubscriptionData(item, EventMarket.GenerateFakeMessageData(item));
                            this._messages.Add(msgSubData);
                        }
                    }
                    break;

                default:
                    throw new NotImplementedException(string.Format("BEmu.MarketDataRequest.EventMarket.EventMarket: doesn't expect EventType {0}", evtType.ToString()));
            }
        }
开发者ID:rowlandwatkins,项目名称:BEmu,代码行数:54,代码来源:EventMarket.cs

示例4: MagnetLinkNotification

        public MagnetLinkNotification(EventType type, string mg_name, string infohash)
        {
            this.mg_name = mg_name;
            this.infohash = infohash;

            this.ID = string.Format("magnet_nofitication_" + type.ToString() + infohash);

            this.Type = map_et_to_nt(type);

            this.Title = string.Format("Maget link: {0}", mg_name);

            this.Message = map_et_to_msg(type);
        }
开发者ID:hexafluoride,项目名称:byteflood,代码行数:13,代码来源:NotificationManager.cs

示例5: ToStringTest

        public void ToStringTest(EventType type, int channel, int data1)
        {
            var midiEvent = new MidiEvent(type, channel, data1, 0);
            var str = midiEvent.ToString();

            Assert.IsNotNull(str);
            Assert.IsFalse(string.IsNullOrWhiteSpace(str));

            StringAssert.Contains(type.ToString(), str);
            StringAssert.Contains(channel.ToString(), str);
            StringAssert.Contains(data1.ToString(), str);

            // data2 is not contained in MidiEvent#ToString
        }
开发者ID:nanase,项目名称:MidiUtils,代码行数:14,代码来源:MidiEventTest.cs

示例6: Format

        public string Format(EventType type, Dictionary<string, object> data)
        {
            var builder = new StringBuilder();

            AppendPart(builder, type.ToString().ToUpper());
            AppendPart(builder, ((Type) data["Source"]).Name);
            AppendPart(builder, ((DateTime) data["EventTime"]).ToString("hh:mm:ss"));

            if (Formatters.ContainsKey(type))
                Formatters[type](builder, data);

            builder.AppendLine();

            return builder.ToString();
        }
开发者ID:GeeksDiary,项目名称:Molecules,代码行数:15,代码来源:DefaultTextEventFormatter.cs

示例7: TrackEventAsync

        public async void TrackEventAsync(EventType eventType, string action, object label = null)
        {
            List<KeyValuePair<string, string>> parameters = new List<KeyValuePair<string, string>>
            {
                new KeyValuePair<string, string>(GAResources.EventCategoryKey, eventType.ToString()),
                new KeyValuePair<string, string>(GAResources.EventActionKey, action)
            };

            if (label != null)
            {
                parameters.Add(new KeyValuePair<string, string>(GAResources.Label, label.ToString()));
            }

            await Track(HitTypes.Event, parameters.ToArray());
        }
开发者ID:rburda82,项目名称:proxysearcher,代码行数:15,代码来源:GoogleAnalyticsManager.cs

示例8: Orientation2MovementDirection

 public static MovementDirection Orientation2MovementDirection(EventType eventType)
 {
     if (eventType == EventType.setRightOrientation)
     {
         return MovementDirection.goRight;
     }
     else if (eventType == EventType.setLeftOrientation)
     {
         return MovementDirection.goLeft;
     }
     else
     {
         throw new Exception("Orientation2MovementDirection: Not valid eventType: " + eventType.ToString());
     }
 }
开发者ID:MartyIX,项目名称:SoTh,代码行数:15,代码来源:GameObject.cs

示例9: Log

        public static void Log(Level level, EventType type, EventAction action, string data)
        {
            using (ApplicationDbContext dbContext = ApplicationDbContext.Create())
            {
                AuditLogModel logModel = new AuditLogModel();
                logModel.Level = level.ToString();
                logModel.EventType = type.ToString();
                logModel.EventAction = action.ToString();
                logModel.Data = data;
                logModel.UTC = DateTime.UtcNow;

                dbContext.Entry(logModel).State = EntityState.Added;
                dbContext.SaveChanges();
            }
        }
开发者ID:exactsync,项目名称:ExactSync,代码行数:15,代码来源:AuditLogService.cs

示例10: LogEvent

        internal void LogEvent(Guid objectId, Type objectType, Guid userGuid, string client, EventType action, string message)
        {
            using (var db = new IntiDataContext(_connectionString))
            {
                var logEvent = new Ext_ChangeLog();
                logEvent.ObjectGUID = objectId;
                logEvent.ObjectType = objectType.Name;
                logEvent.UserGUID = userGuid;
                logEvent.Client = client;
                logEvent.Action = action.ToString();
                logEvent.Message = message;
                logEvent.LogDate = DateTime.Now;

                db.Ext_ChangeLog.InsertOnSubmit(logEvent);
                db.SubmitChanges();
            }
        }
开发者ID:supersalad,项目名称:Interntipset,代码行数:17,代码来源:IntiManagementBase.cs

示例11: ReadContextFromFile

    private static void ReadContextFromFile(EventType typeContext)
    {
        //Debug.Log(Application.dataPath);
        //TextAsset file = Resources.LoadAssetAtPath("Assets/Resources/Editor/EventContext.xml", typeof(TextAsset)) as TextAsset;
        //Debug.Log("File null: " + (file == null));
        XmlDocument doc = new XmlDocument();
        //doc.LoadXml(file.text);
        doc.Load(Application.dataPath + "/Resources/Editor/EventContext.xml");
        XmlNode node = doc.DocumentElement;
        node = node.SelectSingleNode(".//" + typeContext.ToString());
        //node.GetElementsByTagName(typeContext.ToString())[0];

        foreach (XmlNode child in node.ChildNodes)
        {
          Debug.Log("Adding " + child.InnerText + " to " + typeContext + " context.");
          context.Add(typeContext, child.InnerText);
        }
    }
开发者ID:shawnmiller,项目名称:RoomWithTheMoose,代码行数:18,代码来源:EventStepDataContext.cs

示例12: SendEvent

 /// <summary>
 /// Send event
 /// </summary>
 /// <param name="eventType">the event type to send</param>
 /// <param name="sender">reference to the sender (this)</param>
 public void SendEvent( EventType eventType, ILinkableComponent sender)
 {
     if (((Oatc.OpenMI.Sdk.Backbone.LinkableComponent)this.link.TargetComponent).HasListeners())
       {
       Oatc.OpenMI.Sdk.Backbone.Event eventD = new Oatc.OpenMI.Sdk.Backbone.Event(eventType);
       eventD.Description = eventType.ToString();
       eventD.Sender = sender;
       ITime t = this._engine.GetCurrentTime();
       if (t is ITimeStamp)
       {
           eventD.SimulationTime = t as ITimeStamp;
       }
       else
       {
           eventD.SimulationTime = ((ITimeSpan)this._engine.GetCurrentTime()).End;
       }
       this.link.TargetComponent.SendEvent(eventD);
       }
 }
开发者ID:CNH-Hyper-Extractive,项目名称:parallel-sdk,代码行数:24,代码来源:SmartInputLink.cs

示例13: EventModel

        public EventModel(ThingModel thing, EventType type)
            : this(thing)
        {
            EventProperties["EventType"] = type.ToString();            

            switch (type)
            {
                case EventType.Change:
                    break;
                case EventType.Add:
                    break;
                case EventType.Delete:
                    break;
                case EventType.Message:
                    EventProperties.Add("EventMessage", string.Empty); // Add if this is a message
                    break;
                default:
                    break;
            }
        }
开发者ID:toSvenson,项目名称:Iotiva,代码行数:20,代码来源:EventModel.cs

示例14: RegisterVKeCRMClientReloadWithParamterControlAction

        /// <summary>
        /// It will get the value from the itself control, and then to set the paratmer of target control with reloading
        /// </summary>
        /// <param name="control"></param>
        /// <param name="eventType"></param>
        /// <param name="targetControl"></param>
        /// <param name="associatedParamterName"></param>
        public static void RegisterVKeCRMClientReloadWithParamterControlAction(this System.Web.UI.Control control, EventType eventType, ControlBase targetControl, string associatedParamterName)
        {
            //We must treate our VKeCRM control for special client id
            string sourceClientId = control is ControlBase ? ((ControlBase)control).GeneratedControlId : control.ClientID;

            if (control is ControlBase)
            {
                ((ControlBase)control).AddClientControlBinding(sourceClientId,  targetControl.DataStoreID, associatedParamterName, eventType, true);
            }
            else
            {

                string function = string.Format(ClientHelper.FuncRegisterListener,
                                                        sourceClientId, targetControl.DataStoreID,
                                                        associatedParamterName, "true",
                                                        eventType.ToString().ToLower(), sourceClientId);
                control.Page.ClientScript.RegisterStartupScript(control.GetType(),
                                                             control.ClientID + targetControl.ClientID + "InitFunc", function, true);
            }
        }
开发者ID:VKeCRM,项目名称:V2,代码行数:27,代码来源:ControlExtension.cs

示例15: ToString

 public static string ToString(EventType type)
 {
     switch (type)
     {
         case EventType.ObjectCreate:
             return "ac";
         case EventType.ObjectUpdate:
             return "au";
         case EventType.ObjectDelete:
             return "ad";
         case EventType.ConnectionCreate:
             return "cc";
         case EventType.ConnectionUpdate:
             return "cu";
         case EventType.ConnectionDelete:
             return "cd";
         default:
             throw new Exception("Unsupported event type " + type.ToString() + ".");
     }
 }
开发者ID:ytokas,项目名称:appacitive-dotnet-sdk,代码行数:20,代码来源:NamingConvention.cs


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