本文整理汇总了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;
}
}
示例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;
}
示例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()));
}
}
示例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);
}
示例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
}
示例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();
}
示例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());
}
示例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());
}
}
示例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();
}
}
示例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();
}
}
示例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);
}
}
示例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);
}
}
示例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;
}
}
示例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);
}
}
示例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() + ".");
}
}