Commit 020f4060 by 施晓雨

更新代码

parent 76fe86c3
......@@ -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
......
......@@ -50,9 +50,12 @@
this.groupBox4 = new System.Windows.Forms.GroupBox();
this.dgvResults = new System.Windows.Forms.DataGridView();
this.groupBox3 = new System.Windows.Forms.GroupBox();
this.btnSave = new System.Windows.Forms.Button();
this.btnLoadData = new System.Windows.Forms.Button();
this.btnClearData = new System.Windows.Forms.Button();
this.btnLoadData = new System.Windows.Forms.Button();
this.btnSave = new System.Windows.Forms.Button();
this.cbxUseTokenCookie = new System.Windows.Forms.CheckBox();
this.label7 = new System.Windows.Forms.Label();
this.tbxToken = new System.Windows.Forms.TextBox();
this.panel1.SuspendLayout();
this.groupBox2.SuspendLayout();
this.groupBox1.SuspendLayout();
......@@ -65,57 +68,58 @@
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(29, 34);
this.label1.Location = new System.Drawing.Point(12, 27);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(71, 12);
this.label1.Size = new System.Drawing.Size(53, 12);
this.label1.TabIndex = 0;
this.label1.Text = "ServiceUrl:";
this.label1.Text = "服务路径";
//
// tbxServiceUrl
//
this.tbxServiceUrl.Location = new System.Drawing.Point(106, 31);
this.tbxServiceUrl.Location = new System.Drawing.Point(71, 24);
this.tbxServiceUrl.Name = "tbxServiceUrl";
this.tbxServiceUrl.Size = new System.Drawing.Size(183, 21);
this.tbxServiceUrl.Size = new System.Drawing.Size(143, 21);
this.tbxServiceUrl.TabIndex = 0;
this.tbxServiceUrl.Text = "http://www.kivii.org/";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(29, 62);
this.label2.Location = new System.Drawing.Point(12, 54);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(59, 12);
this.label2.Size = new System.Drawing.Size(29, 12);
this.label2.TabIndex = 0;
this.label2.Text = "UserName:";
this.label2.Text = "用户";
//
// tbxUserName
//
this.tbxUserName.Location = new System.Drawing.Point(106, 59);
this.tbxUserName.Location = new System.Drawing.Point(47, 51);
this.tbxUserName.Name = "tbxUserName";
this.tbxUserName.Size = new System.Drawing.Size(183, 21);
this.tbxUserName.Size = new System.Drawing.Size(116, 21);
this.tbxUserName.TabIndex = 1;
this.tbxUserName.Text = "administrator";
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(29, 92);
this.label3.Location = new System.Drawing.Point(175, 54);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(59, 12);
this.label3.Size = new System.Drawing.Size(29, 12);
this.label3.TabIndex = 0;
this.label3.Text = "Password:";
this.label3.Text = "密码";
//
// tbxPassword
//
this.tbxPassword.Location = new System.Drawing.Point(106, 89);
this.tbxPassword.Location = new System.Drawing.Point(210, 51);
this.tbxPassword.Name = "tbxPassword";
this.tbxPassword.PasswordChar = '*';
this.tbxPassword.Size = new System.Drawing.Size(183, 21);
this.tbxPassword.Size = new System.Drawing.Size(92, 21);
this.tbxPassword.TabIndex = 2;
this.tbxPassword.Text = "www.kivii.com";
//
// btnLogin
//
this.btnLogin.Location = new System.Drawing.Point(31, 157);
this.btnLogin.Location = new System.Drawing.Point(14, 129);
this.btnLogin.Name = "btnLogin";
this.btnLogin.Size = new System.Drawing.Size(75, 23);
this.btnLogin.TabIndex = 4;
......@@ -126,7 +130,7 @@
// btnLogout
//
this.btnLogout.Enabled = false;
this.btnLogout.Location = new System.Drawing.Point(214, 157);
this.btnLogout.Location = new System.Drawing.Point(227, 129);
this.btnLogout.Name = "btnLogout";
this.btnLogout.Size = new System.Drawing.Size(75, 23);
this.btnLogout.TabIndex = 5;
......@@ -137,18 +141,18 @@
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(29, 122);
this.label4.Location = new System.Drawing.Point(12, 78);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(77, 12);
this.label4.Size = new System.Drawing.Size(29, 12);
this.label4.TabIndex = 0;
this.label4.Text = "DisplayName:";
this.label4.Text = "姓名";
//
// tbxDisplayName
//
this.tbxDisplayName.Enabled = false;
this.tbxDisplayName.Location = new System.Drawing.Point(106, 119);
this.tbxDisplayName.Location = new System.Drawing.Point(47, 75);
this.tbxDisplayName.Name = "tbxDisplayName";
this.tbxDisplayName.Size = new System.Drawing.Size(183, 21);
this.tbxDisplayName.Size = new System.Drawing.Size(255, 21);
this.tbxDisplayName.TabIndex = 3;
//
// panel1
......@@ -169,16 +173,16 @@
this.groupBox2.Controls.Add(this.tbxFullNameContains);
this.groupBox2.Controls.Add(this.label5);
this.groupBox2.Dock = System.Windows.Forms.DockStyle.Fill;
this.groupBox2.Location = new System.Drawing.Point(0, 205);
this.groupBox2.Location = new System.Drawing.Point(0, 161);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(319, 245);
this.groupBox2.Size = new System.Drawing.Size(319, 289);
this.groupBox2.TabIndex = 1;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "查询人员示例";
//
// tbxFirstNameIn
//
this.tbxFirstNameIn.Location = new System.Drawing.Point(106, 73);
this.tbxFirstNameIn.Location = new System.Drawing.Point(65, 54);
this.tbxFirstNameIn.Name = "tbxFirstNameIn";
this.tbxFirstNameIn.Size = new System.Drawing.Size(183, 21);
this.tbxFirstNameIn.TabIndex = 7;
......@@ -186,25 +190,25 @@
// label6
//
this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(12, 78);
this.label6.Location = new System.Drawing.Point(6, 57);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(71, 12);
this.label6.Size = new System.Drawing.Size(41, 12);
this.label6.TabIndex = 4;
this.label6.Text = "FirstNameIn";
this.label6.Text = "姓包含";
//
// btnQueryMember
//
this.btnQueryMember.Location = new System.Drawing.Point(31, 210);
this.btnQueryMember.Location = new System.Drawing.Point(254, 26);
this.btnQueryMember.Name = "btnQueryMember";
this.btnQueryMember.Size = new System.Drawing.Size(75, 23);
this.btnQueryMember.Size = new System.Drawing.Size(48, 49);
this.btnQueryMember.TabIndex = 8;
this.btnQueryMember.Text = "Query";
this.btnQueryMember.Text = "查询";
this.btnQueryMember.UseVisualStyleBackColor = true;
this.btnQueryMember.Click += new System.EventHandler(this.btnQueryMember_Click);
//
// tbxFullNameContains
//
this.tbxFullNameContains.Location = new System.Drawing.Point(106, 36);
this.tbxFullNameContains.Location = new System.Drawing.Point(65, 26);
this.tbxFullNameContains.Name = "tbxFullNameContains";
this.tbxFullNameContains.Size = new System.Drawing.Size(183, 21);
this.tbxFullNameContains.TabIndex = 6;
......@@ -212,20 +216,23 @@
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(7, 41);
this.label5.Location = new System.Drawing.Point(6, 29);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(101, 12);
this.label5.Size = new System.Drawing.Size(53, 12);
this.label5.TabIndex = 0;
this.label5.Text = "FullNameContains";
this.label5.Text = "姓名包含";
//
// groupBox1
//
this.groupBox1.Controls.Add(this.tbxToken);
this.groupBox1.Controls.Add(this.cbxUseTokenCookie);
this.groupBox1.Controls.Add(this.label1);
this.groupBox1.Controls.Add(this.btnLogout);
this.groupBox1.Controls.Add(this.label2);
this.groupBox1.Controls.Add(this.btnLogin);
this.groupBox1.Controls.Add(this.label3);
this.groupBox1.Controls.Add(this.tbxDisplayName);
this.groupBox1.Controls.Add(this.label7);
this.groupBox1.Controls.Add(this.label4);
this.groupBox1.Controls.Add(this.tbxPassword);
this.groupBox1.Controls.Add(this.tbxServiceUrl);
......@@ -233,7 +240,7 @@
this.groupBox1.Dock = System.Windows.Forms.DockStyle.Top;
this.groupBox1.Location = new System.Drawing.Point(0, 0);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(319, 205);
this.groupBox1.Size = new System.Drawing.Size(319, 161);
this.groupBox1.TabIndex = 0;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "配置及登陆信息";
......@@ -282,15 +289,15 @@
this.groupBox3.TabStop = false;
this.groupBox3.Text = "操作";
//
// btnSave
// btnClearData
//
this.btnSave.Location = new System.Drawing.Point(394, 34);
this.btnSave.Name = "btnSave";
this.btnSave.Size = new System.Drawing.Size(75, 23);
this.btnSave.TabIndex = 0;
this.btnSave.Text = "保存结果";
this.btnSave.UseVisualStyleBackColor = true;
this.btnSave.Click += new System.EventHandler(this.btnSave_Click);
this.btnClearData.Location = new System.Drawing.Point(151, 34);
this.btnClearData.Name = "btnClearData";
this.btnClearData.Size = new System.Drawing.Size(110, 23);
this.btnClearData.TabIndex = 2;
this.btnClearData.Text = "清空本地数据";
this.btnClearData.UseVisualStyleBackColor = true;
this.btnClearData.Click += new System.EventHandler(this.btnClearData_Click);
//
// btnLoadData
//
......@@ -302,15 +309,41 @@
this.btnLoadData.UseVisualStyleBackColor = true;
this.btnLoadData.Click += new System.EventHandler(this.btnLoadData_Click);
//
// btnClearData
// btnSave
//
this.btnClearData.Location = new System.Drawing.Point(151, 34);
this.btnClearData.Name = "btnClearData";
this.btnClearData.Size = new System.Drawing.Size(110, 23);
this.btnClearData.TabIndex = 2;
this.btnClearData.Text = "清空本地数据";
this.btnClearData.UseVisualStyleBackColor = true;
this.btnClearData.Click += new System.EventHandler(this.btnClearData_Click);
this.btnSave.Location = new System.Drawing.Point(394, 34);
this.btnSave.Name = "btnSave";
this.btnSave.Size = new System.Drawing.Size(75, 23);
this.btnSave.TabIndex = 0;
this.btnSave.Text = "保存结果";
this.btnSave.UseVisualStyleBackColor = true;
this.btnSave.Click += new System.EventHandler(this.btnSave_Click);
//
// cbxUseTokenCookie
//
this.cbxUseTokenCookie.AutoSize = true;
this.cbxUseTokenCookie.Location = new System.Drawing.Point(224, 27);
this.cbxUseTokenCookie.Name = "cbxUseTokenCookie";
this.cbxUseTokenCookie.Size = new System.Drawing.Size(78, 16);
this.cbxUseTokenCookie.TabIndex = 6;
this.cbxUseTokenCookie.Text = "获取Token";
this.cbxUseTokenCookie.UseVisualStyleBackColor = true;
//
// label7
//
this.label7.AutoSize = true;
this.label7.Location = new System.Drawing.Point(12, 105);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(35, 12);
this.label7.TabIndex = 0;
this.label7.Text = "TOKEN";
//
// tbxToken
//
this.tbxToken.Location = new System.Drawing.Point(47, 102);
this.tbxToken.Name = "tbxToken";
this.tbxToken.Size = new System.Drawing.Size(255, 21);
this.tbxToken.TabIndex = 7;
//
// FrmMain
//
......@@ -361,5 +394,8 @@
private System.Windows.Forms.Button btnSave;
private System.Windows.Forms.Button btnLoadData;
private System.Windows.Forms.Button btnClearData;
private System.Windows.Forms.CheckBox cbxUseTokenCookie;
private System.Windows.Forms.TextBox tbxToken;
private System.Windows.Forms.Label label7;
}
}
\ No newline at end of file
......@@ -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 = _client.PostAsync(queryMember);
var tasks = newClient.PostAsync(queryMember);
tasks.Success(resp => {
dgvResults.DataSource = resp.Results;
});
tasks.Error(ex => {
var x = "";
MessageBox.Show(ex.Message, "Query Error");
});
}
......
......@@ -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
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