private async Task <bool> InitializeTabPage(int topicId) { Topic topic; var idx = mResponseCache.FindIndex(x => x.Topic.Id == topicId); if (idx == -1) { var responseList = await mAskMonaApi.FetchResponseListAsync(topicId, 1, 1, 1); if (responseList == null) { return(false); } topic = responseList.Topic; } else { var cache = mResponseCache[idx]; topic = cache.Topic; } AddTabPage(topic); return(true); }
public async void UpdateTopic(ResponseList responseList) { if (mIsScattering) { return; } mTopic = responseList.Topic; mResponseList = responseList; var result = await mApi.FetchResponseListAsync(mTopic.Id, 1, 1000, 1, mTopic.Modified); if (result != null) { if (result.Status == 0) { MessageBox.Show(result.Error, "エラー", MessageBoxButtons.OK, MessageBoxIcon.Error); } else if (result.Status != 2) { mTopic = result.Topic; mResponseList = result; } } checkBox4.Enabled = mTopic.ShowHost != 0; this.Text = "『" + mTopic.Title + "』にばらまく"; }
private async void listViewEx2_DoubleClick(object sender, EventArgs e) { var mousePosition = listViewEx2.PointToClient(Control.MousePosition); var hit = listViewEx2.HitTest(mousePosition); var columnIndex = hit.Item.SubItems.IndexOf(hit.SubItem); var tx = (Transaction)listViewEx2.SelectedItems[0].Tag; if (columnIndex == 2 && tx.ResponceId != 0) { var responseList = await mApi.FetchResponseListAsync(tx.TopicId, tx.ResponceId, tx.ResponceId, 1); var html = await mParent.BuildWebBrowserDocument(responseList); if (mViewMessagesDialog != null) { mViewMessagesDialog.Close(); } mViewMessagesDialog = new ViewMessagesDialog(html, tx.Message, responseList.Topic.Title); mViewMessagesDialog.LoadSettings(mSettings.ViewMessagesDialogSettings); mViewMessagesDialog.FormClosed += OnViewMessagesDialogClosed; mViewMessagesDialog.Show(this); } else if (columnIndex == 3 && tx.User != null) { if (mViewProfileDialog != null) { mViewProfileDialog.Close(); } mViewProfileDialog = new ViewProfileDialog(mParent, mSettings.Options, mApi, tx.User.UserId); mViewProfileDialog.LoadSettings(mSettings.ViewProfileDialogSettings); mViewProfileDialog.FormClosed += OnViewProfileDialogClosed; mViewProfileDialog.Show(this); mSettings.ViewProfileDialogSettings = mViewProfileDialog.SaveSettings(); } }