Ejemplo n.º 1
0
        /// <summary>
        /// 更新搜索提示
        /// </summary>
        private void UpdateSearchSuggest(string para)
        {
            if (Suggests == null)
            {
                Suggests = new ObservableCollection <string>();
            }
            SearchPanelVisibility = Visibility.Collapsed;
            Suggests.Clear();
            if (string.IsNullOrEmpty(para))
            {
                return;
            }
            Func <string, List <string> > suggests = SearchApi.GetKeySuggest;

            suggests.BeginInvoke(para, (ar =>
            {
                var resu = suggests.EndInvoke(ar);
                if (resu.Any())
                {
                    DispatcherHelper.CheckBeginInvokeOnUI((() =>
                    {
                        if (resu.Count > 15)
                        {
                            var sds = resu.Take(15);
                            Suggests.AddRange(sds);
                        }
                        else
                        {
                            Suggests.AddRange(resu);
                        }
                        SearchPanelVisibility = Visibility.Visible;
                    }));
                }
            }), null);
        }
Ejemplo n.º 2
0
        private async void UpdateSuggests(string q)
        {
            string query = string.Format(GlobFuncs.getConfig("serviceAutoComplit"), GlobFuncs.getConfig("token"), q);

            internet = new OnlineStreem(query, log);
            await internet.PostCallAPI();

            internet.getAddress();
            Suggests.Clear();
            foreach (var l in internet.getAddress())
            {
                Suggests.Add(l);
            }
            this.machine.Fire(ViewTrigger.SelectPlaceOnMap);
        }
Ejemplo n.º 3
0
        private void Init()
        {
            var backColor = Color.FromArgb(50, 101, 101);

            BackColor          = backColor;
            lblAlias.BackColor = backColor;
            txtInput.BackColor = backColor;

            lblAlias.Text = string.Empty;

            sug     = new Suggests();
            complex = new Popup(sug);
            //complex.Resizable = true;

            parsers = ParserBuilder.GetParsers();
            //ltbSuggests.DisplayMember = "DisplayInfo";
            sug.SuggestBox.DisplayMember = "DisplayInfo";

            sug.SuggestBox.SelectedIndexChanged += SuggestBox_SelectedIndexChanged;
            sug.SuggestBox.KeyDown += SuggestBox_KeyDown;
        }