private void OnKeyUp(object sender, KeyEventArgs e)
{
if (App.UserStyle == UserStyle.Reader && e.Key != Key.Ctrl && e.Key != Key.Shift && e.Key != Key.E && e.Key != Key.S)
{
//If the user is in Reader mode (Explorer) then only toggle between Explorer and Author (Ctrl+Shift+E) and
//the screen capture (Ctrl+Alt+S) will work in this mode as well as Author mode.
return;
}
switch (e.Key)
{
case Key.A:
if ((Keyboard.Modifiers & ModifierKeys.Control) == ModifierKeys.Control)
{
foreach (NodeControl nodeControl in GetVisibleNodeControls())
{
Selector.AddNode(nodeControl, false);
nodeControl.Focus();
}
}
break;
case Key.C:
IoC.GetInstance<ISuperGraphNodeFactory>().AddCon(LastLocation);
break;
case Key.I:
if ((Keyboard.Modifiers & ModifierKeys.Shift) == ModifierKeys.Shift)
{
var dlg = new OpenFileDialog();
dlg.Multiselect = true;
dlg.Filter = "Xml Files (*.xml)|*.xml|Zip Files (*.zip)|*.zip|All Files (*.*)|*.*";
var result = dlg.ShowDialog();
// Process open file dialog box results
if (result == true && FilesDropped != null)
{
FilesDropped(this, new FilesDroppedEventArgs {DroppedFiles = dlg.Files.ToArray()});
}
}
else
{
IoC.GetInstance<ISuperGraphNodeFactory>().AddIdea(LastLocation);
}
break;
case Key.M:
IoC.GetInstance<ISuperGraphNodeFactory>().AddMap(LastLocation);
break;
case Key.P:
IoC.GetInstance<ISuperGraphNodeFactory>().AddPro(LastLocation);
break;
case Key.Q:
IoC.GetInstance<ISuperGraphNodeFactory>().AddQuestion(LastLocation);
break;
case Key.Subtract:
IoC.GetInstance<ISuperGraphNodeFactory>().AddCon(LastLocation);
break;
case Key.N:
IoC.GetInstance<ISuperGraphNodeFactory>().AddNote(LastLocation);
break;
case Key.D:
IoC.GetInstance<ISuperGraphNodeFactory>().AddDecision(LastLocation);
break;
case Key.R:
if ((Keyboard.Modifiers & ModifierKeys.Control) == ModifierKeys.Control &&
(Keyboard.Modifiers & ModifierKeys.Shift) == ModifierKeys.Shift)
{
HorizontalRealign();
}
break;
case Key.V:
if ((Keyboard.Modifiers & ModifierKeys.Control) == ModifierKeys.Control)
{
if ((Keyboard.Modifiers & ModifierKeys.Shift) == ModifierKeys.Shift)
{
VerticalRealign();
}
else if (ContextMenuContainer.ContextMenu.OperationDetails != null &&
ContextMenuContainer.ContextMenu.OperationDetails.Nodes != null)
{
ContextMenuContainer.ContextMenu.Paste(_lastLocation);
}
}
break;
case Key.T:
if ((Keyboard.Modifiers & ModifierKeys.Control) == ModifierKeys.Control &&
(Keyboard.Modifiers & ModifierKeys.Shift) == ModifierKeys.Shift)
{
HorizontalRealign();
}
break;
case Key.B:
if ((Keyboard.Modifiers & ModifierKeys.Control) == ModifierKeys.Control &&
(Keyboard.Modifiers & ModifierKeys.Shift) == ModifierKeys.Shift)
{
VerticalRealign();
}
break;
case Key.E:
if ((Keyboard.Modifiers & ModifierKeys.Control) == ModifierKeys.Control &&
(Keyboard.Modifiers & ModifierKeys.Shift) == ModifierKeys.Shift)
{
if (!ExplorerOnly)
{
if (App.UserStyle == UserStyle.Reader)
{
UserStyle = UserStyle.Author;
}
else if (App.UserStyle == UserStyle.Author)
{
UserStyle = UserStyle.Reader;
}
}
}
break;
case Key.X:
if ((Keyboard.Modifiers & ModifierKeys.Control) == ModifierKeys.Control &&
(Keyboard.Modifiers & ModifierKeys.Shift) == ModifierKeys.Shift)
{
Application.Current.Host.Content.IsFullScreen = !Application.Current.Host.Content.IsFullScreen;
}
break;
case Key.S:
e.Handled = true;
if (((Keyboard.Modifiers & ModifierKeys.Control) == ModifierKeys.Control) &&
((Keyboard.Modifiers & ModifierKeys.Alt) == ModifierKeys.Alt))
{
ScreenCaptureUtility.Instance.SaveToImage(this);
}
break;
case Key.Ctrl:
e.Handled = true;
break;
case Key.Shift:
e.Handled = true;
break;
}
}