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
......
......@@ -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