Exemplo n.º 1
0
        public void SetEditingCommands(CutCommand cutCommand, CopyCommand copyCommand, PasteCommand pasteCommand, UndoCommand undoCommand)
        {
            _cutCommand   = cutCommand;
            _copyCommand  = copyCommand;
            _pasteCommand = pasteCommand;
            _undoCommand  = undoCommand;

            _cutCommand.Implementer   = () => _browser.CutSelection();
            _copyCommand.Implementer  = () => _browser.CopySelection();
            _pasteCommand.Implementer = PasteFilteredText;
            _undoCommand.Implementer  = () =>
            {
                // Note: this is only used for the Undo button in the toolbar;
                // ctrl-z is handled in JavaScript directly.
                var result = RunJavaScript("calledByCSharp ? 'y' : 'f'");
                if (result == "y")
                {
                    if (RunJavaScript("calledByCSharp.handleUndo()") == "fail")
                    {
                        _browser.Undo();                         // not using special Undo.
                    }
                }
                else
                {
                    _browser.Undo();
                }
            };
            //none of these worked

/*            _browser.DomKeyPress+=new GeckoDomKeyEventHandler((sender, args) => UpdateEditButtons());
 *                      _browser.DomClick += new GeckoDomEventHandler((sender, args) => UpdateEditButtons());
 *                      _browser.DomFocus += new GeckoDomEventHandler((sender, args) => UpdateEditButtons());
 */     }
Exemplo n.º 2
0
        public void SetEditingCommands(CutCommand cutCommand, CopyCommand copyCommand, PasteCommand pasteCommand, UndoCommand undoCommand)
        {
            _cutCommand   = cutCommand;
            _copyCommand  = copyCommand;
            _pasteCommand = pasteCommand;
            _undoCommand  = undoCommand;

            _cutCommand.Implementer   = () => _browser.CutSelection();
            _copyCommand.Implementer  = () => _browser.CopySelection();
            _pasteCommand.Implementer = PasteFilteredText;
            _undoCommand.Implementer  = () => _browser.Undo();

            //none of these worked

/*            _browser.DomKeyPress+=new GeckoDomKeyEventHandler((sender, args) => UpdateEditButtons());
 *                      _browser.DomClick += new GeckoDomEventHandler((sender, args) => UpdateEditButtons());
 *                      _browser.DomFocus += new GeckoDomEventHandler((sender, args) => UpdateEditButtons());
 */     }
Exemplo n.º 3
0
        public void SetEditingCommands( CutCommand cutCommand, CopyCommand copyCommand, PasteCommand pasteCommand, UndoCommand undoCommand)
        {
            _cutCommand = cutCommand;
            _copyCommand = copyCommand;
            _pasteCommand = pasteCommand;
            _undoCommand = undoCommand;

            _cutCommand.Implementer = () => _browser.CutSelection();
            _copyCommand.Implementer = () => _browser.CopySelection();
            _pasteCommand.Implementer = () => Paste();
            _undoCommand.Implementer = () =>
            {
                // Note: this is only used for the Undo button in the toolbar;
                // ctrl-z is handled in JavaScript directly.
                switch (CanUndoWithJavaScript)
                {
                    case JavaScriptUndoState.Disabled: break; // this should not even have been called
                    case JavaScriptUndoState.DependsOnBrowser:
                        _browser.Undo();
                        break;
                    case JavaScriptUndoState.Enabled:
                        RunJavaScript("FrameExports.handleUndo()");
                        break;
                }
            };
        }
Exemplo n.º 4
0
        public void SetEditingCommands( CutCommand cutCommand, CopyCommand copyCommand, PasteCommand pasteCommand, UndoCommand undoCommand)
        {
            _cutCommand = cutCommand;
            _copyCommand = copyCommand;
            _pasteCommand = pasteCommand;
            _undoCommand = undoCommand;

            _cutCommand.Implementer = () => _browser.CutSelection();
            _copyCommand.Implementer = () => _browser.CopySelection();
            _pasteCommand.Implementer = PasteFilteredText;
            _undoCommand.Implementer = () => _browser.Undo();

            //none of these worked
            /*            _browser.DomKeyPress+=new GeckoDomKeyEventHandler((sender, args) => UpdateEditButtons());
            _browser.DomClick += new GeckoDomEventHandler((sender, args) => UpdateEditButtons());
            _browser.DomFocus += new GeckoDomEventHandler((sender, args) => UpdateEditButtons());
              */
        }