Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
Kivii.Client.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.Test
Commits
020f4060
Commit
020f4060
authored
Dec 30, 2020
by
施晓雨
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更新代码
parent
76fe86c3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
21 additions
and
8 deletions
+21
-8
Kivii.Client.Test.sln
Src/Kivii.Client.Test.sln
+6
-0
FrmMain.Designer.cs
Src/Kivii.Client.Test/Forms/FrmMain.Designer.cs
+0
-0
FrmMain.cs
Src/Kivii.Client.Test/Forms/FrmMain.cs
+8
-4
Kivii.Client.Test.V4.5.csproj
Src/Kivii.Client.Test/Kivii.Client.Test.V4.5.csproj
+7
-4
No files found.
Src/Kivii.Client.Test.sln
View file @
020f4060
...
...
@@ -5,6 +5,8 @@ VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Kivii.Client.Test.V4.5", "Kivii.Client.Test\Kivii.Client.Test.V4.5.csproj", "{0327117D-548C-4EB4-AD86-13F914BD4D1F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Kivii.Common.V4.5", "..\..\..\K5\Platform-V5.4\Kivii.Common\Src\Kivii.Common.V4.5.csproj", "{587A47FE-0AE8-4649-9364-686E8F6C044B}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
...
...
@@ -15,6 +17,10 @@ Global
{0327117D-548C-4EB4-AD86-13F914BD4D1F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0327117D-548C-4EB4-AD86-13F914BD4D1F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0327117D-548C-4EB4-AD86-13F914BD4D1F}.Release|Any CPU.Build.0 = Release|Any CPU
{587A47FE-0AE8-4649-9364-686E8F6C044B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{587A47FE-0AE8-4649-9364-686E8F6C044B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{587A47FE-0AE8-4649-9364-686E8F6C044B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{587A47FE-0AE8-4649-9364-686E8F6C044B}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
...
...
Src/Kivii.Client.Test/Forms/FrmMain.Designer.cs
View file @
020f4060
This diff is collapsed.
Click to expand it.
Src/Kivii.Client.Test/Forms/FrmMain.cs
View file @
020f4060
...
...
@@ -28,13 +28,14 @@ namespace Kivii.Client.Test.Forms
//设置请求超时
_client
.
Timeout
=
TimeSpan
.
FromSeconds
(
20
);
//定义一个身份认证数据包
var
loginRequest
=
new
Authenticate
{
UserName
=
tbxUserName
.
Text
,
Password
=
tbxPassword
.
Text
,
provider
=
"Kivii"
};
var
loginRequest
=
new
Authenticate
{
UserName
=
tbxUserName
.
Text
,
Password
=
tbxPassword
.
Text
,
provider
=
"Kivii"
,
UseTokenCookie
=
cbxUseTokenCookie
.
Checked
};
//通过异步的方式POST数据到服务器
var
tasks
=
_client
.
PostAsync
(
loginRequest
);
//当成功获取到数据后,异步执行以下的代码
tasks
.
Success
(
resp
=>
{
btnLogin
.
Enabled
=
resp
.
DisplayName
.
IsNullOrEmpty
();
btnLogout
.
Enabled
=
!
btnLogin
.
Enabled
;
tbxToken
.
Text
=
resp
.
BearerToken
;
tbxDisplayName
.
Text
=
resp
.
DisplayName
;
});
//当执行错误后,执行以下的代码
...
...
@@ -56,6 +57,7 @@ namespace Kivii.Client.Test.Forms
tasks
.
Success
(
resp
=>
{
btnLogin
.
Enabled
=
resp
!=
null
;
btnLogout
.
Enabled
=
!
btnLogin
.
Enabled
;
tbxToken
.
Text
=
""
;
tbxDisplayName
.
Text
=
""
;
_client
.
Dispose
();
_client
=
null
;
...
...
@@ -68,17 +70,19 @@ namespace Kivii.Client.Test.Forms
private
void
btnQueryMember_Click
(
object
sender
,
EventArgs
e
)
{
if
(
_client
==
null
)
return
;
var
newClient
=
new
JsonServiceClient
(
tbxServiceUrl
.
Text
);
newClient
.
BearerToken
=
tbxToken
.
Text
;
//if (_client == null) return;
dgvResults
.
DataSource
=
null
;
var
queryMember
=
new
MemberQuery
();
queryMember
.
FullNameContains
=
tbxFullNameContains
.
Text
;
queryMember
.
FirstNameIn
=
tbxFirstNameIn
.
Text
;
var
tasks
=
_c
lient
.
PostAsync
(
queryMember
);
var
tasks
=
newC
lient
.
PostAsync
(
queryMember
);
tasks
.
Success
(
resp
=>
{
dgvResults
.
DataSource
=
resp
.
Results
;
});
tasks
.
Error
(
ex
=>
{
var
x
=
""
;
MessageBox
.
Show
(
ex
.
Message
,
"Query Error"
)
;
});
}
...
...
Src/Kivii.Client.Test/Kivii.Client.Test.V4.5.csproj
View file @
020f4060
...
...
@@ -33,10 +33,6 @@
<WarningLevel>
4
</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference
Include=
"Kivii.Common.V4.5, Version=5.4.2019.3160, Culture=neutral, processorArchitecture=MSIL"
>
<HintPath>
..\packages\Kivii.Common.5.4.2019.3160\lib\net45\Kivii.Common.V4.5.dll
</HintPath>
<Private>
True
</Private>
</Reference>
<Reference
Include=
"Kivii.Linq.Sqlite.V4.5, Version=5.4.2019.3150, Culture=neutral, processorArchitecture=MSIL"
>
<HintPath>
..\packages\Kivii.Linq.Sqlite.5.4.2019.3150\lib\net45\Kivii.Linq.Sqlite.V4.5.dll
</HintPath>
<Private>
True
</Private>
...
...
@@ -93,5 +89,11 @@
<ItemGroup>
<None
Include=
"App.config"
/>
</ItemGroup>
<ItemGroup>
<ProjectReference
Include=
"..\..\..\..\K5\Platform-V5.4\Kivii.Common\Src\Kivii.Common.V4.5.csproj"
>
<Project>
{587a47fe-0ae8-4649-9364-686e8f6c044b}
</Project>
<Name>
Kivii.Common.V4.5
</Name>
</ProjectReference>
</ItemGroup>
<Import
Project=
"$(MSBuildToolsPath)\Microsoft.CSharp.targets"
/>
</Project>
\ No newline at end of file
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