Esempio n. 1
0
        protected override void OnClick(EventArgs e)
        {
            base.OnClick(e);
            var clicked = Clicked;

            if (clicked != null)
            {
                clicked(this, e);
            }
            else
            {
                IMXView view;
                var     parent = Parent as IGridBase;
                if (parent is IMXView)
                {
                    view = parent as IMXView;
                }
                else
                {
                    var control = CompactFactory.GetNativeObject <GridCell>(parent, "Parent");
                    view = control.Parent as IMXView ?? control.Parent.Parent as IMXView;
                }
                CompactFactory.Navigate(NavigationLink, view);
            }
        }
Esempio n. 2
0
        void TabItem_Click(object sender, EventArgs e)
        {
            iApp.CurrentNavContext.ActivePane = Pane.Tabs;
            var selected = Selected;

            if (selected == null)
            {
                var stack = (HistoryStack)PaneManager.Instance.FromNavContext(Pane.Master, Index);
                if (Index == PaneManager.Instance.CurrentTab || stack.CurrentView == null)
                {
                    PaneManager.Instance.CurrentTab = Index;
                    CompactFactory.Navigate(NavigationLink, View);
                }
                else
                {
                    iApp.CurrentNavContext.ActivePane = Pane.Master;
                    PaneManager.Instance.CurrentTab   = Index;
                    ((RootForm)CompactFactory.Instance.RootForm).Attach(stack.CurrentView, stack);
                }
            }
            else
            {
                selected(this, EventArgs.Empty);
            }
        }
Esempio n. 3
0
        public void Render()
        {
            lock (SyncRoot) if (_instance == null)
                {
                    _instance = this;
                }

            Rendering.Raise(this, EventArgs.Empty);
            if (!TabItems.Any())
            {
                return;
            }
            if (string.IsNullOrEmpty(Text))
            {
                Text = "Go to...";
            }

            PaneManager.Instance.Clear();
            var tabs = TabItems.Select(item => CompactFactory.GetNativeObject <TabItem>(item, item.Title)).ToList();

            for (int i = 0; i < tabs.Count; i++)
            {
                var tab = tabs[i];
                if (tab == null)
                {
                    continue;
                }
                tab.View  = this;
                tab.Index = i;
                MenuItems.Add(tab);
                var context = new iApp.AppNavigationContext {
                    ActivePane = Pane.Master, ActiveTab = i
                };
                PaneManager.Instance.AddStack(new HistoryStack {
                    Context = context
                }, context);
            }

            var cxt = new iApp.AppNavigationContext {
                ActivePane = Pane.Popover,
            };

            PaneManager.Instance.AddStack(new HistoryStack {
                Context = cxt
            }, cxt);
            if (PaneManager.Instance.CurrentTab > TabItems.Count() || PaneManager.Instance.CurrentTab < 0)
            {
                PaneManager.Instance.CurrentTab = 0;
            }
            CompactFactory.Navigate(TabItems.ElementAt(PaneManager.Instance.CurrentTab).NavigationLink, this);
        }
Esempio n. 4
0
        protected override void OnClick(EventArgs e)
        {
            base.OnClick(e);
            var click = Clicked;

            if (click != null)
            {
                click(this, e);
            }
            else
            {
                CompactFactory.Navigate(NavigationLink, PaneManager.Instance.FromNavContext(PaneManager.Instance.TopmostPane).CurrentView);
            }
        }
Esempio n. 5
0
        public void Select()
        {
            Highlight();

            var selected = Selected;

            if (selected != null)
            {
                selected(Pair ?? this, EventArgs.Empty);
            }
            else
            {
                CompactFactory.Navigate(NavigationLink, Parent.Parent as IMXView);
            }
        }
Esempio n. 6
0
        public void Submit(Link link)
        {
            var submitValues = (_model is iLayer) ? ((iLayer)_model).GetFieldValues() : GetSubmissionValues();

            var args = new SubmissionEventArgs(link, ValidationErrors);

            Submitting.Raise(this, args);

            if (args.Cancel)
            {
                return;
            }

            link.Parameters.AddRange(submitValues);
            CompactFactory.Navigate(link, this);
        }
Esempio n. 7
0
        private void HookEvent(HookEventArgs hookEventArgs, KeyBoardInfo keyBoardInfo)
        {
            var vkey = (Keys)keyBoardInfo.vkCode;

            if (!_keys.Contains(vkey))
            {
                _keys.Add(vkey);
            }

            if (_collecting)
            {
                return;
            }
            _collecting = true;

            var layer = ActiveView == null ? null : ActiveView.GetModel() as iLayer;
            var list  = ActiveView as SmoothListbox;

            Device.Thread.QueueWorker(o =>
            {
                Thread.Sleep(40);
                Device.Thread.ExecuteOnMainThread(new Action(() =>
                {
                    var currentKeystroke = new Keystroke(_keys.Cast <int>());
                    var candidateKeys    = new List <Keystroke> {
                        currentKeystroke
                    };
                    candidateKeys.AddRange(_keys.Select(k => new Keystroke((int)k)));

                    if (layer != null)
                    {
                        foreach (var key in candidateKeys)
                        {
                            var keyChord = new Gesture(key);

                            var link = layer.ShortcutGestures.GetValueOrDefault(keyChord, null);
                            if (link == null && _lastKeystroke != null)
                            {
                                keyChord = new Gesture(_lastKeystroke, key);
                                link     = layer.ShortcutGestures.GetValueOrDefault(keyChord, null);
                            }

                            if (link == null)
                            {
                                continue;
                            }
                            _keys.Clear();
                            currentKeystroke = null;
                            CompactFactory.Navigate(link, ActiveView);
                            break;
                        }
                    }

                    if (_keys.Contains(Keys.Tab))
                    {
                        if (list == null || list.IsDisposed)
                        {
                            return;
                        }
                        if (_keys.Contains(Keys.ShiftKey))
                        {
                            list.HighlightPrevious();
                        }
                        else
                        {
                            list.HighlightNext();
                        }
                        _keys.Clear();
                        currentKeystroke = null;
                    }
                    else if (_keys.Any())
                    {
                        UI.Controls.TextBox text     = null;
                        UI.Controls.TextArea area    = null;
                        UI.Controls.PasswordBox pass = null;
                        UI.Controls.DatePicker date  = null;
                        UI.Controls.TimePicker time  = null;

                        var item = list == null || list.IsDisposed ? null : list.SelectedItem;
                        if (item != null)
                        {
                            text = item.GetChild <UI.Controls.TextBox>();
                            area = item.GetChild <UI.Controls.TextArea>();
                            pass = item.GetChild <UI.Controls.PasswordBox>();
                            date = item.GetChild <UI.Controls.DatePicker>();
                            time = item.GetChild <UI.Controls.TimePicker>();
                        }

                        if (item == null || text == null && area == null && pass == null)
                        {
                            foreach (var key in _keys)
                            {
                                switch (key)
                                {
                                case Keys.Home:
                                    if (list != null && !list.IsDisposed)
                                    {
                                        list.ScrollToHome(true);
                                        _keys.Clear();
                                        currentKeystroke = null;
                                    }
                                    break;

                                case Keys.End:
                                    if (list != null && !list.IsDisposed)
                                    {
                                        list.ScrollToEnd(true);
                                        _keys.Clear();
                                        currentKeystroke = null;
                                    }
                                    break;

                                case Keys.F23:
                                case Keys.Select:
                                case Keys.Enter:
                                case Keys.Space:
                                    if (item != null)
                                    {
                                        item.Select();
                                    }
                                    _keys.Clear();
                                    currentKeystroke = null;
                                    break;
                                }

                                if (currentKeystroke == null)
                                {
                                    break;                           // _keys was modified
                                }
                            }
                        }

                        if (item == null || area == null && date == null && time == null)
                        {
                            foreach (var key in _keys)
                            {
                                switch (key)
                                {
                                case Keys.Up:
                                    if (list != null && !list.IsDisposed)
                                    {
                                        list.HighlightPrevious();
                                        _keys.Clear();
                                        currentKeystroke = null;
                                    }
                                    break;

                                case Keys.Down:
                                    if (list != null && !list.IsDisposed)
                                    {
                                        list.HighlightNext();
                                        _keys.Clear();
                                        currentKeystroke = null;
                                    }
                                    break;
                                }

                                if (currentKeystroke == null)
                                {
                                    break;                           // _keys was modified
                                }
                            }
                        }

                        if (area == null && text != null && (_keys.Contains(Keys.Enter) || _keys.Contains(Keys.F23)))
                        {
                            list.HighlightNext();
                            _keys.Clear();
                            currentKeystroke = null;
                        }

                        CommonKeys(list == null || list.IsDisposed ? null : list, ref currentKeystroke);
                    }

                    _lastKeystroke = currentKeystroke;

                    Device.Thread.QueueWorker(p =>
                    {
                        Thread.Sleep(40);
                        _keys.Clear();
                        _collecting = false;
                    });
                }));
            });
        }