Commit 692a465b by 施晓雨

1

parent d17a6ab0
......@@ -37,11 +37,6 @@
this.tbxPassword = new System.Windows.Forms.TextBox();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.panel1 = new System.Windows.Forms.Panel();
this.btnGetSubscriptions = new System.Windows.Forms.Button();
this.label2 = new System.Windows.Forms.Label();
this.btnSendMessage = new System.Windows.Forms.Button();
this.groupBox3 = new System.Windows.Forms.GroupBox();
this.rtbMessage = new System.Windows.Forms.RichTextBox();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.btnAddChannel = new System.Windows.Forms.Button();
this.label7 = new System.Windows.Forms.Label();
......@@ -57,10 +52,15 @@
this.tbxChannels = new System.Windows.Forms.TextBox();
this.tbxUpdateChannel = new System.Windows.Forms.TextBox();
this.btnRemoveChannel = new System.Windows.Forms.Button();
this.btnGetSubscriptions = new System.Windows.Forms.Button();
this.label2 = new System.Windows.Forms.Label();
this.btnClearDebugMessage = new System.Windows.Forms.Button();
this.groupBox3 = new System.Windows.Forms.GroupBox();
this.rtbMessage = new System.Windows.Forms.RichTextBox();
this.groupBox1.SuspendLayout();
this.panel1.SuspendLayout();
this.groupBox3.SuspendLayout();
this.groupBox2.SuspendLayout();
this.groupBox3.SuspendLayout();
this.SuspendLayout();
//
// btnConnect
......@@ -147,7 +147,7 @@
this.panel1.Controls.Add(this.groupBox2);
this.panel1.Controls.Add(this.btnGetSubscriptions);
this.panel1.Controls.Add(this.label2);
this.panel1.Controls.Add(this.btnSendMessage);
this.panel1.Controls.Add(this.btnClearDebugMessage);
this.panel1.Controls.Add(this.groupBox1);
this.panel1.Dock = System.Windows.Forms.DockStyle.Left;
this.panel1.Location = new System.Drawing.Point(0, 0);
......@@ -155,55 +155,6 @@
this.panel1.Size = new System.Drawing.Size(297, 680);
this.panel1.TabIndex = 8;
//
// btnGetSubscriptions
//
this.btnGetSubscriptions.Location = new System.Drawing.Point(14, 233);
this.btnGetSubscriptions.Name = "btnGetSubscriptions";
this.btnGetSubscriptions.Size = new System.Drawing.Size(268, 23);
this.btnGetSubscriptions.TabIndex = 9;
this.btnGetSubscriptions.Text = "获取当前频道的所有订阅人";
this.btnGetSubscriptions.UseVisualStyleBackColor = true;
this.btnGetSubscriptions.Click += new System.EventHandler(this.btnGetSubscriptions_Click);
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(48, 442);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(53, 12);
this.label2.TabIndex = 8;
this.label2.Text = "发送消息";
//
// btnSendMessage
//
this.btnSendMessage.Location = new System.Drawing.Point(112, 515);
this.btnSendMessage.Name = "btnSendMessage";
this.btnSendMessage.Size = new System.Drawing.Size(41, 23);
this.btnSendMessage.TabIndex = 7;
this.btnSendMessage.Text = "发送";
this.btnSendMessage.UseVisualStyleBackColor = true;
//
// groupBox3
//
this.groupBox3.Controls.Add(this.rtbMessage);
this.groupBox3.Dock = System.Windows.Forms.DockStyle.Fill;
this.groupBox3.Location = new System.Drawing.Point(297, 0);
this.groupBox3.Name = "groupBox3";
this.groupBox3.Size = new System.Drawing.Size(705, 680);
this.groupBox3.TabIndex = 9;
this.groupBox3.TabStop = false;
this.groupBox3.Text = "调试信息";
//
// rtbMessage
//
this.rtbMessage.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.rtbMessage.Dock = System.Windows.Forms.DockStyle.Fill;
this.rtbMessage.Location = new System.Drawing.Point(3, 17);
this.rtbMessage.Name = "rtbMessage";
this.rtbMessage.Size = new System.Drawing.Size(699, 660);
this.rtbMessage.TabIndex = 4;
this.rtbMessage.Text = "";
//
// groupBox2
//
this.groupBox2.Controls.Add(this.btnAddChannel);
......@@ -350,6 +301,56 @@
this.btnRemoveChannel.UseVisualStyleBackColor = true;
this.btnRemoveChannel.Click += new System.EventHandler(this.btnRemoveChannel_Click);
//
// btnGetSubscriptions
//
this.btnGetSubscriptions.Location = new System.Drawing.Point(14, 233);
this.btnGetSubscriptions.Name = "btnGetSubscriptions";
this.btnGetSubscriptions.Size = new System.Drawing.Size(139, 23);
this.btnGetSubscriptions.TabIndex = 9;
this.btnGetSubscriptions.Text = "获取频道的所有订阅人";
this.btnGetSubscriptions.UseVisualStyleBackColor = true;
this.btnGetSubscriptions.Click += new System.EventHandler(this.btnGetSubscriptions_Click);
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(48, 442);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(53, 12);
this.label2.TabIndex = 8;
this.label2.Text = "发送消息";
//
// btnClearDebugMessage
//
this.btnClearDebugMessage.Location = new System.Drawing.Point(164, 233);
this.btnClearDebugMessage.Name = "btnClearDebugMessage";
this.btnClearDebugMessage.Size = new System.Drawing.Size(118, 23);
this.btnClearDebugMessage.TabIndex = 7;
this.btnClearDebugMessage.Text = "清除调试信息";
this.btnClearDebugMessage.UseVisualStyleBackColor = true;
this.btnClearDebugMessage.Click += new System.EventHandler(this.btnClearDebugMessage_Click);
//
// groupBox3
//
this.groupBox3.Controls.Add(this.rtbMessage);
this.groupBox3.Dock = System.Windows.Forms.DockStyle.Fill;
this.groupBox3.Location = new System.Drawing.Point(297, 0);
this.groupBox3.Name = "groupBox3";
this.groupBox3.Size = new System.Drawing.Size(705, 680);
this.groupBox3.TabIndex = 9;
this.groupBox3.TabStop = false;
this.groupBox3.Text = "调试信息";
//
// rtbMessage
//
this.rtbMessage.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.rtbMessage.Dock = System.Windows.Forms.DockStyle.Fill;
this.rtbMessage.Location = new System.Drawing.Point(3, 17);
this.rtbMessage.Name = "rtbMessage";
this.rtbMessage.Size = new System.Drawing.Size(699, 660);
this.rtbMessage.TabIndex = 4;
this.rtbMessage.Text = "";
//
// FrmMain
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
......@@ -363,9 +364,9 @@
this.groupBox1.PerformLayout();
this.panel1.ResumeLayout(false);
this.panel1.PerformLayout();
this.groupBox3.ResumeLayout(false);
this.groupBox2.ResumeLayout(false);
this.groupBox2.PerformLayout();
this.groupBox3.ResumeLayout(false);
this.ResumeLayout(false);
}
......@@ -383,7 +384,7 @@
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.Button btnGetSubscriptions;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Button btnSendMessage;
private System.Windows.Forms.Button btnClearDebugMessage;
private System.Windows.Forms.GroupBox groupBox3;
private System.Windows.Forms.RichTextBox rtbMessage;
private System.Windows.Forms.GroupBox groupBox2;
......
......@@ -31,7 +31,7 @@ namespace Test
}
//连接操作
btnConnect.Enabled=false;
_client = new ServerEventsClient(tbxServiceUrl.Text,"home");
_client = new ServerEventsClient(tbxServiceUrl.Text);
var auth = new Authenticate { UserName =tbxUserName.Text, Password = tbxPassword.Text, provider = "kivii" };
var task=_client.ServiceClient.PostAsync(auth);
task.Success(()=>{
......@@ -48,6 +48,7 @@ namespace Test
_client.Dispose();
_client = null;
rtbMessage.AppendText($"{DateTime.Now.ToString("HH:mm:ss")}:Exception {ex.Message}{Environment.NewLine}{Environment.NewLine}");
rtbMessage.ScrollToCaret();
}, true);
}
......@@ -69,6 +70,7 @@ namespace Test
tbxConnectedTime.BackColor = tbxConnectedTime.BackColor != Color.MistyRose ? Color.MistyRose : Color.YellowGreen;
rtbMessage.AppendText($"{DateTime.Now.ToString("HH:mm:ss")}:onConnect {connection.Json}{Environment.NewLine}{Environment.NewLine}");
rtbMessage.ScrollToCaret();
}
//得到心跳包
private void onHeartbeat()
......@@ -90,6 +92,7 @@ namespace Test
return;
}
rtbMessage.AppendText($"{DateTime.Now.ToString("HH:mm:ss")}:onException {ex.Message}{Environment.NewLine}{Environment.NewLine}");
rtbMessage.ScrollToCaret();
}
//得到消息
private void onMessage(ServerEventMessage message)
......@@ -100,6 +103,7 @@ namespace Test
return;
}
rtbMessage.AppendText($"{DateTime.Now.ToString("HH:mm:ss")}:onMessage {message.Json}{Environment.NewLine}{Environment.NewLine}");
rtbMessage.ScrollToCaret();
}
//得到命令
private void onCommand(ServerEventMessage command)
......@@ -114,6 +118,7 @@ namespace Test
tbxChannels.Text = (command as ServerEventUpdate).Channels.Join(",");
}
rtbMessage.AppendText($"{DateTime.Now.ToString("HH:mm:ss")}:{command.GetType().Name} {command.Json}{Environment.NewLine}{Environment.NewLine}");
rtbMessage.ScrollToCaret();
}
......@@ -138,6 +143,7 @@ namespace Test
task.Error((ex)=> {
btnRemoveChannel.Enabled = true;
rtbMessage.AppendText($"{DateTime.Now.ToString("HH:mm:ss")}:onException {ex.Message}{Environment.NewLine}{Environment.NewLine}");
rtbMessage.ScrollToCaret();
});
}
......@@ -152,6 +158,7 @@ namespace Test
task.Error((ex) => {
btnAddChannel.Enabled = true;
rtbMessage.AppendText($"{DateTime.Now.ToString("HH:mm:ss")}:onException {ex.Message}{Environment.NewLine}{Environment.NewLine}");
rtbMessage.ScrollToCaret();
});
}
......@@ -165,12 +172,19 @@ namespace Test
foreach (var item in task.Result)
{
rtbMessage.AppendText($"DisplayName:{item.DisplayName},UserId:{item.UserId},SubscriptionId:{item.SubscriptionId},Channels:{item.Channels.Join()}{Environment.NewLine}");
rtbMessage.ScrollToCaret();
}
},true);
task.Error((ex) => {
btnGetSubscriptions.Enabled = true;
rtbMessage.AppendText($"{DateTime.Now.ToString("HH:mm:ss")}:onException {ex.Message}{Environment.NewLine}{Environment.NewLine}");
rtbMessage.ScrollToCaret();
},true);
}
private void btnClearDebugMessage_Click(object sender, EventArgs e)
{
rtbMessage.Clear();
}
}
}
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