Esempio n. 1
0
    private static void MainWindow_KeyDown(object sender, KeyEventArgs e)
    {
        if (e.Key == Key.F8)
        {
            myTools.ManageSavedContent(null);
            return;
        }

        if (e.Key == Key.F9)
        {
            myTools.SaveCurrentContent(null);
        }

        /*if (sender != null && e.OriginalSource != null && e.OriginalSource is WebBrowser &&
         *  sender.GetType().FullName == "Microsoft.VisualStudio.Help.Viewer.Views.ViewerWindow" )
         * {
         *  var _onKeyDown = e.OriginalSource.GetType().GetMethod("OnKeyDown", BindingFlags.NonPublic | BindingFlags.Instance);
         *  if (_onKeyDown != null)
         *  {
         *      _onKeyDown.Invoke(e.OriginalSource, new object[] { e });
         *  }
         *
         *  try
         *  {
         *      var src = PresentationSource.FromVisual((WebBrowser)e.OriginalSource);
         *      var ke = new KeyEventArgs(e.KeyboardDevice, src, e.Timestamp, e.Key);
         *      ke.RoutedEvent = UIElement.KeyDownEvent;
         *      ke.Source = e.OriginalSource;
         *      ((WebBrowser)e.OriginalSource).RaiseEvent(ke);
         *  }
         *  catch (Exception ex)
         *  {
         *      LoaderImpl.ShowException(ex);
         *  }
         *
         *  e.Handled = true;
         * }*/
    }