Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix CommandHandler registration issue identified by DRT failure #1025

Merged
merged 1 commit into from
Jun 20, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1334,7 +1334,7 @@ private static void CreateCommandBindings()

// Command: SwitchViewingMode
CommandHelpers.RegisterCommandHandler(typeof(FlowDocumentReader), FlowDocumentReader.SwitchViewingModeCommand,
executedHandler, canExecuteHandler, KeySwitchViewingMode, SRID.KeySwitchViewingModeDisplayString);
executedHandler, canExecuteHandler, KeyGesture.CreateFromResourceStrings(KeySwitchViewingMode, SRID.KeySwitchViewingModeDisplayString));

// Command: ApplicationCommands.Find
CommandHelpers.RegisterCommandHandler(typeof(FlowDocumentReader), ApplicationCommands.Find,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ static InkCanvas()

CommandHelpers.RegisterCommandHandler(ownerType, InkCanvas.DeselectCommand,
new ExecutedRoutedEventHandler(_OnCommandExecuted), new CanExecuteRoutedEventHandler(_OnQueryCommandEnabled),
InkCanvasDeselectKey, SRID.InkCanvasDeselectKeyDisplayString);
KeyGesture.CreateFromResourceStrings(InkCanvasDeselectKey, SRID.InkCanvasDeselectKeyDisplayString));

//
//set our clipping
Expand Down Expand Up @@ -2559,10 +2559,10 @@ private static void _RegisterClipboardHandlers()

CommandHelpers.RegisterCommandHandler(ownerType, ApplicationCommands.Cut,
new ExecutedRoutedEventHandler(_OnCommandExecuted), new CanExecuteRoutedEventHandler(_OnQueryCommandEnabled),
KeyShiftDelete, SRID.KeyShiftDeleteDisplayString);
KeyGesture.CreateFromResourceStrings(KeyShiftDelete, SRID.KeyShiftDeleteDisplayString));
CommandHelpers.RegisterCommandHandler(ownerType, ApplicationCommands.Copy,
new ExecutedRoutedEventHandler(_OnCommandExecuted), new CanExecuteRoutedEventHandler(_OnQueryCommandEnabled),
KeyCtrlInsert, SRID.KeyCtrlInsertDisplayString);
KeyGesture.CreateFromResourceStrings(KeyCtrlInsert, SRID.KeyCtrlInsertDisplayString));

// Use temp variables to reduce code under elevation
ExecutedRoutedEventHandler pasteExecuteEventHandler = new ExecutedRoutedEventHandler(_OnCommandExecuted);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -405,8 +405,8 @@ internal static void RegisterCommandHandlers(Type controlType, bool acceptsRichC
// ---------
if (!readOnly)
{
CommandHelpers.RegisterCommandHandler(controlType, ApplicationCommands.Undo, new ExecutedRoutedEventHandler(OnUndo), new CanExecuteRoutedEventHandler(OnQueryStatusUndo), KeyGesture.CreateFromResourceStrings(SR.Get(KeyUndo), SR.Get(SRID.KeyUndoDisplayString)), KeyGesture.CreateFromResourceStrings(SR.Get(KeyAltUndo), SR.Get(SRID.KeyAltUndoDisplayString)));
CommandHelpers.RegisterCommandHandler(controlType, ApplicationCommands.Redo, new ExecutedRoutedEventHandler(OnRedo), new CanExecuteRoutedEventHandler(OnQueryStatusRedo), KeyRedo, SRID.KeyRedoDisplayString);
CommandHelpers.RegisterCommandHandler(controlType, ApplicationCommands.Undo, new ExecutedRoutedEventHandler(OnUndo), new CanExecuteRoutedEventHandler(OnQueryStatusUndo), KeyGesture.CreateFromResourceStrings(KeyUndo, SR.Get(SRID.KeyUndoDisplayString)), KeyGesture.CreateFromResourceStrings(KeyAltUndo, SR.Get(SRID.KeyAltUndoDisplayString)));
CommandHelpers.RegisterCommandHandler(controlType, ApplicationCommands.Redo, new ExecutedRoutedEventHandler(OnRedo), new CanExecuteRoutedEventHandler(OnQueryStatusRedo), KeyGesture.CreateFromResourceStrings(KeyRedo, SRID.KeyRedoDisplayString));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,14 @@ internal static void _RegisterClassHandlers(Type controlType, bool registerEvent

// Editing Commands: Character Editing
// -----------------------------------
CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.ResetFormat , new ExecutedRoutedEventHandler(OnResetFormat) , onQueryStatusNYI, KeyResetFormat, SRID.KeyResetFormatDisplayString);
CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.ToggleBold , new ExecutedRoutedEventHandler(OnToggleBold) , onQueryStatusNYI, KeyToggleBold, SRID.KeyToggleBoldDisplayString);
CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.ToggleItalic , new ExecutedRoutedEventHandler(OnToggleItalic) , onQueryStatusNYI, KeyToggleItalic, SRID.KeyToggleItalicDisplayString);
CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.ToggleUnderline , new ExecutedRoutedEventHandler(OnToggleUnderline) , onQueryStatusNYI, KeyToggleUnderline, SRID.KeyToggleUnderlineDisplayString);
CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.ToggleSubscript , new ExecutedRoutedEventHandler(OnToggleSubscript) , onQueryStatusNYI, KeyToggleSubscript, SRID.KeyToggleSubscriptDisplayString);
CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.ToggleSuperscript , new ExecutedRoutedEventHandler(OnToggleSuperscript) , onQueryStatusNYI, KeyToggleSuperscript, SRID.KeyToggleSuperscriptDisplayString);
CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.IncreaseFontSize , new ExecutedRoutedEventHandler(OnIncreaseFontSize) , onQueryStatusNYI, KeyIncreaseFontSize, SRID.KeyIncreaseFontSizeDisplayString);
CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.DecreaseFontSize , new ExecutedRoutedEventHandler(OnDecreaseFontSize) , onQueryStatusNYI, KeyDecreaseFontSize, SRID.KeyDecreaseFontSizeDisplayString);
CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.ResetFormat , new ExecutedRoutedEventHandler(OnResetFormat) , onQueryStatusNYI, KeyGesture.CreateFromResourceStrings(KeyResetFormat, SRID.KeyResetFormatDisplayString));
CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.ToggleBold , new ExecutedRoutedEventHandler(OnToggleBold) , onQueryStatusNYI, KeyGesture.CreateFromResourceStrings(KeyToggleBold, SRID.KeyToggleBoldDisplayString));
CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.ToggleItalic , new ExecutedRoutedEventHandler(OnToggleItalic) , onQueryStatusNYI, KeyGesture.CreateFromResourceStrings(KeyToggleItalic, SRID.KeyToggleItalicDisplayString));
CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.ToggleUnderline , new ExecutedRoutedEventHandler(OnToggleUnderline) , onQueryStatusNYI, KeyGesture.CreateFromResourceStrings(KeyToggleUnderline, SRID.KeyToggleUnderlineDisplayString));
CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.ToggleSubscript , new ExecutedRoutedEventHandler(OnToggleSubscript) , onQueryStatusNYI, KeyGesture.CreateFromResourceStrings(KeyToggleSubscript, SRID.KeyToggleSubscriptDisplayString));
CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.ToggleSuperscript , new ExecutedRoutedEventHandler(OnToggleSuperscript) , onQueryStatusNYI, KeyGesture.CreateFromResourceStrings(KeyToggleSuperscript, SRID.KeyToggleSuperscriptDisplayString));
CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.IncreaseFontSize , new ExecutedRoutedEventHandler(OnIncreaseFontSize) , onQueryStatusNYI, KeyGesture.CreateFromResourceStrings(KeyIncreaseFontSize, SRID.KeyIncreaseFontSizeDisplayString));
CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.DecreaseFontSize , new ExecutedRoutedEventHandler(OnDecreaseFontSize) , onQueryStatusNYI, KeyGesture.CreateFromResourceStrings(KeyDecreaseFontSize, SRID.KeyDecreaseFontSizeDisplayString));

CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.ApplyFontSize , new ExecutedRoutedEventHandler(OnApplyFontSize) , onQueryStatusNYI, SRID.KeyApplyFontSize, SRID.KeyApplyFontSizeDisplayString);
CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.ApplyFontFamily , new ExecutedRoutedEventHandler(OnApplyFontFamily) , onQueryStatusNYI, SRID.KeyApplyFontFamily, SRID.KeyApplyFontFamilyDisplayString);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ internal static void _RegisterClassHandlers(Type controlType, bool acceptsRichCo
CommandHelpers.RegisterCommandHandler(controlType, ApplicationCommands.Copy, new ExecutedRoutedEventHandler(OnCopy), new CanExecuteRoutedEventHandler(OnQueryStatusCopy), KeyGesture.CreateFromResourceStrings(KeyCopy, SR.Get(SRID.KeyCopyDisplayString)), KeyGesture.CreateFromResourceStrings(KeyCtrlInsert, SR.Get(SRID.KeyCtrlInsertDisplayString)));
if (acceptsRichContent)
{
CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.CopyFormat, new ExecutedRoutedEventHandler(OnCopyFormat), new CanExecuteRoutedEventHandler(OnQueryStatusCopyFormat), KeyCopyFormat, SRID.KeyCopyFormatDisplayString);
CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.CopyFormat, new ExecutedRoutedEventHandler(OnCopyFormat), new CanExecuteRoutedEventHandler(OnQueryStatusCopyFormat), KeyGesture.CreateFromResourceStrings(KeyCopyFormat, SRID.KeyCopyFormatDisplayString));
}
if (!readOnly)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ internal static class TextEditorLists
// Registers all text editing command handlers for a given control type
internal static void _RegisterClassHandlers(Type controlType, bool registerEventListeners)
{
CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.RemoveListMarkers , new ExecutedRoutedEventHandler(OnListCommand) , new CanExecuteRoutedEventHandler(OnQueryStatusNYI), KeyRemoveListMarkers, SRID.KeyRemoveListMarkersDisplayString);
CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.ToggleBullets , new ExecutedRoutedEventHandler(OnListCommand) , new CanExecuteRoutedEventHandler(OnQueryStatusNYI), KeyToggleBullets, SRID.KeyToggleBulletsDisplayString);
CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.ToggleNumbering , new ExecutedRoutedEventHandler(OnListCommand) , new CanExecuteRoutedEventHandler(OnQueryStatusNYI), KeyToggleNumbering, SRID.KeyToggleNumberingDisplayString);
CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.IncreaseIndentation , new ExecutedRoutedEventHandler(OnListCommand) , new CanExecuteRoutedEventHandler(OnQueryStatusTab), KeyIncreaseIndentation, SRID.KeyIncreaseIndentationDisplayString);
CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.DecreaseIndentation , new ExecutedRoutedEventHandler(OnListCommand) , new CanExecuteRoutedEventHandler(OnQueryStatusTab), KeyDecreaseIndentation, SRID.KeyDecreaseIndentationDisplayString);
CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.RemoveListMarkers , new ExecutedRoutedEventHandler(OnListCommand) , new CanExecuteRoutedEventHandler(OnQueryStatusNYI), KeyGesture.CreateFromResourceStrings(KeyRemoveListMarkers, SRID.KeyRemoveListMarkersDisplayString));
CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.ToggleBullets , new ExecutedRoutedEventHandler(OnListCommand) , new CanExecuteRoutedEventHandler(OnQueryStatusNYI), KeyGesture.CreateFromResourceStrings(KeyToggleBullets, SRID.KeyToggleBulletsDisplayString));
CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.ToggleNumbering , new ExecutedRoutedEventHandler(OnListCommand) , new CanExecuteRoutedEventHandler(OnQueryStatusNYI), KeyGesture.CreateFromResourceStrings(KeyToggleNumbering, SRID.KeyToggleNumberingDisplayString));
CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.IncreaseIndentation , new ExecutedRoutedEventHandler(OnListCommand) , new CanExecuteRoutedEventHandler(OnQueryStatusTab), KeyGesture.CreateFromResourceStrings(KeyIncreaseIndentation, SRID.KeyIncreaseIndentationDisplayString));
CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.DecreaseIndentation , new ExecutedRoutedEventHandler(OnListCommand) , new CanExecuteRoutedEventHandler(OnQueryStatusTab), KeyGesture.CreateFromResourceStrings(KeyDecreaseIndentation, SRID.KeyDecreaseIndentationDisplayString));
}

// Decreases the indent level of the Block at selection start.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,13 @@ internal static void _RegisterClassHandlers(Type controlType, bool acceptsRichCo
{
// Editing Commands: Paragraph Editing
// -----------------------------------
CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.AlignLeft , new ExecutedRoutedEventHandler(OnAlignLeft) , onQueryStatusNYI, KeyAlignLeft, SRID.KeyAlignLeftDisplayString );
CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.AlignCenter , new ExecutedRoutedEventHandler(OnAlignCenter) , onQueryStatusNYI, KeyAlignCenter, SRID.KeyAlignCenterDisplayString );
CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.AlignRight , new ExecutedRoutedEventHandler(OnAlignRight) , onQueryStatusNYI, KeyAlignRight, SRID.KeyAlignRightDisplayString );
CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.AlignJustify , new ExecutedRoutedEventHandler(OnAlignJustify) , onQueryStatusNYI, KeyAlignJustify, SRID.KeyAlignJustifyDisplayString );
CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.ApplySingleSpace , new ExecutedRoutedEventHandler(OnApplySingleSpace) , onQueryStatusNYI, KeyApplySingleSpace, SRID.KeyApplySingleSpaceDisplayString );
CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.ApplyOneAndAHalfSpace , new ExecutedRoutedEventHandler(OnApplyOneAndAHalfSpace) , onQueryStatusNYI, KeyApplyOneAndAHalfSpace, SRID.KeyApplyOneAndAHalfSpaceDisplayString );
CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.ApplyDoubleSpace , new ExecutedRoutedEventHandler(OnApplyDoubleSpace) , onQueryStatusNYI, KeyApplyDoubleSpace, SRID.KeyApplyDoubleSpaceDisplayString );
CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.AlignLeft, new ExecutedRoutedEventHandler(OnAlignLeft), onQueryStatusNYI, KeyGesture.CreateFromResourceStrings(KeyAlignLeft, SRID.KeyAlignLeftDisplayString));
CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.AlignCenter, new ExecutedRoutedEventHandler(OnAlignCenter), onQueryStatusNYI, KeyGesture.CreateFromResourceStrings(KeyAlignCenter, SRID.KeyAlignCenterDisplayString));
CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.AlignRight, new ExecutedRoutedEventHandler(OnAlignRight), onQueryStatusNYI, KeyGesture.CreateFromResourceStrings(KeyAlignRight, SRID.KeyAlignRightDisplayString));
CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.AlignJustify, new ExecutedRoutedEventHandler(OnAlignJustify), onQueryStatusNYI, KeyGesture.CreateFromResourceStrings(KeyAlignJustify, SRID.KeyAlignJustifyDisplayString));
CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.ApplySingleSpace, new ExecutedRoutedEventHandler(OnApplySingleSpace), onQueryStatusNYI, KeyGesture.CreateFromResourceStrings(KeyApplySingleSpace, SRID.KeyApplySingleSpaceDisplayString));
CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.ApplyOneAndAHalfSpace, new ExecutedRoutedEventHandler(OnApplyOneAndAHalfSpace), onQueryStatusNYI, KeyGesture.CreateFromResourceStrings(KeyApplyOneAndAHalfSpace, SRID.KeyApplyOneAndAHalfSpaceDisplayString));
CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.ApplyDoubleSpace, new ExecutedRoutedEventHandler(OnApplyDoubleSpace), onQueryStatusNYI, KeyGesture.CreateFromResourceStrings(KeyApplyDoubleSpace, SRID.KeyApplyDoubleSpaceDisplayString));
}

CommandHelpers.RegisterCommandHandler(controlType, EditingCommands.ApplyParagraphFlowDirectionLTR, new ExecutedRoutedEventHandler(OnApplyParagraphFlowDirectionLTR), onQueryStatusNYI);
Expand Down
Loading