Inheritance: System.EventArgs
示例#1
0
        // 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();
        }
示例#3
0
        // This runs on the main thread
        void StateUpdate(object sender, UIStateUpdate update)
        {
            Debug.Print($"STATE UPDATE ({update.Update}): \r\t\t\t{update.OldState} \r\t\t=>\t{update.NewState}");

            switch (update.Update)
            {
            case UIStateUpdate.UpdateType.FormulaEditStart:
                var fes = (UIState.FormulaEdit)update.NewState;
                UpdateFormulaEditWindow(fes.FormulaEditWindow);
                FormulaEditStart(fes.FormulaPrefix, fes.EditWindowBounds, fes.ExcelToolTipWindow);
                break;

            case UIStateUpdate.UpdateType.FormulaEditMove:
                var fem = (UIState.FormulaEdit)update.NewState;
                FormulaEditMove(fem.EditWindowBounds, fem.ExcelToolTipWindow);
                break;

            case UIStateUpdate.UpdateType.FormulaEditWindowChange:
                var fewc = (UIState.FormulaEdit)update.NewState;
                UpdateFormulaEditWindow(fewc.FormulaEditWindow);
                FormulaEditTextChange(fewc.FormulaPrefix, fewc.EditWindowBounds, fewc.ExcelToolTipWindow);
                break;

            case UIStateUpdate.UpdateType.FormulaEditTextChange:
                var fetc = (UIState.FormulaEdit)update.NewState;
                FormulaEditTextChange(fetc.FormulaPrefix, fetc.EditWindowBounds, fetc.ExcelToolTipWindow);
                break;

            case UIStateUpdate.UpdateType.FormulaEditExcelToolTipChange:
                var fett = (UIState.FormulaEdit)update.NewState;
                FormulaEditExcelToolTipShow(fett.EditWindowBounds, fett.ExcelToolTipWindow);
                break;

            case UIStateUpdate.UpdateType.FunctionListShow:
                var fls = (UIState.FunctionList)update.NewState;
                _functionListWindow = fls.FunctionListWindow;
                FunctionListShow();
                FunctionListSelectedItemChange(fls.SelectedItemText, fls.SelectedItemBounds, fls.FunctionListBounds);
                break;

            case UIStateUpdate.UpdateType.FunctionListMove:
                var flm = (UIState.FunctionList)update.NewState;
                FunctionListMove(flm.SelectedItemBounds, flm.FunctionListBounds);
                break;

            case UIStateUpdate.UpdateType.FunctionListSelectedItemChange:
                var fl = (UIState.FunctionList)update.NewState;
                FunctionListSelectedItemChange(fl.SelectedItemText, fl.SelectedItemBounds, fl.FunctionListBounds);
                break;

            case UIStateUpdate.UpdateType.FunctionListHide:
            case UIStateUpdate.UpdateType.FunctionListWindowChange:
                FunctionListHide();
                break;

            case UIStateUpdate.UpdateType.FormulaEditEnd:
                FormulaEditEnd();
                break;

            case UIStateUpdate.UpdateType.SelectDataSourceShow:
            case UIStateUpdate.UpdateType.SelectDataSourceWindowChange:
            case UIStateUpdate.UpdateType.SelectDataSourceHide:
                // We ignore these for now
                break;

            default:
                throw new InvalidOperationException("Unexpected UIStateUpdate");
            }
        }
        // This runs on the main thread
        void StateUpdate(object sender, UIStateUpdate update)
        {
            Debug.Print($"STATE UPDATE ({update.Update}): \r\t\t\t{update.OldState} \r\t\t=>\t{update.NewState}");

            switch (update.Update)
            {
                case UIStateUpdate.UpdateType.FormulaEditStart:
                    var fes = (UIState.FormulaEdit)update.NewState;
                    UpdateFormulaEditWindow(fes.FormulaEditWindow);
                    FormulaEditStart(fes.FormulaPrefix, fes.EditWindowBounds, fes.ExcelToolTipWindow);
                    break;
                case UIStateUpdate.UpdateType.FormulaEditMove:
                    var fem = (UIState.FormulaEdit)update.NewState;
                    FormulaEditMove(fem.EditWindowBounds, fem.ExcelToolTipWindow);
                    break;
                case UIStateUpdate.UpdateType.FormulaEditWindowChange:
                    var fewc = (UIState.FormulaEdit)update.NewState;
                    UpdateFormulaEditWindow(fewc.FormulaEditWindow);
                    FormulaEditTextChange(fewc.FormulaPrefix, fewc.EditWindowBounds, fewc.ExcelToolTipWindow);
                    break;
                case UIStateUpdate.UpdateType.FormulaEditTextChange:
                    var fetc = (UIState.FormulaEdit)update.NewState;
                    FormulaEditTextChange(fetc.FormulaPrefix, fetc.EditWindowBounds, fetc.ExcelToolTipWindow);
                    break;
                case UIStateUpdate.UpdateType.FormulaEditExcelToolTipChange:
                    var fett = (UIState.FormulaEdit)update.NewState;
                    FormulaEditExcelToolTipShow(fett.EditWindowBounds, fett.ExcelToolTipWindow);
                    break;
                case UIStateUpdate.UpdateType.FunctionListShow:
                    var fls = (UIState.FunctionList)update.NewState;
                    // TODO: TEMP
                    _functionListWindow = fls.FunctionListWindow;
                    FunctionListShow();
                    FunctionListSelectedItemChange(fls.SelectedItemText, fls.SelectedItemBounds, fls.FunctionListBounds);
                    break;
                case UIStateUpdate.UpdateType.FunctionListMove:
                    var flm = (UIState.FunctionList)update.NewState;
                    FunctionListMove(flm.SelectedItemBounds, flm.FunctionListBounds);
                    break;
                case UIStateUpdate.UpdateType.FunctionListSelectedItemChange:
                    var fl = (UIState.FunctionList)update.NewState;
                    FunctionListSelectedItemChange(fl.SelectedItemText, fl.SelectedItemBounds, fl.FunctionListBounds);
                    break;
                case UIStateUpdate.UpdateType.FunctionListHide:
                    FunctionListHide();
                    break;
                case UIStateUpdate.UpdateType.FormulaEditEnd:
                    FormulaEditEnd();
                    break;

                case UIStateUpdate.UpdateType.SelectDataSourceShow:
                case UIStateUpdate.UpdateType.SelectDataSourceWindowChange:
                case UIStateUpdate.UpdateType.SelectDataSourceHide:
                    // We ignore these
                    break;
                default:
                    throw new InvalidOperationException("Unexpected UIStateUpdate");
            }
        }