Commit 20d59137 by 施晓雨

up

parent 2200f7f8
...@@ -46,6 +46,7 @@ ...@@ -46,6 +46,7 @@
this.btnNotify = new System.Windows.Forms.Button(); this.btnNotify = new System.Windows.Forms.Button();
this.btnGetSubscriptions = new System.Windows.Forms.Button(); this.btnGetSubscriptions = new System.Windows.Forms.Button();
this.panel2 = new System.Windows.Forms.Panel(); this.panel2 = new System.Windows.Forms.Panel();
this.label2 = new System.Windows.Forms.Label();
this.cbxToChannel = new System.Windows.Forms.CheckBox(); this.cbxToChannel = new System.Windows.Forms.CheckBox();
this.cbxToUserId = new System.Windows.Forms.CheckBox(); this.cbxToUserId = new System.Windows.Forms.CheckBox();
this.tbxToSubscriptionId = new System.Windows.Forms.TextBox(); this.tbxToSubscriptionId = new System.Windows.Forms.TextBox();
...@@ -75,7 +76,8 @@ ...@@ -75,7 +76,8 @@
this.btnRemoveChannel = new System.Windows.Forms.Button(); this.btnRemoveChannel = new System.Windows.Forms.Button();
this.groupBox3 = new System.Windows.Forms.GroupBox(); this.groupBox3 = new System.Windows.Forms.GroupBox();
this.rtbMessage = new System.Windows.Forms.RichTextBox(); this.rtbMessage = new System.Windows.Forms.RichTextBox();
this.label2 = new System.Windows.Forms.Label(); this.tbxToSelector = new System.Windows.Forms.TextBox();
this.cbxToSelector = new System.Windows.Forms.CheckBox();
this.groupBox1.SuspendLayout(); this.groupBox1.SuspendLayout();
this.panel1.SuspendLayout(); this.panel1.SuspendLayout();
this.groupBox4.SuspendLayout(); this.groupBox4.SuspendLayout();
...@@ -222,9 +224,9 @@ ...@@ -222,9 +224,9 @@
// //
this.rtbToMessage.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.rtbToMessage.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.rtbToMessage.Dock = System.Windows.Forms.DockStyle.Fill; this.rtbToMessage.Dock = System.Windows.Forms.DockStyle.Fill;
this.rtbToMessage.Location = new System.Drawing.Point(3, 158); this.rtbToMessage.Location = new System.Drawing.Point(3, 182);
this.rtbToMessage.Name = "rtbToMessage"; this.rtbToMessage.Name = "rtbToMessage";
this.rtbToMessage.Size = new System.Drawing.Size(285, 225); this.rtbToMessage.Size = new System.Drawing.Size(285, 201);
this.rtbToMessage.TabIndex = 15; this.rtbToMessage.TabIndex = 15;
this.rtbToMessage.Text = ""; this.rtbToMessage.Text = "";
// //
...@@ -262,9 +264,11 @@ ...@@ -262,9 +264,11 @@
// //
this.panel2.Controls.Add(this.label2); this.panel2.Controls.Add(this.label2);
this.panel2.Controls.Add(this.cbxToChannel); this.panel2.Controls.Add(this.cbxToChannel);
this.panel2.Controls.Add(this.cbxToSelector);
this.panel2.Controls.Add(this.cbxToUserId); this.panel2.Controls.Add(this.cbxToUserId);
this.panel2.Controls.Add(this.tbxToSubscriptionId); this.panel2.Controls.Add(this.tbxToSubscriptionId);
this.panel2.Controls.Add(this.cbxToSubscriptionId); this.panel2.Controls.Add(this.cbxToSubscriptionId);
this.panel2.Controls.Add(this.tbxToSelector);
this.panel2.Controls.Add(this.tbxToUserId); this.panel2.Controls.Add(this.tbxToUserId);
this.panel2.Controls.Add(this.cbxToSessionId); this.panel2.Controls.Add(this.cbxToSessionId);
this.panel2.Controls.Add(this.tbxToChannel); this.panel2.Controls.Add(this.tbxToChannel);
...@@ -272,9 +276,18 @@ ...@@ -272,9 +276,18 @@
this.panel2.Dock = System.Windows.Forms.DockStyle.Top; this.panel2.Dock = System.Windows.Forms.DockStyle.Top;
this.panel2.Location = new System.Drawing.Point(3, 17); this.panel2.Location = new System.Drawing.Point(3, 17);
this.panel2.Name = "panel2"; this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(285, 141); this.panel2.Size = new System.Drawing.Size(285, 165);
this.panel2.TabIndex = 13; this.panel2.TabIndex = 13;
// //
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(3, 148);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(119, 12);
this.label2.TabIndex = 13;
this.label2.Text = "消息正文(JSON格式)";
//
// cbxToChannel // cbxToChannel
// //
this.cbxToChannel.AutoSize = true; this.cbxToChannel.AutoSize = true;
...@@ -548,14 +561,23 @@ ...@@ -548,14 +561,23 @@
this.rtbMessage.TabIndex = 4; this.rtbMessage.TabIndex = 4;
this.rtbMessage.Text = ""; this.rtbMessage.Text = "";
// //
// label2 // tbxToSelector
// //
this.label2.AutoSize = true; this.tbxToSelector.Location = new System.Drawing.Point(92, 118);
this.label2.Location = new System.Drawing.Point(8, 126); this.tbxToSelector.Name = "tbxToSelector";
this.label2.Name = "label2"; this.tbxToSelector.Size = new System.Drawing.Size(184, 21);
this.label2.Size = new System.Drawing.Size(119, 12); this.tbxToSelector.TabIndex = 2;
this.label2.TabIndex = 13; this.tbxToSelector.Text = "cmd.test";
this.label2.Text = "消息正文(JSON格式)"; //
// cbxToSelector
//
this.cbxToSelector.AutoSize = true;
this.cbxToSelector.Location = new System.Drawing.Point(11, 121);
this.cbxToSelector.Name = "cbxToSelector";
this.cbxToSelector.Size = new System.Drawing.Size(72, 16);
this.cbxToSelector.TabIndex = 12;
this.cbxToSelector.Text = "目标用户";
this.cbxToSelector.UseVisualStyleBackColor = true;
// //
// FrmMain // FrmMain
// //
...@@ -630,6 +652,8 @@ ...@@ -630,6 +652,8 @@
private System.Windows.Forms.TextBox tbxToChannel; private System.Windows.Forms.TextBox tbxToChannel;
private System.Windows.Forms.TextBox tbxToSessionId; private System.Windows.Forms.TextBox tbxToSessionId;
private System.Windows.Forms.Label label2; private System.Windows.Forms.Label label2;
private System.Windows.Forms.CheckBox cbxToSelector;
private System.Windows.Forms.TextBox tbxToSelector;
} }
} }
...@@ -37,6 +37,7 @@ namespace Test ...@@ -37,6 +37,7 @@ namespace Test
} }
//连接操作 //连接操作
btnConnect.Enabled=false; btnConnect.Enabled=false;
//实例化时,如果已经有JsonServiceClient了,可以直接new ServerEventsClient(jsonServiceClient)这样的
_client = new ServerEventsClient(tbxServiceUrl.Text); _client = new ServerEventsClient(tbxServiceUrl.Text);
_client.OnConnect = onConnected;//连接成功 _client.OnConnect = onConnected;//连接成功
_client.OnCommand = sse_OnCommand;//收到命令,指cmd.onJoin,cmd.onLeave,cmd.onUpdate,即有订阅者加入、离开频道,或更新了信息 _client.OnCommand = sse_OnCommand;//收到命令,指cmd.onJoin,cmd.onLeave,cmd.onUpdate,即有订阅者加入、离开频道,或更新了信息
...@@ -189,6 +190,7 @@ namespace Test ...@@ -189,6 +190,7 @@ namespace Test
message.SubscriptionId = cbxToSubscriptionId.Checked ? tbxToSubscriptionId.Text : null; message.SubscriptionId = cbxToSubscriptionId.Checked ? tbxToSubscriptionId.Text : null;
message.SessionId = cbxToSessionId.Checked ? tbxToSessionId.Text : null; message.SessionId = cbxToSessionId.Checked ? tbxToSessionId.Text : null;
message.UserId = cbxToUserId.Checked ? tbxToUserId.Text : null; message.UserId = cbxToUserId.Checked ? tbxToUserId.Text : null;
message.Selector = cbxToSelector.Checked ? tbxToSelector.Text : null;
message.Message = JsonObject.Parse(rtbToMessage.Text); message.Message = JsonObject.Parse(rtbToMessage.Text);
_client.SendMessageAsync(message).Success(res=> { _client.SendMessageAsync(message).Success(res=> {
rtbMessage.AppendText($"{Environment.NewLine}发送结果:{res.ToJson()}{Environment.NewLine}"); rtbMessage.AppendText($"{Environment.NewLine}发送结果:{res.ToJson()}{Environment.NewLine}");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment