public async Task Search()
        {
            if (string.IsNullOrWhiteSpace(SearchText))
            {
                IsBrowseVisible      = true;
                SearchResultsVisible = false;
                return;
            }

            var request = new Model.Requests.SearchRequest
            {
                SearchString = SearchText
            };
            var list = await _serviceSearch.Get <List <Model.SearchResult> >(request);

            SearchResultList.Clear();

            SearchResultsVisible = true;
            IsBrowseVisible      = false;

            if (list.Count != 0)
            {
                foreach (var item in list)
                {
                    SearchResultList.Add(item);
                }
            }
            else
            {
                SearchResultList.Add(new Model.SearchResult
                {
                    ResultText = "No results found."
                });
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// 検索結果を更新する
 /// </summary>
 /// <param name="playlists"></param>
 public void Update(IEnumerable <Channel> channels)
 {
     SearchResultList.Clear();
     foreach (var channel in channels)
     {
         SearchResultList.Add(new ChannelViewModel(channel, m_WebClientService));
     }
 }
 /// <summary>
 /// 検索結果を更新する
 /// </summary>
 /// <param name="playlists"></param>
 public void Update(IEnumerable <Playlist> playlists)
 {
     SearchResultList.Clear();
     foreach (var playlist in playlists)
     {
         SearchResultList.Add(new PlaylistViewModel(playlist, m_WebClientService));
     }
 }
 /// <summary>
 /// 検索結果を更新する
 /// </summary>
 /// <param name="videos"></param>
 public void Update(IEnumerable <Video> videos)
 {
     SearchResultList.Clear();
     foreach (var video in videos)
     {
         SearchResultList.Add(new VideoViewModel(video, m_WebClientService));
     }
 }
Exemplo n.º 5
0
        private void Search()
        {
            if (IsSearching)
            {
                return;
            }

            IsSearching = true;

            SynchronizationContext UIContext = SynchronizationContext.Current;

            SearchResultList.Clear();

            new Thread(() =>
            {
                string FFUURL          = null;
                string[] EmergencyURLs = null;
                try
                {
                    string TempProductType = ProductType.ToUpper();
                    if ((TempProductType != null) && TempProductType.StartsWith("RM") && !TempProductType.StartsWith("RM-"))
                    {
                        TempProductType = "RM-" + TempProductType.Substring(2);
                    }
                    ProductType = TempProductType;
                    FFUURL      = LumiaDownloadModel.SearchFFU(ProductType, ProductCode, OperatorCode, out TempProductType);
                    if (TempProductType != null)
                    {
                        ProductType = TempProductType;
                    }
                    if (ProductType != null)
                    {
                        EmergencyURLs = LumiaDownloadModel.SearchEmergencyFiles(ProductType);
                    }
                }
                catch { }

                UIContext.Post(s =>
                {
                    if (FFUURL != null)
                    {
                        SearchResultList.Add(new SearchResult(FFUURL, ProductType, FFUDownloaded, null));
                    }
                    if (EmergencyURLs != null)
                    {
                        SearchResultList.Add(new SearchResult(ProductType + " emergency-files", EmergencyURLs, ProductType, EmergencyDownloaded, ProductType));
                    }
                }, null);

                IsSearching = false;
            }).Start();
        }
Exemplo n.º 6
0
 void Navigate(string navigationProperty)
 {
     if (ResultAccount != null)
     {
         var navigationParameters = new NavigationParameters();
         navigationParameters.Add("Account", ResultAccount);
         _regionManager.RequestNavigate(RegionNames.AccountsTabRegion, navigationProperty, navigationParameters);
         ResultAccount       = null;
         IsSearchAccountOpen = false;
     }
     else
     {
         _regionManager.RequestNavigate(RegionNames.AccountsTabRegion, navigationProperty);
     }
     SearchResultList.Clear();
     IsLeftOpen = false;
 }
        //Pick a material
        private void SearchListByMaterial(object sender, EventArgs e)
        {
            try
            {
                SearchResultList.Clear();
                SearchResultList.Columns.Add("Date", 50, HorizontalAlignment.Left);
                SearchResultList.Columns.Add("Name", 190, HorizontalAlignment.Left);
                SearchResultList.Columns.Add("Width", 61, HorizontalAlignment.Left);
                SearchResultList.Columns.Add("Depth", 61, HorizontalAlignment.Left);
                SearchResultList.Columns.Add("Drawers", 75, HorizontalAlignment.Left);
                SearchResultList.Columns.Add("Quote", 75, HorizontalAlignment.Left);

                int countFound = 0;
                foreach (DeskQuotes quote in QuotesList)
                {
                    if (quote.Desk.Material.ToString() == materialSelect.Text)
                    {
                        SearchResultList.Items.Add(new ListViewItem(new[] {
                            quote.QuoteDate.ToString("MM/dd"),
                            quote.Name,
                            quote.Desk.Width.ToString(),
                            quote.Desk.Depth.ToString(),
                            quote.Desk.Drawers.ToString(),
                            "$" + quote.PriceQuote.ToString()
                        }));

                        countFound++;
                    }
                }
                if (countFound == 0)
                {
                    SearchResultList.Clear();
                    SearchResultList.Columns.Add("No records were found", 517, HorizontalAlignment.Left);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error finding the records\n" + ex);
            }
        }
Exemplo n.º 8
0
        private void Search()
        {
            if (IsSearching)
            {
                return;
            }

            IsSearching = true;

            SynchronizationContext UIContext = SynchronizationContext.Current;

            SearchResultList.Clear();

            new Thread(() =>
            {
                string FFUURL          = null;
                string[] EmergencyURLs = null;
                try
                {
                    string TempProductType = ProductType.ToUpper();
                    if ((TempProductType?.StartsWith("RM") == true) && !TempProductType.StartsWith("RM-"))
                    {
                        TempProductType = "RM-" + TempProductType[2..];
                    }
Exemplo n.º 9
0
 public void InitData(object obj = null)
 {
     CancleHttpRequest();
     SearchResultList.Clear();
     this.SearchPara = string.Empty;
 }
Exemplo n.º 10
0
        private async void SearchBox_OnTextChanged(object sender, TextChangedEventArgs e)
        {
            var    textboxSender = (TextBox)sender;
            string searchText    = textboxSender.Text.Trim();

            if (string.IsNullOrWhiteSpace(searchText))
            {
                ClearAndHideSearchResultListBox();
                return;
            }

            IsLoading = true;
            try
            {
                var graphService = MicrosoftGraphService.Instance;
                await graphService.TryLoginAsync();

                GraphServiceClient graphClient = graphService.GraphProvider;

                if (graphClient != null)
                {
                    var options = new List <QueryOption>
                    {
                        new QueryOption("$search", $"\"{searchText}\""),
                        new QueryOption("$filter", "personType/class eq 'Person' and personType/subclass eq 'OrganizationUser'")
                    };
                    IUserPeopleCollectionPage peopleList = await graphClient.Me.People.Request(options).GetAsync();

                    if (peopleList.Any())
                    {
                        List <Person> searchResult = peopleList.ToList();

                        // Remove all selected items
                        foreach (Person selectedItem in Selections)
                        {
                            searchResult.RemoveAll(u => u.UserPrincipalName == selectedItem.UserPrincipalName);
                        }

                        SearchResultList.Clear();
                        var result = SearchResultLimit > 0
                            ? searchResult.Take(SearchResultLimit).ToList()
                            : searchResult;
                        foreach (var item in result)
                        {
                            SearchResultList.Add(item);
                        }

                        _searchResultListBox.Visibility = Visibility.Visible;
                    }
                    else
                    {
                        ClearAndHideSearchResultListBox();
                    }
                }
            }
            catch (Exception)
            {
            }
            finally
            {
                IsLoading = false;
            }
        }
Exemplo n.º 11
0
 private void ClearAndHideSearchResultListBox()
 {
     SearchResultList.Clear();
     _searchResultListBox.Visibility = Visibility.Collapsed;
 }
Exemplo n.º 12
0
 private void CloseSearch()
 {
     IsSearchAccountOpen = false;
     SearchResultList.Clear();
 }