/// <summary> /// Displays the case information provided, or clears the display if no case is provided /// </summary> /// <param name="caseReader"></param> private void DisplayCase(FogBugzCaseReader caseReader) { if ((caseReader == null) || (string.IsNullOrEmpty(caseReader.Title))) { caseDetailsFlowPanel.Visible = false; TitleLabel.Text = string.Empty; ProjectLabel.Text = string.Empty; UpdatedLabel.Text = string.Empty; LatestSummaryLabel.Text = string.Empty; } else { TitleLabel.Text = caseReader.Title; ProjectLabel.Text = string.Format("{0}: {1} | {2} ({3})", caseReader.Project, caseReader.Area, caseReader.Status, caseReader.Priority); UpdatedLabel.Text = string.Format("{0} on {1} {2}", caseReader.LastUpdatedBy, caseReader.LastUpdated.ToShortDateString(), caseReader.LastUpdated.ToShortTimeString()); LatestSummaryLabel.Text = caseReader.LatestSummary; caseDetailsFlowPanel.Visible = true; } }
private void ThreadSafeDisplayCaseInformation(FogBugzCaseReader caseReader) { if (m_CurrentCaseId != caseReader.CaseId) return; //they changed their mind before we completed, we're an interim result. if (InvokeRequired) { ThreadSafeDisplayCaseInformationInvoker invoker = ThreadSafeDisplayCaseInformation; Invoke(invoker, new object[] {caseReader}); } else { //we're on the UI thread. We only update these items from the UI thread so we're not bothering with a lock. try { DisplayCase(caseReader); m_SelectedItemsLabel = string.Format("associated with FogBugz case {0}", caseReader.CaseId); OnSelectionChanged(); } finally { UseWaitCursor = false; //we set this true WAY WAY back when we started this whole search thing. } } }
private void AsyncPerformSearch(object state) { //since we're on the thread pool we MUST catch exceptions or the app will fail. try { int caseId = (int)state; //make sure we're still looking for this case id if (caseId != m_CurrentCaseId) return; FogBugzCaseReader caseReader = new FogBugzCaseReader(m_Controller, caseId); m_CaseSessionIds = caseReader.SessionIds; UpdateSelectedSessions(); ThreadSafeDisplayCaseInformation(caseReader); } catch (Exception ex) { m_Context.Log.ReportException(ex, RepositoryController.LogCategory, true, false); } }