Exemplo n.º 1
0
        public async Task LoadSmiliesAsync()
        {
            if (WebManager == null)
            {
                LoginUser();
            }

            _smileManager = new SmileManager(WebManager);
            if (!SmileCategoryList.Any())
            {
                IsLoading = true;
                var result = await _smileManager.GetSmileListAsync();

                FullSmileCategoryEntities = result.ToObservableCollection();
                foreach (var item in result)
                {
                    SmileCategoryList.Add(item);
                }
                IsLoading = false;
            }

            if (SmiliesView != null)
            {
                SmiliesView.Init();
            }
            //if (SmiliesXboxView != null) SmiliesXboxView.Init();
        }
Exemplo n.º 2
0
        public void SmiliesFilterOnChangedQuery(SearchBox sender, SearchBoxQueryChangedEventArgs args)
        {
            string queryText = args.QueryText;

            if (string.IsNullOrEmpty(queryText))
            {
                SmileCategoryList = FullSmileCategoryEntities;
                return;
            }
            var result = SmileCategoryList.SelectMany(
                smileCategory => smileCategory.SmileList.Where(smile => smile.Title.Equals(queryText))).FirstOrDefault();

            if (result != null)
            {
                return;
            }
            var searchList = FullSmileCategoryEntities.SelectMany(
                smileCategory => smileCategory.SmileList.Where(smile => smile.Title.Contains(queryText)));
            List <Smile> smileListEntities   = searchList.ToList();
            var          searchSmileCategory = new SmileCategory()
            {
                Name      = "Search",
                SmileList = smileListEntities
            };
            var fakeSmileCategoryList = new List <SmileCategory> {
                searchSmileCategory
            };

            SmileCategoryList = fakeSmileCategoryList.ToObservableCollection();
        }
Exemplo n.º 3
0
        public async Task Initialize()
        {
            if (!SmileCategoryList.Any())
            {
                IsLoading = true;
                var list = await _smileManager.GetSmileList();

                FullSmileCategoryEntities = list.ToObservableCollection();
                foreach (var item in list)
                {
                    SmileCategoryList.Add(item);
                }
                IsLoading = false;
            }
            OnPropertyChanged("SmileCategoryList");
        }
Exemplo n.º 4
0
        public void SmiliesFilterOnSuggestedQuery(SearchBox sender, SearchBoxSuggestionsRequestedEventArgs args)
        {
            if (SmileCategoryList == null)
            {
                return;
            }
            string queryText = args.QueryText;

            if (string.IsNullOrEmpty(queryText))
            {
                return;
            }
            var suggestionCollection = args.Request.SearchSuggestionCollection;

            foreach (var smile in SmileCategoryList.SelectMany(smileCategory => smileCategory.SmileList.Where(smile => smile.Title.Contains(queryText))))
            {
                suggestionCollection.AppendQuerySuggestion(smile.Title);
            }
        }
Exemplo n.º 5
0
        public void SmiliesFilterOnSubmittedQuery(SearchBox sender, SearchBoxQuerySubmittedEventArgs args)
        {
            if (SmileCategoryList == null)
            {
                return;
            }
            string queryText = args.QueryText;

            if (string.IsNullOrEmpty(queryText))
            {
                return;
            }
            var result = SmileCategoryList.SelectMany(
                smileCategory => smileCategory.SmileList.Where(smile => smile.Title.Equals(queryText))).FirstOrDefault();

            if (result == null)
            {
                return;
            }
            ReplyBox.Text = ReplyBox.Text.Insert(ReplyBox.Text.Length, result.Title);
            IsOpen        = false;
        }