Exemplo n.º 1
0
        private void StoresComplete_Populating(object sender, PopulatingEventArgs e)
        {
            var autoComplete = sender as AutoCompleteBox;

            e.Cancel = true;
            _viewModel.SearchForStore(autoComplete.Text);
        }
Exemplo n.º 2
0
        private void autocom_Populating(object sender, PopulatingEventArgs e)
        {
            string text = textBox1.Text;

            textBox1.ItemsSource = Names;
            _filterString        = text;
        }
Exemplo n.º 3
0
        private void AutoComplete_Populating(object sender, PopulatingEventArgs e)
        {
            // Search for matching foods and make sure that the ServingSize information is returned

            FoodContext autocompleteContext = new FoodContext();

            AutoComplete.ItemsSource = autocompleteContext.Foods;

            autocompleteContext.Load <FitnessTrackerPlus.Web.Data.Food>(autocompleteContext.SearchFoodsQuery(Globals.CurrentUser.id, Globals.MaxAutoCompleteResults, AutoComplete.Text, true),
                                                                        LoadBehavior.RefreshCurrent,
                                                                        (FoodsLoaded) =>
            {
                if (!FoodsLoaded.HasError)
                {
                    AutoComplete.PopulateComplete();

                    if (FoodsLoaded.TotalEntityCount == 0)
                    {
                        SearchingText.Text = "No foods found";
                    }
                }
            }, null);

            e.Cancel = true;
        }
 private void MemberAutocomplete_Populating(object sender, PopulatingEventArgs e)
 {
     if (MemberAutocomplete.Text.Length > 2)
     {
         memberView.SearchForUser(MemberAutocomplete.Text);
     }
 }
Exemplo n.º 5
0
 protected override void OnPopulating(PopulatingEventArgs e)
 {
     try
     {
         if (!GameRes.VFS.IsVirtual)
         {
             var    candidates = new List <string>();
             string dirname    = Path.GetDirectoryName(this.Text);
             if (!string.IsNullOrEmpty(dirname) && Directory.Exists(dirname))
             {
                 foreach (var dir in Directory.GetDirectories(dirname))
                 {
                     if (dir.StartsWith(dirname, StringComparison.CurrentCultureIgnoreCase))
                     {
                         candidates.Add(dir);
                     }
                 }
             }
             this.ItemsSource = candidates;
         }
     }
     catch
     {
         // ignore filesystem errors
     }
     base.OnPopulating(e);
 }
Exemplo n.º 6
0
    void HandleDirectoryAutoCompleteBoxPopulating(object sender, PopulatingEventArgs e)
    {
        var    autoCompleteBox = (AutoCompleteBox)sender;
        string text            = autoCompleteBox.Text;

        string[] subDirectories = Array.Empty <string>();

        if (!string.IsNullOrWhiteSpace(text))
        {
            string?directoryName = Path.GetDirectoryName(text);
            if (DirectoryUtil.ExistsOrNullIfTimeout(directoryName ?? text, TimeSpan.FromSeconds(2)) ?? false)
            {
                try
                {
                    subDirectories = Directory.GetDirectories(
                        directoryName ?? text,
                        "*",
                        SearchOption.TopDirectoryOnly);
                }
                catch
                {
                    // ignore
                }
            }
        }

        autoCompleteBox.ItemsSource = subDirectories;
        autoCompleteBox.PopulateComplete();
    }
Exemplo n.º 7
0
        private void WordAutoCompleteBox_OnPopulating(object sender, PopulatingEventArgs e)
        {
            var client = new PersonServiceSoapClient();

            client.GetPersonsCompleted += GetPersonsCompleted;
            client.GetPersonsAsync();
        }
Exemplo n.º 8
0
        private async void OnPopulatingAsynchronous(object sender, PopulatingEventArgs e)
        {
            AutoCompleteBox source = (AutoCompleteBox)sender;

            // Cancel the populating value: this will allow us to call
            // PopulateComplete as necessary.
            e.Cancel = true;

            usergroups = await global.webSocketClient.Query <apiuser>("users", @"{ name: {$regex: '" + source.Text.Replace("\\", "\\\\") + "', $options: 'i'} }");


            //TestItems.Clear();
            if (usergroups == null)
            {
                return;
            }
            // Use the dispatcher to simulate an asynchronous callback when
            // data becomes available
            _ = Dispatcher.BeginInvoke(
                new System.Action(delegate()
            {
                //source.ItemsSource = new string[]
                //{
                //    e.Parameter + "1",
                //    e.Parameter + "2",
                //    e.Parameter + "3",
                //};
                //source.ItemsSource = TestItems.ToArray();
                source.ItemsSource = usergroups;

                // Population is complete
                source.PopulateComplete();
            }));
        }
Exemplo n.º 9
0
 private void txtClientes_Populating(object sender, PopulatingEventArgs e)
 {
     using (var bd = new EmpeñosDataContext())
         txtClientes.ItemsSource = bd.Clientes
                                   .Where(c => c.Código.Contains(txtClientes.Text) || c.NombreCompleto.Contains(txtClientes.Text))
                                   .Select(c => new KeyValuePair <string, string>(c.Código, c.NombreCompleto)).Take(10);
 }
Exemplo n.º 10
0
 /// <summary>
 /// Raises the Populating event when the AutoCompleteBox is populating the 
 /// selection adapter with suggestions based on the text property.
 /// </summary>
 /// <param name="e">The populating event data.</param>
 protected virtual void OnPopulating(PopulatingEventArgs e)
 {
     PopulatingEventHandler handler = Populating;
     if (handler != null)
     {
         handler(this, e);
     }
 }
Exemplo n.º 11
0
        private void searchBox_Populating(object sender, PopulatingEventArgs e)
        {
            var recommendationWorker = new BackgroundWorker();

            recommendationWorker.DoWork += recommendationWorker_DoWork;
            e.Cancel = true;
            recommendationWorker.RunWorkerAsync(searchBox.Text);
        }
Exemplo n.º 12
0
        private void tlACPeople_Populating(object sender, PopulatingEventArgs e)
        {
            string text   = tlACPeople.Text;
            var    result = _list.Where(p => p.Name.Contains(text));

            tlACPeople.ItemsSource = result;
            tlACPeople.PopulateComplete();
        }
Exemplo n.º 13
0
        private void tlACPeople_Populating(object sender, PopulatingEventArgs e)
        {
            string text   = tlACPeople.Text;
            var    count  = _productProvider.CountFindProducts(text);
            var    result = _productProvider.FindProducts(text);

            tlACPeople.ItemsSource = result;
            tlACPeople.PopulateComplete();
        }
Exemplo n.º 14
0
        /// <summary>
        /// Starts the time of for the search box. After a period of time has elapsed
        /// without the user entering more keys the search will complete.
        /// </summary>
        /// <param name="sender">The calling object</param>
        /// <param name="e">Event arguments</param>
        private void searchBox_Populating(object sender, PopulatingEventArgs e)
        {
            AutoCompleteBox textBox = e.Source as AutoCompleteBox;

            if (textBox != null)
            {
                this.searchEntryTimer.Start();
            }
        }
Exemplo n.º 15
0
 private void textbox_Populating(object sender, PopulatingEventArgs e)
 {
     e.Cancel = true;
     if (SearchTrie != null)
     {
         textbox.ItemsSource = SearchTrie.FindPrefix(e.Parameter);
         textbox.PopulateComplete();
     }
 }
        private void txtEndCustomer_Populating(object sender, PopulatingEventArgs e)
        {
            var ctx = new RadiographyContext();

            if (RGReport != null)
            {
                ctx.GetEndCustomerNames(EndCustomerNames_Loaded, null);
            }
        }
Exemplo n.º 17
0
 private void txtArtículos_Populating(object sender, PopulatingEventArgs e)
 {
     using (var bd = new EmpeñosDataContext())
     {
         txtArtículos.ItemsSource = bd.Artículos
                                    .Where(a => a.Estado == (byte)EstadosActículos.Quedado && (a.Código.Contains(txtArtículos.Text) || a.Nombre.Contains(txtArtículos.Text) || a.Artículos_Características.Any(ac => ac.Valor.Contains(txtArtículos.Text))))
                                    .Select(a => new KeyValuePair <string, string>(a.Código, a.DescripciónExtendida))
                                    .Take(15);
     }
 }
Exemplo n.º 18
0
        private void AutoCompleteBox_OnPopulating(object sender, PopulatingEventArgs e)
        {
            var autoCompleteBox = sender as AutoCompleteBox;

            if (autoCompleteBox != null)
            {
                this.ViewModel.SearchDiagnoses(autoCompleteBox.Text);
            }

            e.Cancel = true;
        }
Exemplo n.º 19
0
        /// <summary>
        /// The Populating event handler.
        /// </summary>
        /// <param name="sender">The source object.</param>
        /// <param name="e">The event data.</param>
        private void OnPopulatingSynchronous(object sender, PopulatingEventArgs e)
        {
            AutoCompleteBox source = (AutoCompleteBox)sender;

            source.ItemsSource = new string[]
            {
                e.Parameter + "1",
                e.Parameter + "2",
                e.Parameter + "3",
            };
        }
Exemplo n.º 20
0
        private void AbPersonalAsistencial_OnPopulating(object sender, PopulatingEventArgs e)
        {
            var autoCompleteBox = sender as AutoCompleteBox;

            if (autoCompleteBox != null)
            {
                this.ViewModel.LoadPersonalAsistencial(new Tuple <string, string>(this.ViewModel.SelectedAgreement.Code, autoCompleteBox.Text));
            }

            e.Cancel = true;
        }
Exemplo n.º 21
0
    private void AutoCompleteBox_Populating(object sender, PopulatingEventArgs e)
    {
        // Have we already populated with this text?
        if (People.Any(person => person.ToLower().StartsWith(e.Parameter.ToLower())))
        {
            return;
        }
        Completer c = new Completer();

        c.Completed += new EventHandler <EventArgs>(c_Completed);
        c.Complete(e.Parameter);
    }
Exemplo n.º 22
0
        /// <summary>
        /// Event triggered by typing from user
        /// </summary>
        /// <param name="sender">sender object</param>
        /// <param name="e">event arguments</param>
        private void Stops_Populating(object sender, PopulatingEventArgs e)
        {
            if (this.db == null)
            {
                // cancel populating
                e.Cancel = true;
            }

            SearchForStop(e.Parameter, sender);

            e.Cancel = true;
        }
Exemplo n.º 23
0
        void OnMetadataBoxPopulating(object sender, PopulatingEventArgs e)
        {
            var box        = (AutoCompleteBox)sender;
            var encodeInfo = (EncodeInfo)box.DataContext;

            e.Cancel = true;

            CancellationToken token;
            Task <object[]>   task = encodeInfo.StartQueryMetadata(box.SearchText, out token);

            task.ContinueWith(t => Dispatcher.BeginInvoke(UpdateQueryResults, box, t, token), token);
        }
        private void AcNombreServicioPopulating(object sender, PopulatingEventArgs e)
        {
            var autoCompleteBox = sender as AutoCompleteBox;

            if (autoCompleteBox != null)
            {
                Debug.WriteLine("Iniciando Consulta...");
                this.ViewModel.LoadSugestions(autoCompleteBox.Text);
            }

            e.Cancel = true;
        }
Exemplo n.º 25
0
        private async void SearchBox_OnPopulating(object sender, PopulatingEventArgs e)
        {
            var result = await App.ViewModel.GetDataSource().GetAutoCompleteSearchItems(SearchBox.Text);

            _autoCompleteItems.Clear();
            foreach (var str in result)
            {
                _autoCompleteItems.Add(str);
            }

            SearchBox.PopulateComplete();
        }
Exemplo n.º 26
0
        /// <summary>
        ///     Handle and cancel the Populating event, and kick off the web service
        ///     request.
        /// </summary>
        /// <param name="sender">The source object.</param>
        /// <param name="e">The event data.</param>
        private void Search_Populating(object sender, PopulatingEventArgs e)
        {
            var autoComplete = (AutoCompleteBox)sender;

            // Allow us to wait for the response
            e.Cancel = true;

            // Create a request for suggestion
            var wc = new WebClient();

            wc.DownloadStringCompleted += OnDownloadStringCompleted;
            wc.DownloadStringAsync(WebServiceHelper.CreateWebSearchSuggestionsUri(autoComplete.SearchText), autoComplete);
        }
Exemplo n.º 27
0
 private void HandlePopulating(object sender, PopulatingEventArgs e)
 {
     e.Cancel = true;
     if (SuggestionProvider != null)
     {
         SuggestionProvider.ProvideSuggestions(e.Parameter)
         .ContinueOnSuccessInTheUIThread(results =>
         {
             AssociatedObject.ItemsSource = results;
             AssociatedObject.PopulateComplete();
         });
     }
 }
Exemplo n.º 28
0
        /// <summary>
        /// Request auto completion data from Nokia Music API.
        /// </summary>
        /// <param name="sender">AutoCompleteBox object</param>
        /// <param name="e">Event arguments</param>
        private async void SearchPopulating(object sender, PopulatingEventArgs e)
        {
            e.Cancel = true;

            if (this._artistSearch)
            {
                this.HandleSearchSuggestionsResponse(await App.ApiClient.GetArtistSearchSuggestionsAsync(e.Parameter));
            }
            else
            {
                this.HandleSearchSuggestionsResponse(await App.ApiClient.GetSearchSuggestionsAsync(e.Parameter));
            }
        }
Exemplo n.º 29
0
        protected override void OnPopulating(PopulatingEventArgs e)
        {
            if (((App)Application.Current).Database == null)
            {
                return;
            }
            var kwrds = new List <string>();

            foreach (Keyword keyword in ((App)Application.Current).Database.GetKeywords(Text))
            {
                kwrds.Add(keyword.NormalForm);
            }
            ItemsSource = kwrds;
        }
Exemplo n.º 30
0
        private void OnPopulating(object sender, PopulatingEventArgs e)
        {
            var command = FilterCommand;

            if (command == null)
            {
                return;
            }

            var parameter = new FilterParameter(AssociatedObject.PopulateComplete, e.Parameter);

            command.Execute(parameter);
            e.Cancel = true;
        }
        private void OnRoleAutoCompleteBoxPopulating(object sender, PopulatingEventArgs e)
        {
            var acb = sender as AutoCompleteBox;

            if (acb != null)
            {
                var context = new SystemRoleDomainContext();
                context.SearchRole(e.Parameter, (obj) =>
                {
                    if (Utility.Utility.CheckInvokeOperation(obj))
                    {
                        acb.ItemsSource = obj.Value;
                    }
                }, null);
            }
        }
Exemplo n.º 32
0
        /// <summary>
        /// The populating handler.
        /// </summary>
        /// <param name="sender">The source object.</param>
        /// <param name="e">The event data.</param>
        private void OnPopulatingAsynchronous(object sender, PopulatingEventArgs e)
        {
            AutoCompleteBox source = (AutoCompleteBox)sender;

            // Cancel the populating value: this will allow us to call
            // PopulateComplete as necessary.
            e.Cancel = true;

            // Use the dispatcher to simulate an asynchronous callback when
            // data becomes available
            Dispatcher.BeginInvoke(
                new Action(delegate()
                {
                    source.ItemsSource = new string[]
                    {
                        e.Parameter + "1",
                        e.Parameter + "2",
                        e.Parameter + "3",
                    };

                    // Population is complete
                    source.PopulateComplete();
                }));
        }
 /// <summary>
 /// Performs test actions for the OnPopulating method.
 /// </summary>
 /// <param name="e">Event arguments.</param>
 protected override void OnPopulating(PopulatingEventArgs e)
 {
     PopulatingActions.DoPreTest(e);
     base.OnPopulating(e);
     PopulatingActions.DoTest(e);
 }
Exemplo n.º 34
0
        /// <summary>
        /// The Populating event handler.
        /// </summary>
        /// <param name="sender">The source object.</param>
        /// <param name="e">The event data.</param>
        private void OnPopulatingSynchronous(object sender, PopulatingEventArgs e)
        {
            AutoCompleteBox source = (AutoCompleteBox)sender;

            source.ItemsSource = new string[]
            {
                e.Parameter + "1",
                e.Parameter + "2",
                e.Parameter + "3",
            };
        }
Exemplo n.º 35
0
 private void OnSuggest(PopulatingEventArgs e)
 {
     if (!_hasInputChanged || (Suggestions != null && Suggestions.Any(s => s.Description == Input)))
     {
         e.Cancel = true;
         return;
     }
     GoogleMapsServices.GetSuggestions(
         ViewModelLocator.MainStatic.MapCenter,
         Input,
         predictions =>
         {
             Suggestions = predictions;
             if (CommandSuggestionComplete != null && CommandSuggestionComplete.CanExecute(null))
             {
                 CommandSuggestionComplete.Execute(null);
             }
         });
 }
Exemplo n.º 36
0
 /// <summary>
 ///     Raises the
 ///     <see cref="E:System.Windows.Controls.AutoCompleteBox.Populating" />
 ///     event.
 /// </summary>
 /// <param name="e">
 ///     A
 ///     <see cref="T:System.Windows.Controls.PopulatingEventArgs" /> that
 ///     contains the event data.
 /// </param>
 protected virtual void OnPopulating(PopulatingEventArgs e)
 {
     #if SILVERLIGHT
     PopulatingEventHandler handler = Populating;
     if (handler != null)
     {
         handler(this, e);
     }
     #else
     RaiseEvent(e);
     #endif
 }
Exemplo n.º 37
0
        /// <summary>
        ///     Handles the timer tick when using a populate delay.
        /// </summary>
        /// <param name="sender">The source object.</param>
        /// <param name="e">The event arguments.</param>
        private void PopulateDropDown(object sender, EventArgs e)
        {
            if (_delayTimer != null)
            {
                _delayTimer.Stop();
            }

            // Update the prefix/search text.
            SearchText = Text;

            // The Populated event enables advanced, custom filtering. The
            // client needs to directly update the ItemsSource collection or
            // call the Populate method on the control to continue the
            // display process if Cancel is set to true.
            #if SILVERLIGHT
            PopulatingEventArgs populating = new PopulatingEventArgs(SearchText);
            #else
            PopulatingEventArgs populating = new PopulatingEventArgs(SearchText, PopulatingEvent);
            #endif

            OnPopulating(populating);
            if (!populating.Cancel)
            {
                PopulateComplete();
            }
        }