Esempio n. 1
0
        private async void View_NameChanged(object sender, NameEventArgs e)
        {
            // reset suggestions
            View.Suggestions = new List <Suggestion>();

            var value = e.Value?.Trim();

            if (value == null)
            {
                return;
            }

            _loadingNamePrefix = value;

            var suggestions = await Task.Run(() =>
            {
                var items = new List <Suggestion>();

                // load suggestions
                foreach (var name in _attributeCache.GetNames(value))
                {
                    items.Add(new Suggestion(name, Strings.UserAttribute_Label, null));
                }

                return(items);
            });

            if (_isDisposed || _loadingNamePrefix != value)
            {
                return;
            }

            View.Suggestions = suggestions;
        }
Esempio n. 2
0
        private async void View_BeginValueEdit(object sender, NameEventArgs e)
        {
            // reset suggestions
            View.Suggestions = new List <Suggestion>();

            var suggestions = await Task.Run(() =>
            {
                var items = new List <Suggestion>();
                foreach (var value in _attributeCache.GetValues(e.Value))
                {
                    items.Add(new Suggestion(value.ToString(), value.Type.ToString(), value));
                }

                return(items);
            });

            if (_isDisposed)
            {
                return;
            }

            View.Suggestions = suggestions;
        }