public override async void Execute(object parameter)
        {
            var args = parameter as SearchBoxSuggestionsRequestedEventArgs;
            var deferral = args.Request.GetDeferral();
            string queryText = args?.QueryText;
            if (string.IsNullOrEmpty(queryText)) return;

            var friendFinderManager = new FriendFinderManager();
            var friendResult =
                await
                    friendFinderManager.SearchForFriends(queryText, Locator.ViewModels.MainPageVm.CurrentTokens,
                        Locator.ViewModels.MainPageVm.CurrentUser.Region,
                        Locator.ViewModels.MainPageVm.CurrentUser.Language);
            var result = await ResultChecker.CheckSuccess(friendResult);
            if (!result)
            {
                return;
            }

            var friendFinderResult = JsonConvert.DeserializeObject<FriendFinderResponse>(friendResult.ResultJson);

            var suggestionCollection = args.Request.SearchSuggestionCollection;
            if (friendFinderResult.SearchResults != null)
            {
                Locator.ViewModels.MessagesVm.FriendSearchResults = friendFinderResult.SearchResults.ToList();

                foreach (var friend in friendFinderResult.SearchResults.Take(5))
                {
                    suggestionCollection.AppendQuerySuggestion(friend.OnlineId);
                }
            }
            deferral.Complete();
        }
 public override async void Execute(object parameter)
 {
     if (string.IsNullOrEmpty(Locator.ViewModels.MessagesVm.FriendSearch))
     {
         return;
     }
     var friendFinderManager = new FriendFinderManager();
     var friendResult =
         await
             friendFinderManager.SearchForFriends(Locator.ViewModels.MessagesVm.FriendSearch, Locator.ViewModels.MainPageVm.CurrentTokens,
                 Locator.ViewModels.MainPageVm.CurrentUser.Region,
                 Locator.ViewModels.MainPageVm.CurrentUser.Language);
     var result = await ResultChecker.CheckSuccess(friendResult);
     if (!result)
     {
         return;
     }
     var friendFinderResult = JsonConvert.DeserializeObject<FriendFinderResponse>(friendResult.ResultJson);
     if (friendFinderResult.SearchResults != null)
     {
         Locator.ViewModels.MessagesVm.FriendSearchResults = friendFinderResult.SearchResults.ToList();
     }
 }
        public override async void Execute(object parameter)
        {
            var args = parameter as SearchBoxQuerySubmittedEventArgs;
            string queryText = args?.QueryText;
            if (string.IsNullOrEmpty(queryText)) return;

            var friendFinderManager = new FriendFinderManager();
            var friendResult =
                await
                    friendFinderManager.SearchForFriends(queryText, Locator.ViewModels.MainPageVm.CurrentTokens,
                        Locator.ViewModels.MainPageVm.CurrentUser.Region,
                        Locator.ViewModels.MainPageVm.CurrentUser.Language);
            var result = await ResultChecker.CheckSuccess(friendResult);
            if (!result)
            {
                return;
            }
            var friendFinderResult = JsonConvert.DeserializeObject<FriendFinderResponse>(friendResult.ResultJson);
            if (!friendFinderResult.SearchResults.Any())
            {
                return;
            }

            Locator.ViewModels.MessagesVm.GroupMembers = new List<string>
            {
                friendFinderResult.SearchResults.First().OnlineId
            };
            Locator.ViewModels.MessagesVm.IsNewMessage = true;

        }