// Now called by timer AND by OnIdle private void UpdateStatusPanelProgress() { var statusMessage = ParserQueueString + " " + ParserActivityString; m_propertyTable.SetProperty("StatusPanelProgress", statusMessage, true); m_propertyTable.SetPropertyPersistence("StatusPanelProgress", false); if (m_parserConnection != null) { Exception ex = m_parserConnection.UnhandledException; if (ex != null) { DisconnectFromParser(); var app = m_propertyTable.GetValue <IApp>("App"); ErrorReporter.ReportException(ex, app.SettingsKey, app.SupportEmailAddress, app.ActiveMainWindow, false); } else { string notification = m_parserConnection.GetAndClearNotification(); if (notification != null) { m_mediator.SendMessage("ShowNotification", notification); } } } if (ParserActivityString == ParserUIStrings.ksIdle_ && m_timer.Enabled) { StopUpdateProgressTimer(); } }
// Now called by timer AND by OnIdle private void UpdateStatusPanelProgress() { var statusMessage = ParserQueueString + " " + ParserActivityString; m_mediator.PropertyTable.SetProperty("StatusPanelProgress", statusMessage); m_mediator.PropertyTable.SetPropertyPersistence("StatusPanelProgress", false); if (m_parserConnection != null) { Exception ex = m_parserConnection.UnhandledException; if (ex != null) { DisconnectFromParser(); var iree = ex as InvalidReduplicationEnvironmentException; if (iree != null) { string msg = String.Format(ParserUIStrings.ksHermitCrabReduplicationProblem, iree.Morpheme, iree.Message); MessageBox.Show(Form.ActiveForm, msg, ParserUIStrings.ksBadAffixForm, MessageBoxButtons.OK, MessageBoxIcon.Error); } else { var app = (IApp)m_mediator.PropertyTable.GetValue("App"); ErrorReporter.ReportException(ex, app.SettingsKey, app.SupportEmailAddress, app.ActiveMainWindow, false); } } else { string notification = m_parserConnection.GetAndClearNotification(); if (notification != null) { m_mediator.SendMessage("ShowNotification", notification); } } } if (ParserActivityString == ParserUIStrings.ksIdle_ && m_timer.Enabled) { StopUpdateProgressTimer(); } }
public bool OnIdle(object argument) { CheckDisposed(); m_mediator.PropertyTable.SetProperty("StatusPanelProgress", GetParserQueueString() + " " + GetParserActivityString()); m_mediator.PropertyTable.SetPropertyPersistence("StatusPanelProgress", false); ParserConnection con = Connection; if (con != null) { string notification = con.GetAndClearNotification(); if (notification != null) { m_mediator.SendMessage("ShowNotification", notification); } // It is possible that the Activity will be Idle (at least not 'Update', // but there are still items in the Sync$ table to process. // We have to check here for that case, or some items won't be processed, // which will result in the PropChanges not being done, and thus, // the display not being updated. int countSimpleEdits = 0; int countFullRefreshes = 0; if (CurrentWordformHvo > 0) { countSimpleEdits = SimpleEdits.Count; countFullRefreshes = FullRefreshes.Count; } if (con.Activity.IndexOf(ParserUIStrings.ksUpdate) >= 0 || countSimpleEdits > 0 || countFullRefreshes > 0) { m_updateTimer.Start(); } else { m_updateTimer.Stop(); } } return(false); // Don't stop other people from getting the idle message }