本文整理汇总了C#中MessageTypes类的典型用法代码示例。如果您正苦于以下问题:C# MessageTypes类的具体用法?C# MessageTypes怎么用?C# MessageTypes使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MessageTypes类属于命名空间,在下文中一共展示了MessageTypes类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SendMessage
protected static ResponseType SendMessage(string title, string message, MessageTypes type, Exception ex, bool suppressable) {
MessageEventArgs e = new MessageEventArgs();
e.type = type;
e.exception = ex;
e.title = title;
e.message = message;
e.Suppressable = suppressable;
ICommunicationReceiver receiver = getReceiver();
if (receiver == null)
return ResponseType.Cancel;
if (receiver.ThreadBridge != null) {
receiver.ThreadBridge.Send(delegate() {
MessageEventHandler handler = receiver.sendMessage;
if (handler != null) {
handler(e);
}
});
} else {
receiver.sendMessage(e);
}
waitForResponse(e);
ProgressHandler.state = ProgressState.Normal;
return e.response;
}
示例2: Message
public Message(MessageTypes type, string body)
{
Content = body;
Type = type;
Tag = string.Empty;
ByteLength = 0;
}
示例3: MessageBox
public MessageBox(MessageTypes type, string title, string message, Exception e, bool suppressable, AViewWindow owner, IEmailSource email_source)
: this(title, message, suppressable, owner, email_source) {
switch (type) {
case MessageTypes.Error:
if (e != null) {
exceptionExpander.Visibility = System.Windows.Visibility.Visible;
exceptionText.Text = recurseExceptions(e);
if (e.GetType() == typeof(CommunicatableException)) {
submitButton.Visibility = System.Windows.Visibility.Visible;
} else {
submitButton.Visibility = System.Windows.Visibility.Visible;
}
}
closeButton.Visibility = System.Windows.Visibility.Visible;
errorIcon.Visibility = System.Windows.Visibility.Visible;
break;
case MessageTypes.Info:
okButton.Visibility = System.Windows.Visibility.Visible;
infoIcon.Visibility = System.Windows.Visibility.Visible;
break;
case MessageTypes.Warning:
okButton.Visibility = System.Windows.Visibility.Visible;
warningIcon.Visibility = System.Windows.Visibility.Visible;
break;
}
}
示例4: tl_newUnknownRequest
long tl_newUnknownRequest(MessageTypes t, string msg)
{
v("message: " + t.ToString() + " data: " + msg);
switch (t)
{
case MessageTypes.DOMREQUEST:
{
string client = string.Empty;
int depth = 0;
if (Book.ParseDOMRequest(msg, ref depth, ref client))
{
debug("depth set to: " + depth + " by client: " + client);
tickdepth = depth;
}
break;
}
case MessageTypes.DAYHIGH:
{
decimal price = 0;
highs.TryGetValue(msg, out price);
return WMUtil.pack(price);
}
case MessageTypes.DAYLOW:
{
decimal price = 0;
lows.TryGetValue(msg, out price);
return WMUtil.pack(price);
}
}
return (long)MessageTypes.UNKNOWN_MESSAGE;
}
示例5: MessageModel
public MessageModel(MessageTypes messageType, string text)
{
if (String.IsNullOrWhiteSpace(text)) throw new ArgumentException(nameof(text));
MessageType = messageType;
Text = text;
}
示例6: sendmessage
public static byte[] sendmessage(MessageTypes type, string msg)
{
byte[] data = new byte[SIZE];
if (sendmessage(type, msg, ref data))
return data;
return new byte[0];
}
示例7: SendMessage
public static ResponseType SendMessage(string title, string message, MessageTypes type, Exception ex)
{
MessageEventArgs e = new MessageEventArgs();
e.title = title;
e.message = message;
e.type = type;
if(ex!=null)
e.exception = ex;
else
e.exception = null;
ICommunicationReceiver receiver = getReceiver();
if(receiver==null)
return ResponseType.Cancel;
if(receiver.context!=null) {
receiver.context.Send(new SendOrPostCallback(delegate(object state) {
MessageEventHandler handler = receiver.sendMessage;
if(handler!=null) {
handler(e);
}
}),null);
} else {
receiver.sendMessage(e);
}
waitForResponse(e);
ProgressHandler.progress_state = ProgressState.Normal;
return e.response;
}
示例8: SupportedMessage
public SupportedMessage(ConnectorSupportedMessagesPanel parent, IMessageAdapter adapter, MessageTypes type)
{
_parent = parent;
_adapter = adapter;
Type = type;
Name = type.GetDisplayName();
}
示例9: Packet
public Packet(int source, int dest, MessageTypes type, string msg)
{
From = source;
To = dest;
Intention = type;
Data = msg;
}
示例10: displayMessage
internal void displayMessage(string message, MessageTypes type = MessageTypes.Default)
{
int oldText = outputBox.TextLength;
outputBox.AppendText("\n" + message);
if (type != MessageTypes.Default)
{
outputBox.SelectionStart = oldText;
outputBox.SelectionLength = message.Length;
}
switch (type)
{
case MessageTypes.Error:
outputBox.SelectionColor = Color.Red;
break;
case MessageTypes.Alert:
outputBox.SelectionColor = Color.Blue;
break;
case MessageTypes.Complete:
outputBox.SelectionColor = Color.Green;
break;
default:
break;
}
}
示例11: ConnectAsync
public Task<ClientConnectionResult> ConnectAsync(Target target, MessageTypes messageTypes)
{
if (target == null)
throw new ArgumentNullException ("target");
var tcs = new TaskCompletionSource<ClientConnectionResult>();
this.connected = true;
if (this.provider.IsRunning)
{
this.provider.Connect (this);
if (this.connected)
{
OnConnected (new ClientConnectionEventArgs (this));
tcs.SetResult (new ClientConnectionResult (ConnectionResult.Success, null));
}
}
else
{
OnDisconnected (new DisconnectedEventArgs (this, ConnectionResult.ConnectionFailed));
tcs.SetResult (new ClientConnectionResult (ConnectionResult.ConnectionFailed, null));
}
return tcs.Task;
}
示例12: Send
public override void Send(MessageTypes type, byte[] data, object messageBag)
{
var local = CurrentSocket();
if (local != null)
{
try
{
byte[] msg = null;
if (messageBag != null)
{
var msgTrack = new MessageTrackingObject(messageBag);
messageTracker.TryAdd(msgTrack.MessageGuid, msgTrack);
msg = Message.CreateMessageByte(data, type, msgTrack.MessageGuid);
}
else
{
msg = Message.CreateMessageByte(data, type);
}
local.BeginSend(msg, 0, msg.Length, SocketFlags.None, new AsyncCallback(this.EndSend), local);
}
catch (SocketException)
{
Close();
}
}
}
示例13: Log
/// <summary>
/// Add the given message to the log.
/// </summary>
private void Log(MessageTypes type, string member, IMetadataScope scope, string msg)
{
if (IsDisposed) return;
if (InvokeRequired)
{
Invoke(new Action<MessageTypes, string, IMetadataScope, string>(Log), type, member, scope, msg);
}
else
{
if ((type >= MessageTypes.MissingFirst) && (type <= MessageTypes.MissingLast))
{
MemberNode node;
if (!nodes.TryGetValue(member, out node))
{
node = new MemberNode(member, scope, type);
node.ImageIndex = (int) type;
nodes.Add(member, node);
tvList.Nodes.Add(node);
}
node.Messages.Add(msg);
if (node == tvList.SelectedNode)
{
tvUsedIn.Nodes.Add(new TreeNode(msg));
}
}
else
{
tvLog.Nodes.Add(new TreeNode(msg) { ImageIndex = (int) type });
}
miCopy.Enabled = (tvList.Nodes.Count > 0);
}
}
示例14: Telegram
///<summary>
///constructor
///</summary>
///<param name="dispatchTime"></param>
///<param name="sender"></param>
///<param name="receiver"></param>
///<param name="msg"></param>
public Telegram(
float dispatchTime,
uint sender,
uint receiver,
MessageTypes msg)
: this(dispatchTime, sender, receiver, msg, null)
{
}
示例15: s_newUnknownRequest
long s_newUnknownRequest(MessageTypes t, string msg)
{
if (t == MessageTypes.LOOPBACKSERVER)
{
return SPECIAL;
}
return 0;
}