Skip to content
This repository has been archived by the owner on Feb 16, 2021. It is now read-only.

Commit

Permalink
修改登录业务代码,便于储存当前用户信息
Browse files Browse the repository at this point in the history
  • Loading branch information
tobiichiamane committed Apr 24, 2019
1 parent d6abb0c commit 6722fd6
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 9 deletions.
12 changes: 12 additions & 0 deletions PixivFSUWP/Data/CurrentUser.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace PixivFSUWP.Data
{
class CurrentUser
{
}
}
20 changes: 11 additions & 9 deletions PixivFSUWP/LoginPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
using System.Diagnostics;
using Windows.Security.Credentials;
using static PixivFSUWP.Data.OverAll;
using FSharp.Data;

// https://go.microsoft.com/fwlink/?LinkId=234238 上介绍了“空白页”项模板

Expand Down Expand Up @@ -86,38 +87,39 @@ private async void Login()
//异步执行登录
var logintask = Task.Run(() =>
{
JsonValue res = null;
try
{
if (useToken)
GlobalBaseAPI.csfriendly_auth(refresh_token: refreshToken);
res = GlobalBaseAPI.csfriendly_auth(refresh_token: refreshToken);
else
GlobalBaseAPI.csfriendly_auth(username, password);
return true;
res = GlobalBaseAPI.csfriendly_auth(username, password);
return (true, res);
}
catch
{
if(useToken)
if (useToken)
{
useToken = false;
try
{
GlobalBaseAPI.csfriendly_auth(username, password);
return true;
res = GlobalBaseAPI.csfriendly_auth(username, password);
return (true, res);
}
catch
{
return false;
return (false, res);
}
}
return false;
return (false, res);
}
});
stkTxts.Visibility = Visibility.Collapsed;
stkBtns.Visibility = Visibility.Collapsed;
btnTrouble.Visibility = Visibility.Collapsed;
ringProgress.IsActive = true;
grdLoading.Visibility = Visibility.Visible;
var loginres = await logintask;
(var loginres, var jsonres) = await logintask;
if (loginres)
{
//登录成功
Expand Down
1 change: 1 addition & 0 deletions PixivFSUWP/PixivFSUWP.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@
<Compile Include="Data\BigImageDetail.cs" />
<Compile Include="Data\BookmarkIllustsCollection.cs" />
<Compile Include="Data\CommentsCollection.cs" />
<Compile Include="Data\CurrentUser.cs" />
<Compile Include="Data\FollowingIllustsCollection.cs" />
<Compile Include="Data\IllustCommentItem.cs" />
<Compile Include="Data\IllustDetail.cs" />
Expand Down

0 comments on commit 6722fd6

Please sign in to comment.