本文整理汇总了C#中MessageType.Equals方法的典型用法代码示例。如果您正苦于以下问题:C# MessageType.Equals方法的具体用法?C# MessageType.Equals怎么用?C# MessageType.Equals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MessageType
的用法示例。
在下文中一共展示了MessageType.Equals方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FormatMessage
/* ======================== SUPPORT FUNCTIONS ============================= */
private String FormatMessage(String msg, MessageType type, int level)
{
String prefix = "[^b" + GetPluginName() + "^n]:" + level + " ";
if (Thread.CurrentThread.Name != null) prefix += "Thread(^b^5" + Thread.CurrentThread.Name + "^0^n): ";
if (type.Equals(MessageType.Warning))
prefix += "^1^bWARNING^0^n: ";
else if (type.Equals(MessageType.Error))
prefix += "^1^bERROR^0^n: ";
else if (type.Equals(MessageType.Exception))
prefix += "^1^bEXCEPTION^0^n: ";
else if (type.Equals(MessageType.Debug))
prefix += "^9^bDEBUG^n: ";
return prefix + msg;
}
示例2: FormatMessage
public String FormatMessage(String msg, MessageType type)
{
String prefix = "[^b" + GetPluginName() + "^n] ";
if (type.Equals(MessageType.Warning))
prefix += "^1^bWARNING^0^n: ";
else if (type.Equals(MessageType.Error))
prefix += "^1^bERROR^0^n: ";
else if (type.Equals(MessageType.Exception))
prefix += "^1^bEXCEPTION^0^n: ";
return prefix + msg;
}
示例3: GetUserMessages
/// <summary>
/// Get all messages of current user.
/// </summary>
/// <param name="userID">Sender user idetifier.</param>
/// <param name="type">Type of message.</param>
/// <param name="selectType">Type of message selecting.</param>
/// <returns>List of user messages.</returns>
public static IEnumerable<Message> GetUserMessages(
Guid userID, MessageType type, MessageSelectType selectType)
{
IEnumerable<Message> recordList = null;
using (SocialNetworkDBEntities record = new SocialNetworkDBEntities())
{
if (type.Equals(MessageType.Posted))
{
switch (selectType)
{
case MessageSelectType.All:
{
recordList = record.Messages
.Where(w => w.FromID == userID && !w.IsDeletedBySender)
.OrderByDescending(o => o.SendDate)
.Select(s => new Message
{
MessageID = s.MessageID,
FromID = s.FromID,
ToID = s.ToID,
SendDate = s.SendDate,
Header = s.Header,
Text = s.Text,
Status = s.Status,
IsDeletedBySender = s.IsDeletedBySender,
IsDeletedByReceiver = s.IsDeletedByReceiver
})
.ToList();
}
break;
case MessageSelectType.OnlyNew:
{
}
break;
case MessageSelectType.OnlyOld:
{
}
break;
}
}
else
{
switch (selectType)
{
case MessageSelectType.All:
{
recordList = record.Messages
.Where(w => w.ToID == userID && !w.IsDeletedByReceiver)
.OrderByDescending(o => o.SendDate)
.Select(s => new Message
{
MessageID = s.MessageID,
FromID = s.FromID,
ToID = s.ToID,
SendDate = s.SendDate,
Header = s.Header,
Text = s.Text,
Status = s.Status,
IsDeletedBySender = s.IsDeletedBySender,
IsDeletedByReceiver = s.IsDeletedByReceiver
})
.ToList();
}
break;
case MessageSelectType.OnlyNew:
{
}
break;
case MessageSelectType.OnlyOld:
{
}
break;
}
}
}
return recordList;
}
示例4: GetMenuEventLogModel
/****** 获取菜单点击的信息 **************/
private MenuEventLog GetMenuEventLogModel(MessageType msgType)
{
MenuEventLog menuLog = new MenuEventLog();
var root = doc.DocumentElement;
menuLog.FromUserName = root.SelectSingleNode("FromUserName").InnerText;
menuLog.clickTime = FormatTime(root.SelectSingleNode("CreateTime").InnerText);
string menuKey = root.SelectSingleNode("EventKey").InnerText;
if (msgType.Equals(MessageType.EventView))
{
int index = menuKey.IndexOf("=");
int endIndex = menuKey.IndexOf("&");
if (endIndex > index)
menuKey = menuKey.Substring(index + 1, endIndex - index - 1);
}
menuLog.menuId = menuKey;
return menuLog;
}