Пример #1
0
 public void PostDrawing(DrawingView target)
 {
     target.Clear();
     foreach (var stamp in stampItems)
     {
         target.stampItems.Add(stamp);
     }
 }
Пример #2
0
        private void InitlializeShortucts()
        {
            // shortcuts dictionary
            _shortcuts = new Dictionary <Tuple <Keys, Keys>, Action>();

            // key converters
            var keyConverter          = new KeysConverter();
            var modifiersKeyConverter = new KeysConverter();

            // open shortcut
            _shortcuts.Add(
                new Tuple <Keys, Keys>(
                    (Keys)keyConverter.ConvertFromString("O"),
                    (Keys)modifiersKeyConverter.ConvertFromString("Control")),
                () => Open());

            // save shortcut
            _shortcuts.Add(
                new Tuple <Keys, Keys>(
                    (Keys)keyConverter.ConvertFromString("S"),
                    (Keys)modifiersKeyConverter.ConvertFromString("Control")),
                () => Save());

            // export shortcut
            _shortcuts.Add(
                new Tuple <Keys, Keys>(
                    (Keys)keyConverter.ConvertFromString("E"),
                    (Keys)modifiersKeyConverter.ConvertFromString("Control")),
                () => Export());

            // undo shortcut
            _shortcuts.Add(
                new Tuple <Keys, Keys>(
                    (Keys)keyConverter.ConvertFromString("Z"),
                    (Keys)modifiersKeyConverter.ConvertFromString("Control")),
                () => _view.Undo());

            // redo shortcut
            _shortcuts.Add(
                new Tuple <Keys, Keys>(
                    (Keys)keyConverter.ConvertFromString("Y"),
                    (Keys)modifiersKeyConverter.ConvertFromString("Control")),
                () => _view.Redo());

            // snap shortcut
            _shortcuts.Add(
                new Tuple <Keys, Keys>(
                    (Keys)keyConverter.ConvertFromString("S"),
                    Keys.None),
                () => _view.ToggleSnap());

            // clear shortcut
            _shortcuts.Add(
                new Tuple <Keys, Keys>(
                    (Keys)keyConverter.ConvertFromString("Delete"),
                    (Keys)modifiersKeyConverter.ConvertFromString("Control")),
                () => _view.Clear());

            // editor shortcuts
            foreach (var editor in _view.Editors)
            {
                var _editor = editor;
                _shortcuts.Add(
                    new Tuple <Keys, Keys>(
                        (Keys)keyConverter.ConvertFromString(editor.Key),
                        editor.Modifiers == "" ? Keys.None : (Keys)modifiersKeyConverter.ConvertFromString(editor.Modifiers)),
                    () => _view.Enable(_editor));
            }

            // block shortcut
            _shortcuts.Add(
                new Tuple <Keys, Keys>(
                    (Keys)keyConverter.ConvertFromString("G"),
                    Keys.None),
                () => _view.CreateBlock());

            // delete shortcut
            _shortcuts.Add(
                new Tuple <Keys, Keys>(
                    (Keys)keyConverter.ConvertFromString("Delete"),
                    Keys.None),
                () => _view.Delete());
        }