Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
Kivii.Client.ServerEvents.Test
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
示例代码
Kivii.Client.ServerEvents.Test
Commits
20d59137
Commit
20d59137
authored
Jan 14, 2024
by
施晓雨
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
up
parent
2200f7f8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
11 deletions
+37
-11
FrmMain.Designer.cs
FrmMain.Designer.cs
+35
-11
FrmMain.cs
FrmMain.cs
+2
-0
No files found.
FrmMain.Designer.cs
View file @
20d59137
...
...
@@ -46,6 +46,7 @@
this
.
btnNotify
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
btnGetSubscriptions
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
panel2
=
new
System
.
Windows
.
Forms
.
Panel
();
this
.
label2
=
new
System
.
Windows
.
Forms
.
Label
();
this
.
cbxToChannel
=
new
System
.
Windows
.
Forms
.
CheckBox
();
this
.
cbxToUserId
=
new
System
.
Windows
.
Forms
.
CheckBox
();
this
.
tbxToSubscriptionId
=
new
System
.
Windows
.
Forms
.
TextBox
();
...
...
@@ -75,7 +76,8 @@
this
.
btnRemoveChannel
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
groupBox3
=
new
System
.
Windows
.
Forms
.
GroupBox
();
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
.
panel1
.
SuspendLayout
();
this
.
groupBox4
.
SuspendLayout
();
...
...
@@ -222,9 +224,9 @@
//
this
.
rtbToMessage
.
BorderStyle
=
System
.
Windows
.
Forms
.
BorderStyle
.
FixedSingle
;
this
.
rtbToMessage
.
Dock
=
System
.
Windows
.
Forms
.
DockStyle
.
Fill
;
this
.
rtbToMessage
.
Location
=
new
System
.
Drawing
.
Point
(
3
,
1
58
);
this
.
rtbToMessage
.
Location
=
new
System
.
Drawing
.
Point
(
3
,
1
82
);
this
.
rtbToMessage
.
Name
=
"rtbToMessage"
;
this
.
rtbToMessage
.
Size
=
new
System
.
Drawing
.
Size
(
285
,
2
25
);
this
.
rtbToMessage
.
Size
=
new
System
.
Drawing
.
Size
(
285
,
2
01
);
this
.
rtbToMessage
.
TabIndex
=
15
;
this
.
rtbToMessage
.
Text
=
""
;
//
...
...
@@ -262,9 +264,11 @@
//
this
.
panel2
.
Controls
.
Add
(
this
.
label2
);
this
.
panel2
.
Controls
.
Add
(
this
.
cbxToChannel
);
this
.
panel2
.
Controls
.
Add
(
this
.
cbxToSelector
);
this
.
panel2
.
Controls
.
Add
(
this
.
cbxToUserId
);
this
.
panel2
.
Controls
.
Add
(
this
.
tbxToSubscriptionId
);
this
.
panel2
.
Controls
.
Add
(
this
.
cbxToSubscriptionId
);
this
.
panel2
.
Controls
.
Add
(
this
.
tbxToSelector
);
this
.
panel2
.
Controls
.
Add
(
this
.
tbxToUserId
);
this
.
panel2
.
Controls
.
Add
(
this
.
cbxToSessionId
);
this
.
panel2
.
Controls
.
Add
(
this
.
tbxToChannel
);
...
...
@@ -272,9 +276,18 @@
this
.
panel2
.
Dock
=
System
.
Windows
.
Forms
.
DockStyle
.
Top
;
this
.
panel2
.
Location
=
new
System
.
Drawing
.
Point
(
3
,
17
);
this
.
panel2
.
Name
=
"panel2"
;
this
.
panel2
.
Size
=
new
System
.
Drawing
.
Size
(
285
,
1
41
);
this
.
panel2
.
Size
=
new
System
.
Drawing
.
Size
(
285
,
1
65
);
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
//
this
.
cbxToChannel
.
AutoSize
=
true
;
...
...
@@ -548,14 +561,23 @@
this
.
rtbMessage
.
TabIndex
=
4
;
this
.
rtbMessage
.
Text
=
""
;
//
//
label2
//
tbxToSelector
//
this
.
label2
.
AutoSize
=
true
;
this
.
label2
.
Location
=
new
System
.
Drawing
.
Point
(
8
,
126
);
this
.
label2
.
Name
=
"label2"
;
this
.
label2
.
Size
=
new
System
.
Drawing
.
Size
(
119
,
12
);
this
.
label2
.
TabIndex
=
13
;
this
.
label2
.
Text
=
"消息正文(JSON格式)"
;
this
.
tbxToSelector
.
Location
=
new
System
.
Drawing
.
Point
(
92
,
118
);
this
.
tbxToSelector
.
Name
=
"tbxToSelector"
;
this
.
tbxToSelector
.
Size
=
new
System
.
Drawing
.
Size
(
184
,
21
);
this
.
tbxToSelector
.
TabIndex
=
2
;
this
.
tbxToSelector
.
Text
=
"cmd.test"
;
//
// 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
//
...
...
@@ -630,6 +652,8 @@
private
System
.
Windows
.
Forms
.
TextBox
tbxToChannel
;
private
System
.
Windows
.
Forms
.
TextBox
tbxToSessionId
;
private
System
.
Windows
.
Forms
.
Label
label2
;
private
System
.
Windows
.
Forms
.
CheckBox
cbxToSelector
;
private
System
.
Windows
.
Forms
.
TextBox
tbxToSelector
;
}
}
FrmMain.cs
View file @
20d59137
...
...
@@ -37,6 +37,7 @@ namespace Test
}
//连接操作
btnConnect
.
Enabled
=
false
;
//实例化时,如果已经有JsonServiceClient了,可以直接new ServerEventsClient(jsonServiceClient)这样的
_client
=
new
ServerEventsClient
(
tbxServiceUrl
.
Text
);
_client
.
OnConnect
=
onConnected
;
//连接成功
_client
.
OnCommand
=
sse_OnCommand
;
//收到命令,指cmd.onJoin,cmd.onLeave,cmd.onUpdate,即有订阅者加入、离开频道,或更新了信息
...
...
@@ -189,6 +190,7 @@ namespace Test
message
.
SubscriptionId
=
cbxToSubscriptionId
.
Checked
?
tbxToSubscriptionId
.
Text
:
null
;
message
.
SessionId
=
cbxToSessionId
.
Checked
?
tbxToSessionId
.
Text
:
null
;
message
.
UserId
=
cbxToUserId
.
Checked
?
tbxToUserId
.
Text
:
null
;
message
.
Selector
=
cbxToSelector
.
Checked
?
tbxToSelector
.
Text
:
null
;
message
.
Message
=
JsonObject
.
Parse
(
rtbToMessage
.
Text
);
_client
.
SendMessageAsync
(
message
).
Success
(
res
=>
{
rtbMessage
.
AppendText
(
$"
{
Environment
.
NewLine
}
发送结果:
{
res
.
ToJson
()}{
Environment
.
NewLine
}
"
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment