private async void ViewNGUsersDialog_Load(object sender, EventArgs e) { var result = await mApi.FetchNGUsersAsync(); if (result != null) { if (result.Status == 0) { MessageBox.Show(result.Error, "エラー", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { listViewEx1.BeginUpdate(); foreach (var ngUser in result.Users) { var lvi = new ListViewItem( new string[] { ngUser.UserId.ToString(), ngUser.UserName + ngUser.UserDan, } ); lvi.Tag = ngUser; listViewEx1.Items.Add(lvi); } listViewEx1.EndUpdate(); } } else { MessageBox.Show("情報の取得に失敗しました", "エラー", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private async void MainForm_Load(object sender, EventArgs e) { LoadSettings(); LoadHtmlHeader(); mAskMonaApi = new AskMonaApi("3738", "", mSettings.Account); if (await mAskMonaApi.VerifySecretKeyAsync() == null) { var signUpDialog = new SignUpDialog(mSettings.Account); signUpDialog.ShowDialog(); mAskMonaApi.Account = signUpDialog.Account; mSettings.Account = signUpDialog.Account; } if (await mAskMonaApi.VerifySecretKeyAsync() == null) { MessageBox.Show("ログインに失敗しました", "エラー", MessageBoxButtons.OK, MessageBoxIcon.Error); } var topicList = await mAskMonaApi.FetchFavoriteTopicListAsync(); if (topicList != null) { mFavoriteTopicList = topicList.Topics; } var ngUsers = await mAskMonaApi.FetchNGUsersAsync(); if (ngUsers != null) { mNGUsers = ngUsers.Users.Select(x => x.UserId).ToList <int>(); } foreach (var topicId in mSettings.MainFormSettings.TabTopicList) { UpdateConnectionStatus("通信中"); toolStripComboBox1.Text = "https://askmona.org/" + topicId; if (await InitializeTabPage(topicId)) { UpdateConnectionStatus("受信完了"); } else { UpdateConnectionStatus("受信失敗"); } } UpdateConnectionStatus("通信中"); if (await UpdateTopicList(mCategoryId)) { UpdateConnectionStatus("受信完了"); } else { UpdateConnectionStatus("受信失敗"); } tabControl1.SelectedIndex = mSettings.MainFormSettings.SelectedTabIndex; if (tabControl1.SelectedIndex == 0) { tabControl1_SelectedIndexChanged(this, new EventArgs()); } await UpdateCurrencyPrice(); EnableControls(); }