コード例 #1
0
        private void Initialize()
        {
            BackgroundColor   = UIColor.White;
            Layer.BorderWidth = 1;
            Layer.BorderColor = UIColor.LightGray.CGColor;

            _scheme = new HotKeyScheme(
                new HotKey(Key.Escape, Hide),
                new HotKey(Key.Enter, ApplySelected),
                new HotKey(Key.ArrowDown, SelectNext),
                new HotKey(Key.ArrowUp, SelectPrev),

                new HotKey(new Key("h"), () => TapOn(0)),
                new HotKey(new Key("j"), () => TapOn(1)),
                new HotKey(new Key("k"), () => TapOn(2)),
                new HotKey(new Key("l"), () => TapOn(3)),
                new HotKey(new Key(";"), () => TapOn(4)));

            var items = _spellChecker.Guesses.Select(suggestion =>
            {
                var collectionItem = new CollectionItem(
                    new SuggestionItemView(suggestion)
                {
                    OnSelected = ItemSelected
                },
                    new HorizontalSeparatorView()
                    );

                return(collectionItem);
            }).ToArray();

            _items = new CollectionItem[]
            {
                new CollectionItem(
                    new SuggestionItemView(AddToDict)
                {
                    OnSelected = ItemSelected
                },
                    new HorizontalSeparatorView()
                    ),
            }
            .And(items)
            .ToArray();

            _suggestionsView = new CollectionView();
            _suggestionsView.IsOrderingEnabled = false;
            _suggestionsView.AddRangeWithoutAnimation(_items);

            Add(_suggestionsView);

            _suggestionsView.Select(_items.SecondOrFirst());
        }
コード例 #2
0
        public ArticleView(IArticle article)
        {
            _article = article;
            _article.SetViewport(this);

            var deactivateEditMode = new HotKey(Key.Escape, DeactivateEditMode);
            var activateEditMode   = new HotKey(Key.Enter, ActivateEditMode);

            _viewModeScheme = new HotKeyScheme(activateEditMode);
            _editModeScheme = new HotKeyScheme(deactivateEditMode);

            Initialize();
        }
コード例 #3
0
        private void Initialize()
        {
            _scheme = new HotKeyScheme(
                new HotKey(Key.Enter, Save),
                new HotKey(Key.Escape, Hide)
                );

            _typeSelectView           = new TypeSelectView();
            _typeSelectView.OnCancel += Hide;
            _typeSelectView.OnCreate += TypeSelectViewOnOnCreate;
            Add(_typeSelectView);

            BackgroundColor = UIColor.DarkGray.ColorWithAlpha(0.3f);

            Layout = () =>
            {
                _typeSelectView.SetSizeThatFits();
                _typeSelectView.PositionToCenterInside(this);
            };

            Layout();
        }
コード例 #4
0
        private void Initialize()
        {
            _scheme = new HotKeyScheme(
                new HotKey(new Key("n"), CreateNovel),
                new HotKey(new Key("f"), CreateFolder),
                new HotKey(Key.ArrowUp, Up),
                new HotKey(Key.ArrowDown, Down),
                new HotKey(Key.Enter, Tap));

            _treeView           = new FileSystemTreeView(_node, Show, Hide);
            _treeView.Selected += TreeViewOnSelected;

            Add(_treeView);

            Layout = () =>
            {
                _treeView.ChangeSize(Frame.Width, Frame.Height);
                _treeView.ChangePosition(0, 0);
            };

            Layout();
        }
コード例 #5
0
        public NovelView(INovel novel, ILibrary library)
        {
            _novel   = novel;
            _library = library;

            var deactivateEditMode      = new HotKey(Key.Escape, DeactivateEditMode);
            var activateEditMode        = new HotKey(Key.Enter, ActivateEditMode);
            var leftTheLine             = new HotKey(new Key("7"), LeftCurrentLine).WithCommand();
            var centerTheLine           = new HotKey(new Key("8"), CenterCurrentLine).WithCommand();
            var rightTheLine            = new HotKey(new Key("9"), RightCurrentLine).WithCommand();
            var enableJoButton          = new HotKey(new Key("]"), EnableJoButton);
            var enableJoButtonUpperCase = new HotKey(new Key("]"), EnableJoButtonUpperCase).WithShift();
            var showAutocorrection      = new HotKey(new KeyCombination(Key.Space, UIKeyModifierFlags.Shift), ShowAutocorrection);

            //var moveCursorToRight = new HotKey(new Key(";"), MoveCursorToRight);
            //var moveCursorToLeft = new HotKey(new Key("l"), MoveCursorToLeft);

            _viewModeScheme = new HotKeyScheme(activateEditMode);
            _editModeScheme = new HotKeyScheme(deactivateEditMode, leftTheLine, centerTheLine, rightTheLine, enableJoButton, enableJoButtonUpperCase, showAutocorrection);

            _save = new DeferredAction(TimeSpan.FromSeconds(10), () => _library.Update(this));

            Initialize();
        }