本文整理汇总了C#中Activity.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# Activity.ToString方法的具体用法?C# Activity.ToString怎么用?C# Activity.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Activity
的用法示例。
在下文中一共展示了Activity.ToString方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetFrequency
public static int GetFrequency(ITashaPerson person, Activity activity, Random random)
{
int freq = 0;
var distID = Distribution.GetDistributionID( person, activity );
if ( distID < 0 )
{
throw new XTMFRuntimeException( "We were unable to get the distribution ID number for a person doing a '" + activity.ToString()
+ "' episode The person's householdID was " + person.Household.HouseholdId + ", personID was " + person.Id + ", was " + person.Age +
" years old, with employment status '" + person.EmploymentStatus.ToString() + "' occupation '" + person.Occupation.ToString() + "' Student Status '"
+ person.StudentStatus.ToString() + "'. Their work zone is '" + ( person.EmploymentZone != null ? person.EmploymentZone.ZoneNumber.ToString() : "None" )
+ "' and their school zone is '"
+ ( person.SchoolZone != null ? person.SchoolZone.ZoneNumber.ToString() : "None" ) + "'." );
}
freq = Distribution.GetRandomFrequencyValue(
0, Distribution.NumberOfFrequencies - 1, random, distID );
return freq;
}
示例2: WriteToStorageList
private static void WriteToStorageList(Activity activity, string message)
{
if(!Log.WriteToDistributedMemory)
{
return;
}
var resource = BluepathListener.NodeGuid.ToString();
if (activity != Activity.Custom)
{
message = activity.ToString().Replace('_', ' ');
}
try
{
var logThread = new System.Threading.Thread(() =>
{
try
{
int retryCount = 5;
int retryNo = 0;
// jest zahardcodowany new RedisStorage!! (??)
var storage = new RedisStorage(DistributedMemoryHost);
var dateTime = DateTime.Now;
if (monotonicallyIncreasingLogTime)
{
dateTime = AssureTimeMonotonicity(dateTime, storage, string.Format("{0}_time", XesLogKey));
}
var list = new DistributedList<EventType>(storage, XesLogKey);
while (retryNo < retryCount)
{
try
{
list.Add(new EventType(message, resource, dateTime, EventType.Transition.Start));
break;
}
catch (Exception ex)
{
ExceptionMessage(ex, Log.Activity.Info, string.Format("Error on saving log to Redis[{0}]. {1}", retryNo, ex.StackTrace), logLocallyOnly: true);
retryNo++;
}
}
retryNo = 0;
while (retryNo < retryCount)
{
try
{
list.Add(new EventType(message, resource, dateTime, EventType.Transition.Complete));
break;
}
catch (Exception ex)
{
ExceptionMessage(ex, Log.Activity.Info, string.Format("Error on saving log to Redis[{0}]. {1}", retryNo, ex.StackTrace), logLocallyOnly: true);
retryNo++;
}
}
}
catch
{
}
});
logThread.IsBackground = false;
logThread.Start();
}
catch (NotSupportedException ex)
{
ExceptionMessage(ex, Log.Activity.Info, "Exception on saving log to DistributedList", logLocallyOnly: true);
}
}
示例3: ProcessInternal
protected override void ProcessInternal(CustomBinaryReader reader, XmlWriter writer)
{
byte b1=reader.ReadByte();
byte b2=reader.ReadByte();
slot=(byte) ((b1 & 0x80) >> 7);
// TODO: H: not sure why this is always returning zero (simple logic bug?)
status=(byte) ((b1 & 0x40));
inserted=(b1 & 0x20) == 0;
activity=(Activity) ((b1 & 0x18) >> 3);
time=(uint) (((b1 & 0x07) << 8) | b2);
if ( this.LogLevel == LogLevel.DEBUG || this.LogLevel == LogLevel.INFO )
{
long position=reader.BaseStream.Position;
if ( reader.BaseStream is CyclicStream )
position=((CyclicStream) reader.BaseStream).ActualPosition;
writer.WriteAttributeString("FileOffset", string.Format("0x{0:X4}", position));
}
writer.WriteAttributeString("Slot", slot.ToString());
writer.WriteAttributeString("Status", status.ToString());
writer.WriteAttributeString("Inserted", inserted.ToString());
writer.WriteAttributeString("Activity", activity.ToString());
writer.WriteAttributeString("Time", string.Format("{0:d2}:{1:d2}", time / 60, time % 60));
}
示例4: ActivityToString
/// <summary>
/// Converts an Activity enum to string.
/// </summary>
/// <returns>The activity in a string format.</returns>
/// <param name="action">Action.</param>
public static string ActivityToString(Activity action)
{
switch (action)
{
case Activity.HB_RHUS:
return CResources.HB_RHUS;
case Activity.HB_RHV:
return CResources.HB_RHV;
case Activity.HB_RHDS:
return CResources.HB_RHDS;
case Activity.HB_LHSS:
return CResources.HB_LHSS;
case Activity.P_S:
return CResources.P_S;
case Activity.P_SASS:
return CResources.P_SASS;
case Activity.J_BHS:
return CResources.JA_RHBS;
case Activity.J_SAS:
return CResources.JA_RHSS;
case Activity.GF_PK:
return CResources.GF_PK;
case Activity.H_SFTH:
return CResources.H_SFTH;
case Activity.DEFAULT:
return "default";
default:
return action.ToString();
}
}