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


C# Category.ToString方法代码示例

本文整理汇总了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));
 }
开发者ID:christal1980,项目名称:wingsoa,代码行数:7,代码来源:ServerBootLoggerAdapter.cs

示例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();
        }
开发者ID:LooWooTech,项目名称:Jurisdiction,代码行数:27,代码来源:ADGroupManager.cs

示例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);
 }
开发者ID:nchicas,项目名称:Combinado,代码行数:7,代码来源:ProductsPage.cs

示例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 );
            }
        }
开发者ID:Markusyatina,项目名称:steam-irc-bot,代码行数:30,代码来源:Log.cs

示例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);
        }
开发者ID:eslahi,项目名称:prism,代码行数:13,代码来源:TextLogger.cs

示例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;
 }
开发者ID:modulexcite,项目名称:docs-8,代码行数:7,代码来源:PrefixHelper.cs

示例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;
        }
开发者ID:Theeranit,项目名称:DealMarker,代码行数:32,代码来源:Tracking.cs

示例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);
                }
            }
        }
开发者ID:winleaks,项目名称:AzureDNS,代码行数:28,代码来源:AppLogger.cs

示例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}
     });
 }
开发者ID:beavis28,项目名称:power8,代码行数:10,代码来源:Analytics.cs

示例10: Log

 public void Log(string message, Category category, Priority priority)
 {
     try
     {
         Logger.Write(message, category.ToString(), (int)priority);
     }
     catch (Exception)
     {
     }
 }
开发者ID:basio,项目名称:veropos,代码行数:10,代码来源:EntLibLoggerAdapter.cs

示例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();
        }
开发者ID:jjvdgeer,项目名称:Yahtzee,代码行数:12,代码来源:YahtzeeViewModel.cs

示例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);
        }
开发者ID:ZR2,项目名称:SteamToTwitter,代码行数:12,代码来源:Log.cs

示例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)
     };
 }
开发者ID:Damovisa,项目名称:AnimalWars,代码行数:12,代码来源:AnimalWarsData.cs

示例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);
            }
        }
开发者ID:ruslanlyalko,项目名称:DA,代码行数:22,代码来源:Logger.cs

示例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));
            }
        }
开发者ID:npoCaputo,项目名称:openpandora,代码行数:16,代码来源:Messenger.cs


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