本文整理汇总了C#中Category.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# Category.ToString方法的具体用法?C# Category.ToString怎么用?C# Category.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Category
的用法示例。
在下文中一共展示了Category.ToString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Log
public void Log(string message, Category category, Priority priority)
{
_bootLogger.Log(String.Format("{0}|{1}: {2}",
FormatString(category.ToString(), 9),
FormatString(priority.ToString(), 6),
message));
}
示例2: Create
public void Create(Group group,string Position,Category category)
{
if (string.IsNullOrEmpty(group.Name))
{
return;
}
DirectoryEntry Entry = Get("(&(OU="+Position+"))");
string nn = "CN=";
if (category == Category.organizationalUnit)
{
Entry = GetDirectoryObject();
nn = "OU=";
}
if (Entry == null)
{
throw new ArgumentException("未找到创建组的组织单元");
}
DirectoryEntry groupEntry = Entry.Children.Add(nn+ group.Name, category.ToString());
if (!string.IsNullOrEmpty(group.Descriptions))
{
groupEntry.Properties["description"].Add(group.Descriptions);
}
groupEntry.CommitChanges();
groupEntry.Close();
Entry.Close();
}
示例3: ProductsPage
public ProductsPage( Category category, Subcategory subcategory )
{
this.category = category;
this.subcategory = subcategory;
System.Diagnostics.Debug.WriteLine ( category.ToString() + " " + subcategory.ToString() );
InitializeComponents ().ConfigureAwait(false);
}
示例4: WriteLine
public static void WriteLine( Category category, string component, string format, params object[] args )
{
#if !DEBUG
if ( category == Category.Debug )
return; // don't print debug messages in release builds
#endif
string logLine = string.Format(
"{0} [{1}] {2}: {3}{4}",
DateTime.Now.ToLongTimeString(),
category.ToString().ToUpper(),
component,
string.Format( format, args ),
Environment.NewLine
);
Console.Write( logLine );
try
{
lock ( logLock )
{
File.AppendAllText( GetLogFile(), logLine );
}
}
catch ( Exception ex )
{
Console.WriteLine( "Unable to log to file: {0}", ex.Message );
}
}
示例5: Log
/// <summary>
/// Write a new log entry with the specified category and priority.
/// </summary>
/// <param name="message">Message body to log.</param>
/// <param name="category">Category of the entry.</param>
/// <param name="priority">The priority of the entry.</param>
public void Log(string message, Category category, Priority priority)
{
string messageToLog = String.Format(CultureInfo.InvariantCulture, Resources.DefaultTextLoggerPattern, DateTime.Now,
category.ToString().ToUpper(CultureInfo.InvariantCulture), message, priority.ToString());
writer.WriteLine(messageToLog);
}
示例6: GetCategoryPrefix
public static string GetCategoryPrefix(Category category)
{
var type = typeof(Category);
var memInfo = type.GetMember(category.ToString());
var attributes = memInfo[0].GetCustomAttributes(typeof(PrefixAttribute), false);
return ((PrefixAttribute)attributes[0]).Prefix;
}
示例7: isLoggable
/// <summary>
/// Compare the trace levels to determine whether the trace statement will be logged.
/// </summary>
/// <param name="logCategory">Switch name (which is the same as the ACA.NET Logging category name)</param>
/// <param name="tracingLevel">Level of the trace as defined by the trace statement in code</param>
/// <returns>Whether the statement can be logged</returns>
public static bool isLoggable(Category logCategory, int tracingLevel)
{
bool traceStatus = false;
int switchLevel = 0;
// Create an instance of the trace switch
TraceSwitch mySwitch = new TraceSwitch(logCategory.ToString(), "");
// If valid, grab the level
if (mySwitch != null)
switchLevel = TracingLevel(mySwitch.Level);
//else
// throw new ConfigurationException(ERROR_CONFIGURATION_MISSING_SWITCH);
// Compare the levels if valid
if (switchLevel > 0)
{
if (switchLevel >= tracingLevel)
traceStatus = true; // Minimal tracing level met
}
// Tracing is off, disable logging
else
traceStatus = true;
return traceStatus;
}
示例8: Log
public void Log(string message, Category category, Priority priority)
{
lock (this)
{
Trace.WriteLine(message, category.ToString());
var data = new LogMessage();
data.Message = message;
data.Category = category;
data.Priority = priority;
try
{
if (!container.IsRegistered<LogViewer>()) throw new NotImplementedException();
var aggregator = container.Resolve<IEventAggregator>();
while (failedMessages.Any())
{
var item = failedMessages.Dequeue();
aggregator.GetEvent<LogEvent>().Publish(item);
}
aggregator.GetEvent<LogEvent>().Publish(data);
}
catch (Exception)
{
failedMessages.Enqueue(data);
}
}
}
示例9: PostEvent
public static void PostEvent(Category category, string action, string label, int? value)
{
AnalyticsCallAsync("event", new Dictionary<string, string>
{
{"ec", category.ToString()},
{"ea", Cut(action, 500)},
{"el", Cut(label, 500)},
{"ev", value.HasValue ? value.ToString() : null}
});
}
示例10: Log
public void Log(string message, Category category, Priority priority)
{
try
{
Logger.Write(message, category.ToString(), (int)priority);
}
catch (Exception)
{
}
}
示例11: ConvertToText
private string ConvertToText(Category category)
{
var value = category.ToString();
var replacements = value
.Where(char.IsUpper)
.Select(c => new { From = c.ToString(), To = string.Format(" {0}", char.ToLower(c)) })
.ToList();
replacements.ForEach(r => value = value.Replace(r.From, r.To));
return value.Trim();
}
示例12: WriteLine
private static void WriteLine(Category category, string component, string format, params object[] args)
{
string logLine = string.Format(
"{0} [{1}] {2}: {3}",
DateTime.Now.ToLongTimeString(),
category.ToString().ToUpper(),
component,
string.Format(format, args)
);
Console.WriteLine(logLine);
}
示例13: GetSingleWar
public AnimalWar GetSingleWar(Category animalCategory)
{
var query =
"SELECT TOP 2 Id, Name, Category, Image, Count FROM Animals WHERE Category = @category ORDER BY newid()";
var animals = _cnn.Query<Animal>(query, new { category = animalCategory.ToString() }).ToList();
return new AnimalWar
{
//Category = animals.First().Category,
AnimalOne = animals.First(),
AnimalTwo = animals.ElementAt(1)
};
}
示例14: LogAdd
public void LogAdd(string message, Category cat, bool writeOnlyToFile=false)
{
try
{
if (_listView != null && !writeOnlyToFile)
{
_listView.Invoke((Action)delegate
{
ListViewItem item = _listView.Items.Add(message);
item.SubItems.Add(DateTime.Now.ToString(CultureInfo.InvariantCulture));
item.SubItems.Add(cat.ToString());
});
}
File.AppendAllText("log_" + DateTime.Today.ToString("MM.yyyy") + ".log", DateTime.Now.ToString("dd.MM HH:mm:ss")
+ " | " + message +
" | " + cat.ToString() + Environment.NewLine);
}catch(Exception ex)
{
Console.WriteLine(ex.Message);
}
}
示例15: SetMessage
public static void SetMessage(bool enable, Category category, string message)
{
string buffer = "\\0" + category.ToString() + "\\0" + (enable ? "1" : "0") + "\\0{0}\\0" + message + "\\0\\0\\0\\0\0";
int handle = 0;
messengerData.dwData = 0x0547;
messengerData.lpData = VarPtr(buffer);
messengerData.cbData = buffer.Length * 2;
handle = User32.FindWindowEx(0, handle, "MsnMsgrUIManager", null);
if (handle > 0)
{
User32.SendMessage(handle, WindowsMessageCode.WM_COPYDATA, 0, VarPtr(messengerData));
}
}