// This runs on the UIMonitor's automation thread // Allows us to enable the update to be raised on main thread // Might be raised on the main thread even if we don't enable it (other listeners might enable) void StateUpdatePreview(object sender, UIStateUpdate update) { bool enable; if (update.Update == UIStateUpdate.UpdateType.FormulaEditTextChange) { var fe = (UIState.FormulaEdit)update.NewState; enable = ShouldProcessFormulaEditTextChange(fe.FormulaPrefix); } else if (update.Update == UIStateUpdate.UpdateType.FunctionListSelectedItemChange) { var fl = (UIState.FunctionList)update.NewState; enable = ShouldProcessFunctionListSelectedItemChange(fl.SelectedItemText); } else if (update.Update == UIStateUpdate.UpdateType.FormulaEditExcelToolTipChange) { // If if has just been hidden, we need no extra processing and can skip the Main thread call var fe = (UIState.FormulaEdit)update.NewState; enable = fe.ExcelToolTipWindow != IntPtr.Zero; } else { enable = true; // allow the update event to be raised by default } if (enable) { update.EnableUpdateEvent(); } }
// This runs on the UIMonitor's automation thread // Allows us to enable the update to be raised on main thread // Might be raised on the main thread even if we don't enable it (other listeners might enable) void StateUpdatePreview(object sender, UIStateUpdate update) { bool enable; if (update.Update == UIStateUpdate.UpdateType.FormulaEditTextChange) { var fe = (UIState.FormulaEdit)update.NewState; enable = ShouldProcessFormulaEditTextChange(fe.FormulaPrefix); } else if (update.Update == UIStateUpdate.UpdateType.FunctionListSelectedItemChange) { var fl = (UIState.FunctionList)update.NewState; enable = ShouldProcessFunctionListSelectedItemChange(fl.SelectedItemText); } else if (update.Update == UIStateUpdate.UpdateType.FormulaEditExcelToolTipChange) { // If if has just been hidden, we need no extra processing and can skip the Main thread call var fe = (UIState.FormulaEdit)update.NewState; enable = fe.ExcelToolTipWindow != IntPtr.Zero; } else { enable = true; // allow the update event to be raised by default } if (enable) update.EnableUpdateEvent(); }