Пример #1
0
            public int Exec(ref Guid pguidCmdGroup, uint nCmdID, uint nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut)
            {
                switch (_layer)
                {
                case CommandFilterLayer.PreLanguage:
                    return(_window.PreLanguageCommandFilterExec(ref pguidCmdGroup, nCmdID, nCmdexecopt, pvaIn, pvaOut));

                case CommandFilterLayer.PreEditor:
                    return(_window.PreEditorCommandFilterExec(ref pguidCmdGroup, nCmdID, nCmdexecopt, pvaIn, pvaOut));
                }

                throw new InvalidOperationException();
            }
            public int Exec(ref Guid pguidCmdGroup, uint nCmdID, uint nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut)
            {
                try
                {
                    switch (_layer)
                    {
                    case CommandFilterLayer.PreLanguage:
                        return(_window.PreLanguageCommandFilterExec(ref pguidCmdGroup, nCmdID, nCmdexecopt, pvaIn, pvaOut));

                    case CommandFilterLayer.PreEditor:
                        return(_window.PreEditorCommandFilterExec(ref pguidCmdGroup, nCmdID, nCmdexecopt, pvaIn, pvaOut));

                    default:
                        throw ExceptionUtilities.UnexpectedValue(_layer);
                    }
                }
                catch (Exception e) when(FatalError.ReportWithoutCrashUnlessCanceled(e))
                {
                    // Exceptions should not escape from command filters.
                    return(_window._editorCommandFilter.Exec(ref pguidCmdGroup, nCmdID, nCmdexecopt, pvaIn, pvaOut));
                }
            }