本文整理汇总了C#中MessageType.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# MessageType.ToString方法的具体用法?C# MessageType.ToString怎么用?C# MessageType.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MessageType
的用法示例。
在下文中一共展示了MessageType.ToString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetRedirectMessage
protected void SetRedirectMessage(MessageType messageType, string message)
{
if (String.IsNullOrEmpty(message))
{
return;
}
if(!TempData.ContainsKey(messageType.ToString()))
{
TempData.Add(messageType.ToString(), new List<string>());
}
((List<string>)TempData[messageType.ToString()]).Add(message);
}
示例2: Log
public static void Log(MessageType logLevel, string message, params object[] fmt)
{
if (debugInstance != null)
debugInstance.logMessageQueue.Enqueue(String.Format("[{0}] {1}: {2}", DateTime.Now.ToString("hh:mm:ss"), logLevel.ToString(), String.Format(message, fmt)));
else
throw new NullReferenceException("Tried to log a message, but log queue is not initialized");
}
示例3: append
public static bool append(String message, MessageType mt)
{
try
{
// get name of calling module and function
System.Diagnostics.StackTrace stackTrace = new System.Diagnostics.StackTrace();
System.Reflection.MethodBase mb = stackTrace.GetFrame(0).GetMethod(); // =this function
String name = mb.Name;
for(int i = 1; i < stackTrace.FrameCount; i++)
{
mb = stackTrace.GetFrame(i).GetMethod();
if(mb.Name != name)
break;
}
//Build and then write the (CSV formatted) line to todays log file
String logName = getLogName();
String dateStamp = DateTime.Today.ToString("yyyyMMdd");
String timeStamp = DateTime.Now.ToString("HH:mm:ss.fff");
String line = String.Format("{0},{1},{2},{3},{4},\"{5}\"{6}", dateStamp, timeStamp, mb.Module, mb.Name, mt.ToString(), message.Replace(',',';').Replace('"','\''), Environment.NewLine);
System.IO.File.AppendAllText(logName, line);
}
catch(Exception ex)
{
// Log errors for testing, but ignore when live
System.Diagnostics.Debug.WriteLine(ex.Message);
return false;
}
return true;
}
示例4: FormedMessage
public static string FormedMessage(string msg, MessageType type)
{
var res = new StringBuilder();
string id = "infoMsg" + Guid.NewGuid().ToString();
res.AppendFormat("<div id='{0}' class='alert {1}' onclick='$(this).hide();'>{2}</div>", id, type.ToString(),
msg);
return res.ToString();
}
示例5: Show
public void Show(MessageType messageType, string message)
{
CloseButton.Visible = ShowCloseButton;
litMessage.Text = message;
panelMessageBox.CssClass = messageType.ToString().ToLower();
this.Visible = true;
}
示例6: Write
public static void Write(MessageType type, String category, String id, String textWithFormat, params object[] objs)
{
Console.WriteLine("[{0}] {1} - {2} ({3}): {4}",
type.ToString(),
DateTime.Now.ToLocalTime(),
category,
id ?? "0",
String.Format(textWithFormat, objs));
}
示例7: AddMessage
/// <summary>
/// 输出信息
/// </summary>
/// <param name="messageType"></param>
/// <param name="message"></param>
public static void AddMessage(MessageType messageType, string message)
{
stringBuilder.Clear();
stringBuilder.Append("[" + DateTime.Now.ToString() + "]");
stringBuilder.Append(" " + messageType.ToString() + ": " + message);
stringBuilder.Append(Environment.NewLine);
WriteLogToFile(stringBuilder.ToString());
ShowLogHandle();
}
示例8: BasicTextLogger
/// <summary>
/// Constructor
/// </summary>
/// <param name="iFullPath">Full path of the log file to create.</param>
/// <param name="iMessageTypes">The type of messages that you would like logged, anything else is ignored.</param>
private BasicTextLogger(String iFullPath, MessageType iMessageTypes)
{
cStrFullPath = iFullPath;
cFSmOutput = File.Open(iFullPath, FileMode.Append, FileAccess.Write, FileShare.Read);
cSWrOutput = new StreamWriter(cFSmOutput);
cSWrOutput.AutoFlush = true;
cMTeTypes = iMessageTypes;
WriteLine(MessageType.debug, "Debugger initialised to display '{0}' messages.", iMessageTypes.ToString());
}
示例9: GetMailMessageToSend
public virtual MailMessage GetMailMessageToSend(MessageType messageType, string subject, object model, RecipientModel recipientModel)
{
var mailMessage = new MailMessage{Subject = subject};
var mailAddress = new MailAddress(recipientModel.Email, recipientModel.FullName);
mailMessage.To.Add(mailAddress);
this.ViewData = new ViewDataDictionary(model);
PopulateBody(mailMessage, viewName: messageType.ToString());
return mailMessage;
}
示例10: ShowMessage
public void ShowMessage(MessageType messageType, string message, bool showAfterRedirect = false)
{
var messageTypeKey = messageType.ToString();
if (showAfterRedirect)
{
this.TempData[messageTypeKey] = message;
}
else
{
this.ViewData[messageTypeKey] = message;
}
}
示例11: Show
public void Show(MessageType messageType, string message, int height, int width)
{
CloseButton.Visible = ShowCloseButton;
litMessage.Text = message;
MessageBox.Height = height;
MessageBox.Width = width;
MessageBox.CssClass = messageType.ToString().ToLower();
ModalPopupExtenderMessage.Show();
this.Visible = true;
}
示例12: ShowMessage
public static void ShowMessage(this Controller controller, MessageType messageType, string message, bool showAfterRedirect = false)
{
var messageTypeKey = messageType.ToString();
if (showAfterRedirect)
{
controller.TempData[messageTypeKey] = message;
}
else
{
controller.ViewData[messageTypeKey] = message;
}
}
示例13: CreateMessage
// Public methods.
public static IMessage CreateMessage(MessageType type, MemoryStream stream, ILogger logger)
{
IMessage message = GenerateMessage(type);
if (null != message) {
message.SerializeFrom(stream);
}
else {
logger.Error<MessageFactory>("Unable to serialize message of type {0} from {1}", type.ToString(), BitConverter.ToString(stream.GetBuffer()));
}
return message;
}
示例14: BeginMessage
public void BeginMessage(MessageType messageType)
{
Result = Message.Create(messageType);
#if DEBUG
var count = 2;
if (messageType == MessageType.Request) count++;
Debug.BeginStruct(count);
Debug.BeginItem();
Debug.WritePropertyName("messageType");
Debug.WriteStringValue(messageType.ToString());
Debug.EndItem();
#endif
}
示例15: WriteErrorMessage
public string WriteErrorMessage(MessageType errorType)
{
string str = _rm.GetString("ChartError_" + errorType.ToString());
switch ( errorType )
{
case MessageType.NoStation:
return String.Format(str, _stName);
case MessageType.NoStationVariable:
return String.Format(str, _stName, _varName);
default:
break;
}
return str;
}