private async void ShowArtist(string userId) { if (!userId.IsNumber()) { MessageQueue.Enqueue(Externally.InputIllegal("单个用户")); return; } try { await HttpClientFactory.AppApiService.GetUserInformation(new UserInformationRequest { Id = userId }); } catch (ApiException e) { if (e.StatusCode == HttpStatusCode.NotFound) { MessageQueue.Enqueue(Externally.CannotFindUser); return; } } OpenUserBrowser(); SetUserBrowserContext(new User { Id = userId }); }
private async void ShowArtist(string userId) { if (!userId.IsNumber()) { Notice(Externally.InputIllegal("单个用户")); return; } try { await HttpClientFactory.AppApiService.GetUserInformation(new UserInformationRequest { Id = userId }); } catch (ApiException e) { if (e.StatusCode == HttpStatusCode.NotFound) { Notice(Externally.CannotFindUser); return; } } UserViewer.Show(userId); }
private async void TryQuerySingle(string illustId) { if (!int.TryParse(illustId, out _)) { MessageQueue.Enqueue(Externally.InputIllegal("单个作品")); return; } try { OpenIllustBrowser(await PixivHelper.IllustrationInfo(illustId)); } catch (ApiException exception) { if (exception.StatusCode == HttpStatusCode.NotFound || exception.StatusCode == HttpStatusCode.BadRequest) { MessageQueue.Enqueue(Externally.IdDoNotExists); } else { throw; } } }