示例#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());
 */     }
示例#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());
 */     }