本文整理汇总了C#中Categories.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# Categories.ToString方法的具体用法?C# Categories.ToString怎么用?C# Categories.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Categories
的用法示例。
在下文中一共展示了Categories.ToString方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Track
public void Track(Categories category, string action, string label = null, int value = 0)
{
if (!_disabled)
_tracker.TrackEventAsync(category.ToString(), action, label, value);
System.Diagnostics.Debug.WriteLine("Analytics: {0}/{1}/{2}/{3}", category.ToString(), action, label, value);
}
示例2: TrackAsync
public async Task TrackAsync(Categories category, string action, string label = null, int value = 0)
{
System.Diagnostics.Debug.WriteLine("Analytics: Async: {0}/{1}/{2}/{3}", category.ToString(), action, label, value);
if (!_disabled)
await _tracker.TrackEventAsync(category.ToString(), action, label, value);
}
示例3: addChildToCategory
/// <summary>
/// This method adds a child to a specific category.
/// </summary>
/// <param name="category">MUSIC or IMAGES or VIDEOS or EBOOKS or OTHERS</param>
/// <param name="childValue">string-value</param>
public void addChildToCategory(Categories category,String childValue)
{
XmlNode node = root.SelectSingleNode(category.ToString());
int childAmount = node.ChildNodes.Count;
XmlNode nChild = this.xmldoc.CreateElement("value"+childAmount);
nChild.InnerText = childValue;
//nChild.
node.AppendChild(nChild);
}
示例4: GetWord
protected string GetWord(Categories category)
{
var allWords = this.FakeWordCollection
.Where(x => x.Contains(category.ToString())).ToArray();
if (allWords.Length <= 0)
{
throw new ArgumentException("No word found.");
}
var randomIndex = this.random.Next(0, allWords.Count());
var separator = allWords[randomIndex].IndexOf(" ", StringComparison.Ordinal) + 1;
var word = allWords[randomIndex].Substring(separator);
return word.Trim();
}
示例5: GetRandomWordByCategory
/// <summary>
/// Gets a random word by a category.
/// </summary>
/// <param name="category">Category of words.</param>
/// <returns>String representation of word.</returns>
public string GetRandomWordByCategory(Categories category)
{
var allWords = this.DataSerialization.ReadFromFile(FileNames.words)
.Where(x => x.Contains(category.ToString())).ToArray();
if (allWords.Length <= 0)
{
throw new ArgumentException("No word found.");
}
var randomIndex = this.random.Next(0, allWords.Count());
var separator = allWords[randomIndex].IndexOf(" ", StringComparison.Ordinal) + 1;
var word = allWords[randomIndex].Substring(separator);
return word.Trim();
}
示例6: CreateTimedEvent
public IDisposable CreateTimedEvent(Categories category, string variable, string description, int? value)
{
if (!ReportingAnalytics) return Disposable;
var e = new TimedEvent()
{
Category = category.ToString(),
VariableName = variable,
Description = description,
Value = value
};
//Timed event does not need startup tracking.
return e;
}
示例7: TrackTimedEvent
public void TrackTimedEvent(Categories category, string variable, TimeSpan time, string description = "")
{
if (!ReportingAnalytics) return;
var e = new TimedEvent(time)
{
Category = category.ToString(),
VariableName = variable,
Description = description
};
e.Track();
}
示例8: TrackEvent
public void TrackEvent(Actions action, Categories category, string description, int? value)
{
if (!ReportingAnalytics) return;
var e = AnalyticsEvent.Create(category.ToString(), action.ToString(), description, value);
e.Track();
}
示例9: getAllChildsFrom
/// <summary>
/// Get all childs of a category
/// </summary>
/// <param name="category">From which category?</param>
/// <returns>A string-list of childs</returns>
public List<String> getAllChildsFrom(Categories category)
{
List<String> allChilds = new List<string>();
XmlNode node = root.SelectSingleNode(category.ToString());
foreach (XmlNode n in node.ChildNodes)
{
allChilds.Add(n.InnerText);
}
return allChilds;
}
示例10: deleteChildFromCategory
/// <summary>
/// Deletes a child from a category..
/// </summary>
/// <param name="category">From which category?</param>
/// <param name="childValue">Which child?</param>
public void deleteChildFromCategory(Categories category, String childValue)
{
XmlNode node = root.SelectSingleNode(category.ToString());
for (int i = 0; i < node.ChildNodes.Count; i++)
{
if (node.ChildNodes[i].InnerText == childValue)
{
node.RemoveChild(node.ChildNodes[i]);
break;
}
}
}
示例11: GetCategoryName
private static string GetCategoryName(Categories cat)
{
// Get the type
Type type = cat.GetType();
// Get fieldinfo for this type
System.Reflection.FieldInfo fieldInfo = type.GetField(cat.ToString());
// Get the stringvalue attributes
CategoryNameAttribute[] attribs = fieldInfo.GetCustomAttributes(typeof(CategoryNameAttribute), false) as CategoryNameAttribute[];
// Return the first if there was a match.
return attribs.Length > 0 ? attribs[0].Name : null;
}
示例12: GetCategoryDefaultTraceSeverity
private static TraceSeverity GetCategoryDefaultTraceSeverity(Categories cat)
{
// Get the type
Type type = cat.GetType();
// Get fieldinfo for this type
System.Reflection.FieldInfo fieldInfo = type.GetField(cat.ToString());
// Get the stringvalue attributes
DefaultTraceSeverityAttribute[] attribs = fieldInfo.GetCustomAttributes(typeof(DefaultTraceSeverityAttribute), false) as DefaultTraceSeverityAttribute[];
// Return the first if there was a match.
return attribs.Length > 0 ? attribs[0].Severity : TraceSeverity.Unexpected;
}
示例13:
public SPDiagnosticsCategory this[Categories id]
{
get { return Areas[DiagnosticsAreaName].Categories[id.ToString()]; }
}