示例#1
0
        void HandleSearchEntryChanged(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(ToolbarView.SearchText))
            {
                lastSearchText = ToolbarView.SearchText;
            }

            if (string.IsNullOrEmpty(ToolbarView.SearchText))
            {
                DestroyPopup();
                return;
            }
            var pattern = SearchPopupSearchPattern.ParsePattern(ToolbarView.SearchText);

            if (pattern.Pattern == null && pattern.LineNumber > 0 || pattern == emptyColonPattern)
            {
                if (popup != null)
                {
                    popup.Hide();
                }
                return;
            }
            else
            {
                if (popup != null && !popup.Visible)
                {
                    popup.Show();
                }
            }

            if (popup == null)
            {
                popup = new SearchPopupWindow();
                popup.SearchForMembers = SearchForMembers;
                popup.Disposed        += delegate {
                    popup = null;
                    ToolbarView.SearchText = "";
                };
                PositionPopup();
                popup.Show();
            }

            popup.Update(pattern);
        }
        void HandleSearchEntryChanged(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty (ToolbarView.SearchText))
                lastSearchText = ToolbarView.SearchText;

            if (string.IsNullOrEmpty (ToolbarView.SearchText)){
                DestroyPopup ();
                return;
            }
            var pattern = SearchPopupSearchPattern.ParsePattern (ToolbarView.SearchText);
            if (pattern.Pattern == null && pattern.LineNumber > 0 || pattern == emptyColonPattern) {
                if (popup != null) {
                    popup.Hide ();
                }
                return;
            } else {
                if (popup != null && !popup.Visible)
                    popup.Show ();
            }

            if (popup == null) {
                popup = new SearchPopupWindow ();
                popup.SearchForMembers = SearchForMembers;
                popup.Disposed += delegate {
                    popup = null;
                    ToolbarView.SearchText = "";
                };
                popup.SelectedItemChanged += delegate {
                    var si = popup?.Content?.SelectedItem;
                    if (si == null || si.Item < 0 || si.Item >= si.DataSource.Count)
                        return;
                    var text = si.DataSource [si.Item].AccessibilityMessage;
                    if (string.IsNullOrEmpty (text))
                        return;

                    ToolbarView.ShowAccessibilityAnnouncement (text);
                };
                PositionPopup ();
                popup.Show ();
            }
            popup.Update (pattern);
        }