public void Search() { using (var searchBox = new SearchBox()) { if (searchBox.ShowDialog(solution.GetComponent<IMainWindow>()) == DialogResult.OK) { IEnumerable<Issue> issues = null; try { issues = this.PerformSearch(); } catch (Exception exception) { } var model = this.PrepareTreeModel(issues); var controller = new YouTrackTreeViewController(this.solution, model); var browserPanel = new YouTrackTreeModelPanel(controller); var toolWindowManager = solution.GetComponent<ToolWindowManager>(); var descriptor = solution.GetComponent<YouTrackToolWindowDescriptor>(); var toolWindowClass = toolWindowManager.Classes[descriptor]; var toolWindowInstance = toolWindowClass.RegisterInstance(_lifetime, "EMPTY TITLE", null, (lifetime, instance) => browserPanel); toolWindowInstance.Lifetime.AddAction(() => browserPanel.Dispose()); toolWindowInstance.EnsureControlCreated().Show(); } } }
private async void Location_SuggestionsRequested(SearchBox sender, SearchBoxSuggestionsRequestedEventArgs args) { if (geocodeTcs != null) geocodeTcs.Cancel(); geocodeTcs = new CancellationTokenSource(); if (args.QueryText.Length > 3) { try { var geo = new OnlineLocatorTask(serviceUri); var deferral = args.Request.GetDeferral(); var result = await geo.FindAsync(new OnlineLocatorFindParameters(args.QueryText) { MaxLocations = 5, OutSpatialReference = SpatialReferences.Wgs84 }, geocodeTcs.Token); if (result.Any() && !args.Request.IsCanceled) { var imageSource = Windows.Storage.Streams.RandomAccessStreamReference.CreateFromUri(new Uri("ms-appx:///Assets/blank.png")); foreach (var item in result) args.Request.SearchSuggestionCollection.AppendResultSuggestion(item.Name, "", item.Extent.ToJson(), imageSource, ""); } deferral.Complete(); } catch { } } }
private void OnQuerySubmitted(SearchBox sender, SearchBoxQuerySubmittedEventArgs args) { _searchBox.QueryText = ""; var hamburger = sender.GetVisualParentOfType<Hamburger>(); hamburger.IsPaneOpen = false; }
private void SearchBox_QuerySubmitted(SearchBox sender,SearchBoxQuerySubmittedEventArgs args) { if (string.IsNullOrEmpty(args.QueryText)) return; Messenger.Default.Send(new NotificationMessage<string>(this, args.QueryText, "SearchQuery")); }
public ArtistInfo(InfoBar info_bar) : base(info_bar) { Viewport view = new Viewport (); SearchBox search_box = new SearchBox (); ScrolledWindow scroll = new ScrolledWindow (); box.PackStart (scroll, true, true, 0); box.PackStart (new HSeparator (), false ,false, 0); box.PackStart (search_box, false, true, 0); artist_box.PackStart (artist_header.DisplayWidget, false, false, 0); artist_box.PackStart (content_tabs.DisplayWidget, true, true, 0); artist_box.BorderWidth = 20; content_tabs.AddContent (new SimilarArtists(this), "Similar Artists"); content_tabs.AddContent (new TopTracks(this), "Top Tracks"); content_tabs.AddContent (new TopAlbums(this), "Top Albums"); content_tabs.AddContent (new SimilarTracks()); content_tabs.AddContent (new AlbumDetails(this)); tabs.ShowTabs = false; tabs.ShowBorder = false; tabs.AppendPage (new ArtistInfoHelp (), null); tabs.AppendPage (artist_box, null); scroll.ShadowType = ShadowType.None; scroll.Add (view); view.ShadowType = ShadowType.None; view.Add (tabs); search_box.Search += search; content_tabs.ContentChanged += content_changed; }
public void basic_searchbox_render() { var html = new SearchBox("foo").ToString(); html.ShouldHaveHtmlNode("foo") .ShouldBeNamed(HtmlTag.Input) .ShouldHaveAttribute(HtmlAttribute.Type).WithValue(HtmlInputType.Search); }
public Lyrics(InfoBar info_bar) : base(info_bar) { Viewport view = new Viewport (); SearchBox search_box = new SearchBox (); ScrolledWindow scroll = new ScrolledWindow (); box.PackStart (scroll, true, true, 0); box.PackStart (new HSeparator (), false ,false, 0); box.PackStart (search_box, false, true, 0); lyrics_box.PackStart (content_tabs.DisplayWidget, true, true, 0); lyrics_box.BorderWidth = 20; tabs.ShowTabs = false; tabs.ShowBorder = false; tabs.AppendPage (new LyricsHelp (), null); tabs.AppendPage (lyrics_box, null); content_tabs.AddContent (new SongLyrics ()); content_tabs.AddContent (new SearchArtist (this)); scroll.ShadowType = ShadowType.None; scroll.Add (view); view.ShadowType = ShadowType.None; view.Add (tabs); search_box.Search += search; }
async void searchBox_QuerySubmitted(SearchBox sender, SearchBoxQuerySubmittedEventArgs args) { string massive_text = String.Empty; this.Hey.Text = "(1) paraphrasing sentences..."; // Get a JsonArray of paraphrased sentences var paraphrases = await SNCT.Rephrasing.GetParaphrases(sender.QueryText, 5); foreach (var query in paraphrases) { this.Hey.Text = "(2) getting Bing results for \"" + query.GetString() + "\"..."; // get the string from the JsonArray string q = query.GetString(); // Grab the first result (to be changed) this.Results.Add((await SNCT.BingProvider.GetResultsForQuery(q))[0]); } this.Hey.Text = "(3) assembling giant text..."; foreach (var result in this.Results) { // Add the extracted text to our giant blob massive_text += await SNCT.AlchemyProvider.URLGetText(result.Url); } // get an string answer from Sam's stuff :) this.Hey.Text = "(4) reading giant text..."; List<String> paraphrases_list = new List<String>(); foreach(var query in paraphrases) {paraphrases_list.Add(query.GetString());} SortedDictionary<String, double> answer = await Finder.answer(massive_text, paraphrases_list.ToArray(), 5); foreach(var a in answer) { this.Hey.Text = "(5) outputting answers..."; this.Answers.Add(new Answer(a.Key==""?"hey!":a.Key, a.Value)); } this.DataContext = this.Answers; }
public void UITheory(string value) { var ele = new SearchBox(); ele.Visibility = Visibility.Collapsed; ele.QueryText = value; Assert.Equal(3, ele.QueryText.Length); }
private void SearchBox_QuerySubmitted(SearchBox sender, SearchBoxQuerySubmittedEventArgs args) { var vm = (Domain.ViewModels.BaseViewModel)this.DataContext; iFixit.Domain.AppBase.Current.SearchTerm = args.QueryText; var previousContent = Window.Current.Content; var frame = previousContent as Frame; frame.Navigate(typeof(Views.SearchResult), args.QueryText); Window.Current.Content = frame; }
private async void SearchBoxEventsSuggestionsRequested(SearchBox box, SearchBoxSuggestionsRequestedEventArgs e) { if ( ! string.IsNullOrEmpty(e.QueryText)) { var suggestions = (await pollItunesWithNewQuery(box.QueryText)).ToList(); DefaultViewModel["Items"] = suggestions; } }
private static void CleanSuggestionRequestedEventHandlers(SearchBox searchBox) { TypedEventHandler<SearchBox, SearchBoxSuggestionsRequestedEventArgs> eventHandler; if (_suggestionRequestedEventHandlers.TryGetValue(searchBox, out eventHandler)) { searchBox.SuggestionsRequested -= eventHandler; _suggestionRequestedEventHandlers.Remove(searchBox); } }
public void SomethingNotOnUIThreadThrows() { Assert.Throws<Exception>(() => { var ele = new SearchBox(); ele.Visibility = Visibility.Collapsed; }); }
public SearchBoxHandler(SearchBox searchBox) { SearchBox = searchBox; SearchBox.QueryChanged += SearchBox_QueryChanged; SearchBox.QuerySubmitted -= SearchBox_QuerySubmitted; SearchBox.QuerySubmitted += SearchBox_QuerySubmitted; DataHolder.Instance.PropertyChanged += DataHolder_PropertyChanged; SearchBox.QueryText = DataHolder.Instance.QueryString ?? ""; }
public async void DoSomethingOnUIThread() { var ele = new SearchBox(); ele.Visibility = Visibility.Collapsed; ele.QueryText = "foo"; Assert.Equal("foo", ele.QueryText); await Task.Delay(20); ele.QueryText = "bar"; Assert.Equal("bar", ele.QueryText); }
async void searchBox_QuerySubmitted(SearchBox sender, SearchBoxQuerySubmittedEventArgs args) { string massive_text = String.Empty; SBSearchStep1.Begin(); SBSearchStep1.Completed += (_, __) => { this.Results.Clear(); this.Answer = String.Empty; //this.Answers.Clear(); }; // Get a JsonArray of paraphrased sentences var paraphrases = await SNCT.Rephrasing.GetParaphrases(sender.QueryText, 5); await System.Threading.Tasks.Task.Delay(1000); SBSearchStep2.Begin(); var paraphrases_list = new List<string>(); foreach (var query in paraphrases) { // get the string from the JsonArray string q = query.GetString(); paraphrases_list.Add(q); // Grab the first result (to be changed) this.Results.Add((await SNCT.BingProvider.GetResultsForQuery(q))[0]); } SBSearchStep3.Begin(); for (var i = 0; i < this.Results.Count; i++) { // Add the extracted text to our giant blob massive_text += await SNCT.AlchemyProvider.URLGetText(this.Results[i].Url); } SBSearchStep4.Begin(); // get an string answer from Sam's stuff :) var answer = await Finder.answer(massive_text, paraphrases_list.ToArray(), 5); // get the ordereddict to sort these for us--it sorts by increasing Key (aka the sentence score [double]) var ordered_answers = new SortedDictionary<double, string>(); foreach (var a in answer) { // we actually want the higher scores to be first, so lets fudge it instead of writing our own comparator ordered_answers.Add(100.0 - a.Value, a.Key.Trim()); } this.Answer = ordered_answers.ElementAt(0).Value + "\n\n" + ordered_answers.ElementAt(1).Value + "\n\n" + ordered_answers.ElementAt(2).Value; this.DataContext = this.Answer; ShowResultsStoryboard.Begin(); }
private static async void GetSuggestions(SearchSuggestionsRequestDeferral deferral, SearchBox sender, SearchBoxSuggestionsRequestedEventArgs args) { try { var provider = GetProvider(sender); var query = args.QueryText; var suggestions = await Task.Run(() => provider.GetSuggestions(CancellationToken.None, query)); var visitor = new AppendToSearchSuggestionCollectionVisitor(args.Request.SearchSuggestionCollection); foreach (var searchSuggestion in suggestions) { searchSuggestion.Accept(visitor); } deferral.Complete(); } catch (Exception ex) { Debug.WriteLine(ex); } }
private void InitSearchBox() { if (this.searchBox == null) { this.searchBox = new SearchBox(this) { SearchModes = new string[] { "All", "Global", "Local", "System" }, HasPopupSearchModes = true }; SearchBox expr_51 = this.searchBox; expr_51.SearchChanged = (EditorApplication.CallbackFunction)Delegate.Combine(expr_51.SearchChanged, new EditorApplication.CallbackFunction(this.UpdateSearchResults)); this.searchBox.Focus(); } }
private void ClearButton_OnClick(object sender, RoutedEventArgs e) { string module = $"{_product}.{_class}.{MethodBase.GetCurrentMethod().Name}()"; try { SearchBox.Clear(); SearchButton.IsEnabled = true; ClearButton.IsEnabled = false; ICollectionView filteredView = CollectionViewSource.GetDefaultView((this.MainGrid.DataContext as LibraryViewModel).ChemistryItems); filteredView.Filter = null; } catch (Exception ex) { using (var form = new ReportError(Globals.Chem4WordV3.Telemetry, Globals.Chem4WordV3.WordTopLeft, module, ex)) { form.ShowDialog(); } } }
private async void mainSearchBox_QuerySubmitted(SearchBox sender, SearchBoxQuerySubmittedEventArgs args) { // Show Progress Ring progressRing.IsActive = true; // Reset DataContext and Lists videos_data = null; videos_data = new ObservableCollection <Video>(); DataContext = videos_data; videosTitle.Text = "Videos - " + mainSearchBox.QueryText; var searchChannelVideosRequest = youtubeService.Search.List("snippet"); searchChannelVideosRequest.Q = mainSearchBox.QueryText; searchChannelVideosRequest.ChannelId = WinBetaChannelId; searchChannelVideosRequest.MaxResults = 25; var searchChannelVideosResponse = await searchChannelVideosRequest.ExecuteAsync(); foreach (var videoItem in searchChannelVideosResponse.Items) { if (videoItem.Id.Kind == "youtube#video") { // Create a video object to pass into the data context Video video = new Video() { Title = videoItem.Snippet.Title, // Video Title Thumbnail = GetVideoThumbnail(videoItem.Snippet.Thumbnails), // Video thumbnail <- This function gets the highest quality avaliable Date = ConvertVideoDateTime(videoItem.Snippet.PublishedAt), // Get the published date (formated and converted to correct time zone) Id = videoItem.Id.VideoId }; // Add video to data context list videos_data.Add(video); } } // Hide Progress Ring progressRing.IsActive = false; }
async void searchBox_QuerySubmitted(SearchBox sender, SearchBoxQuerySubmittedEventArgs args) { string massive_text = String.Empty; this.Hey.Text = "(1) paraphrasing sentences..."; // Get a JsonArray of paraphrased sentences var paraphrases = await SNCT.Rephrasing.GetParaphrases(sender.QueryText, 5); foreach (var query in paraphrases) { this.Hey.Text = "(2) getting Bing results for \"" + query.GetString() + "\"..."; // get the string from the JsonArray string q = query.GetString(); // Grab the first result (to be changed) this.Results.Add((await SNCT.BingProvider.GetResultsForQuery(q))[0]); } this.Hey.Text = "(3) assembling giant text..."; foreach (var result in this.Results) { // Add the extracted text to our giant blob massive_text += await SNCT.AlchemyProvider.URLGetText(result.Url); } // get an string answer from Sam's stuff :) this.Hey.Text = "(4) reading giant text..."; List <String> paraphrases_list = new List <String>(); foreach (var query in paraphrases) { paraphrases_list.Add(query.GetString()); } SortedDictionary <String, double> answer = await Finder.answer(massive_text, paraphrases_list.ToArray(), 5); foreach (var a in answer) { this.Hey.Text = "(5) outputting answers..."; this.Answers.Add(new Answer(a.Key == ""?"hey!":a.Key, a.Value)); } this.DataContext = this.Answers; }
async private void filterBox_SuggestionsRequested(SearchBox sender, SearchBoxSuggestionsRequestedEventArgs args) { try { if (((InspectionDetailsPageViewModel)this.DataContext).CDTaskList != null) { var deferral = args.Request.GetDeferral(); if (!string.IsNullOrEmpty(args.QueryText)) { var searchSuggestionList = new List <string>(); foreach (var task in ((InspectionDetailsPageViewModel)this.DataContext).CDTaskList) { foreach (var propInfo in task.GetType().GetRuntimeProperties()) { if (this.suggestLookup.Contains(propInfo.Name)) { var propVal = Convert.ToString(propInfo.GetValue(task)); if (propVal.ToLowerInvariant().Contains(args.QueryText)) { if (!searchSuggestionList.Contains(propVal)) { searchSuggestionList.Add(propVal); } } } } } args.Request.SearchSuggestionCollection.AppendQuerySuggestions(searchSuggestionList); } else { this.sfDataGrid.ItemsSource = ((InspectionDetailsPageViewModel)this.DataContext).CDTaskList; } deferral.Complete(); } } catch (Exception ex) { AppSettings.Instance.ErrorMessage = ex.Message; } }
SearchBox CreateSearchBox() { var filterText = new SearchBox { PlaceholderText = "Filter" }; filterText.TextChanged += (s, e) => { var filterItems = (filterText.Text ?? "").Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); if (filterItems.Length == 0) { filteredCollection.Filter = null; } else { filteredCollection.Filter = i => { // Every item in the split filter string should be within the Text property for (int i1 = 0; i1 < filterItems.Length; i1++) { string filterItem = filterItems[i1]; if (i.Text.IndexOf(filterItem, StringComparison.OrdinalIgnoreCase) == -1) { return(false); } } return(true); } }; }; return(filterText); } Control CreateBorderType(GridView grid) { var borderType = new EnumDropDown <BorderType>(); borderType.SelectedValueBinding.Bind(grid, g => g.Border); return(borderType); }
private async void searchUserBox_QuerySubmitted(SearchBox sender, SearchBoxQuerySubmittedEventArgs args) { string type = ((ListBoxItem)chooseUserTypeCbox.SelectedItem).Content.ToString(); if (type == "All") { type = "None"; } UserType enumType; Enum.TryParse(type, out enumType); string searchBy = ((ListBoxItem)searchUserByCbox.SelectedItem).Content.ToString(); string typedWord = searchUserBox.QueryText; try { switch (searchBy) { case ("All"): { _users = userManager.GetAllUsers(enumType); showResultLbox.ItemsSource = _users; break; } case ("Name"): { _users = userManager.GetUsersByName(typedWord, enumType); showResultLbox.ItemsSource = _users; break; } default: break; } } catch (InvalidOperationException) { await new MessageDialog("User type is invalid").ShowAsync(); } }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Groups_Loaded(object sender, RoutedEventArgs e) { ActiveDirectory.Connector.RunWorkerCompleted += Group_Fetcher_Completed; ActiveDirectory.Connector.ProgressChanged += Group_Fetcher_ProgressChanged; ActiveDirectory.Group_Fetcher.RunWorkerCompleted += Group_Fetcher_Completed; ActiveDirectory.Group_Fetcher.ProgressChanged += Group_Fetcher_ProgressChanged; UpdateGroupButtons(); if (!ReferenceEquals(ActiveDirectory.Groups, null) && ActiveDirectory.IsConnected) { GroupList.ItemsSource = ActiveDirectory.Groups; SearchBox.Focus(); ICollectionView GroupView = CollectionViewSource.GetDefaultView(ActiveDirectory.Groups); new TextSearchFilter(GroupView, SearchBox); } else { ExitAD(); } }
private void Page_Loaded(object sender, RoutedEventArgs e) { WelMsg.Content = "اهلا بك يا " + AccountsTable.UserName; BillNo.Text = BillsTable.BillNO.ToString(); SearchBox.Focus(); if (AccountsTable.IsAdmin() == false) { MName.IsReadOnly = true; MSS.IsReadOnly = true; MType.IsEditable = false; MType.IsReadOnly = true; MExist.IsReadOnly = true; MPrice.IsReadOnly = true; } //custom UI changes for XP if (Environment.OSVersion.Version.Build <= 2600) { Client.FontSize = 10; } LoadSup(); }
//public override string Url => "http://www.google.com/"; //public override string Url => "https://www.yahoo.com/"; //public override string Url => "http://www.aol.com/"; public void Search(string textToType) { SearchBox.Clear(); SearchBox.SendKeys(textToType + Keys.Enter); //GoButton.Click(); ////var link = WrappedDriver.FindElement(By.PartialLinkText("Homepage")); //////var jsToBeExecuted = $"window.scroll(0, {link.Location.Y});"; //////((IJavaScriptExecutor)WrappedDriver).ExecuteScript(jsToBeExecuted); ////var wait = new WebDriverWait(WrappedDriver, TimeSpan.FromMinutes(1)); //////System.Threading.Thread.Sleep(TimeSpan.FromSeconds(8)); ////var clickableElement = wait.Until(ExpectedConditions.ElementToBeClickable(By.PartialLinkText("Homepage"))); ////clickableElement.Click(); //System.Threading.Thread.Sleep(TimeSpan.FromSeconds(8)); //WrappedDriver.SwitchTo().Window(WrappedDriver.WindowHandles.Last()); WebDriverWait wait = new WebDriverWait(WrappedDriver, TimeSpan.FromSeconds(10)); wait.Until(ExpectedConditions.PresenceOfAllElementsLocatedBy(By.Id("b_tween"))); bool bis = ResultsCountDiv.Text.Contains(ResultsCountDiv.Text); //Assert.IsTrue(bis); }
/* public void datas(DataTable dt) * { * this.Show(); * this.dataGridView.DataSource = dt; * * }*/ private void ViewTopic_Load(object sender, EventArgs e) { if (conn.State.ToString() == "Closed") { conn = DB_Connection.GetConnection(); conn.Open(); } string query = "Select * from Topic"; SqlDataAdapter _sqlda = new SqlDataAdapter(query, conn); DataTable dt = new DataTable(); _sqlda.Fill(dt); SearchBox.DataSource = dt; SearchBox.Hide(); Searchbtn.Hide(); SearchBox.ValueMember = "TopicID"; SearchBox.DisplayMember = "Topic"; SearchBox.SelectedIndex = -1; }
public SearchWindow(string s, List <Entity> entities) { _entities = new List <Entity>(entities); InitializeComponent(); HaClientContext.AddStateChangeListener(this, updatedEntity => { var index = _entities.FindIndex(e => e.EntityId == updatedEntity.EntityId); if (index >= 0) { _entities[index] = updatedEntity; Dispatcher.Invoke(() => UpdateFoundList(null, null)); } }); if (s.Length == 1) { SearchBox.Text = s; } SearchBox.CaretIndex = int.MaxValue; SearchBox.Focus(); }
/// <summary> /// SearchBoxEventsSuggestionsRequested /// </summary> /// <param name="sender"></param> /// <param name="args"></param> public async void SearchBoxEventsSuggestionsRequested(SearchBox sender, SearchBoxSuggestionsRequestedEventArgs args) { //DetermineSearchBoxWidth(); var queryText = args.QueryText; var request = args.Request; var deferral = request.GetDeferral(); try { var source = await FavoritesDataSyncManager.GetInstance(DocumentLocation.Roaming); source.GetSeachSuggestions(queryText, request.SearchSuggestionCollection); } catch (Exception) { } finally { deferral.Complete(); } }
private void OnSearchQuerySubmitted(SearchBox searchBox, SearchBoxQueryChangedEventArgs searchBoxQueryChangedEventArgs) { if (SearchToggleButton.IsChecked == true) { SearchBox.Visibility = Visibility.Collapsed; SearchToggleButton.Visibility = Visibility.Visible; SearchToggleButton.IsChecked = false; } var categoriesList = SampleManager.Current.FullTree.Search(SampleSearchFunc); if (categoriesList == null) { categoriesList = new SearchableTreeNode("Search", new[] { new SearchableTreeNode("No results", new List <object>()) }); } Categories.ItemsSource = categoriesList.Items; if (categoriesList.Items.Any()) { Categories.SelectedIndex = 0; } }
private void FilterByClass(object sender, RoutedEventArgs e) { var c = (Class)((FrameworkElement)sender).DataContext; var view = DC.AbnormalitiesView; if (SearchBox.Text.Length > 0) { SearchBox.Clear(); view.Filter = null; } if (view.Filter == null || c != _currentFilter) { view.Filter = o => ((GroupAbnormalityVM)o).Classes.Any(x => x.Class == c && x.Selected); _currentFilter = c; } else { view.Filter = null; _currentFilter = Class.None; } view.Refresh(); foreach (var x in ClassesButtons.Items) { var cp = (ContentPresenter)ClassesButtons.ItemContainerGenerator.ContainerFromItem(x); var btn = cp.ContentTemplate.FindName("Btn", cp) as Button; if (btn?.DataContext == null) { continue; } var dc = (Class)btn.DataContext; if (dc == _currentFilter) { btn.Opacity = 1; } else { btn.Opacity = .3; } } }
public ActionResult SearchByXmlId(string xmlId, string domain, int langId, int siteLangId) { // site language force refresh Session["LanguageId"] = siteLangId; var langModelCookie = new HttpCookie("sitelang"); langModelCookie.Value = InterfaceLanguages.GetLanguageById(siteLangId).Code; langModelCookie.Expires.AddDays(365); Response.Cookies.Set(langModelCookie); // search params SearchBox sb = new SearchBox(langId); string classifierGuid = Classifiers.GetClassifierIdByXmlId(xmlId); sb.ClassifierFilter = new Guid(classifierGuid); sb.ByXmlId = true; switch (domain.ToLower()) { case "eucl": sb.Cases = new SearchCases(langId); sb.Cases.CaseLawType = CaseLawType.EU; break; case "natcl": sb.Cases = new SearchCases(langId); sb.Cases.CaseLawType = CaseLawType.National; break; case "eul": sb.Law = new SearchLaw(langId); break; case "natl": sb.Law = new SearchLaw(langId); break; default: break; } // search title var classifierModel = ClassificatorService.Current.TryGetTreeByGuid(sb.ClassifierFilter.ToString()); if (classifierModel != null) // S.P.: correct classifiers population should always have returned a value but I don't trust it :D { sb.ClassifierFilterTitle = classifierModel.LanguageVariantsWithHints[siteLangId.ToString()].Title; } return(Search(sb)); }
private async void SearchBox_SuggestionsRequested(SearchBox sender, SearchBoxSuggestionsRequestedEventArgs args) { var viewModel = DataContext as MainViewModel; if (viewModel == null) { return; } // make sure the search string isn't null, less than 3 chars, or more than 100 chars. // the minimum of 3 will help with suggestion api performance. it also has a hard limit of 100 chars if (viewModel.SearchString == null || viewModel.SearchString.Length < 3 || viewModel.SearchString.Length > 100) { return; } var deferral = args.Request.GetDeferral(); try { // get the suggestions var suggestions = await viewModel.SearchSuggest(); // append all suggestions to the search box suggestions box args.Request.SearchSuggestionCollection.AppendQuerySuggestions(suggestions.Select(s => s.Text)); args.Request.SearchSuggestionCollection.AppendSearchSeparator("Top Tweeters"); var imageUri = new Uri("ms-appx:///Assets/Azure.png"); var imageRef = RandomAccessStreamReference.CreateFromUri(imageUri); foreach (var suggestResult in suggestions) { args.Request.SearchSuggestionCollection.AppendResultSuggestion(suggestResult.Document.ScreenName, suggestResult.Document.Followers + " followers", "", imageRef, ""); } } finally { deferral.Complete(); } }
public GridViewSection() { var layout = new DynamicLayout(); layout.AddRow(new Label { Text = "Default" }, Default()); layout.AddRow(new Label { Text = "No Header,\nNon-Editable" }, NoHeader()); #if DESKTOP layout.BeginHorizontal(); layout.Add(new Label { Text = "Context Menu\n&& Multi-Select\n&& Filter" }); layout.BeginVertical(); layout.Add(filterText = new SearchBox { PlaceholderText = "Filter" }); var withContextMenuAndFilter = WithContextMenuAndFilter(); layout.Add(withContextMenuAndFilter); layout.EndVertical(); layout.EndHorizontal(); var selectionGridView = Default(addItems: false); layout.AddRow(new Label { Text = "Selected Items" }, selectionGridView); // hook up selection of main grid to the selection grid withContextMenuAndFilter.SelectionChanged += (s, e) => { var items = new DataStoreCollection(); items.AddRange(withContextMenuAndFilter.SelectedItems); selectionGridView.DataStore = items; }; #endif Content = layout; }
private void SearchBoxControlOnSuggestionsRequested(SearchBox sender, SearchBoxSuggestionsRequestedEventArgs args) { if (string.IsNullOrWhiteSpace(args.QueryText)) { return; } var collection = args.Request.SearchSuggestionCollection; var results = App.ItemList.Where(i => i.Text.StartsWith(args.QueryText, StringComparison.CurrentCultureIgnoreCase)) .ToList(); bool separator = false; foreach (var item in results) { separator = true; collection.AppendQuerySuggestion(item.Text); } if (separator) { collection.AppendSearchSeparator("Matches"); } if (args.QueryText.Length > 2) { foreach (var item in results) { var uri = new Uri("ms-appx:///Assets/StoreLogo.scale-100.png"); var image = RandomAccessStreamReference.CreateFromUri(uri); collection.AppendResultSuggestion( item.Id.ToString(), item.Text, item.Id.ToString(), image, item.Text); } } }
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; }
private void channelSearch_QuerySubmitted(SearchBox sender, SearchBoxQuerySubmittedEventArgs args) { var httpClient = new HttpClient(); string query = "https://www.googleapis.com/youtube/v3/search?part=snippet&type=channel&q=" + channelSearch.QueryText + "&safeSearch=strict&key=" + Constants.ApiKey; string result = httpClient.GetStringAsync(query).Result; JObject jObject = JObject.Parse(result); var searchChannelsList = new ObservableCollection <Channel>(); foreach (var channel in jObject["items"]) { Channel channelSearchResult = new Channel((string)channel["id"]["channelId"], (string)channel["snippet"]["title"], (string)channel["snippet"]["description"], (string)channel["snippet"]["thumbnails"]["default"] ["url"]); searchChannelsList.Add(channelSearchResult); } seachViewSource.Source = searchChannelsList; }
public void buildControl() { // ! exportBtn = new ShapeButton(); exportBtn.Text = "导出"; this.Controls.Add(exportBtn); // searchBox = new SearchBox(); this.Controls.Add(searchBox); // addBtn = new ShapeButton(); addBtn.Text = "增加"; this.Controls.Add(addBtn); // deleBtn = new ShapeButton(); deleBtn.Text = "删除"; this.Controls.Add(deleBtn); // resetPassword = new ShapeButton(); resetPassword.Text = "重置密码"; this.Controls.Add(resetPassword); // customLv = new CXListView(); initListVHeader(customLv); this.Controls.Add(customLv); customLv.FullRowSelect = true; customLv.GridLines = true; // pagePanel = new PageSwitchPanel(); this.Controls.Add(pagePanel); }
private async void Location_QuerySubmitted(SearchBox sender, SearchBoxQuerySubmittedEventArgs args) { if (geocodeTcs != null) geocodeTcs.Cancel(); geocodeTcs = new CancellationTokenSource(); try { var geo = new OnlineLocatorTask(serviceUri); var result = await geo.FindAsync(new OnlineLocatorFindParameters(args.QueryText) { MaxLocations = 5, OutSpatialReference = SpatialReferences.Wgs84 }, geocodeTcs.Token); if (result.Any()) { Location.QueryText = result.First().Name; if (LocationPicked != null) LocationPicked(this, result.First().Extent); } } catch { } }
private async void MySearchBox_QuerySubmitted(SearchBox sender, SearchBoxQuerySubmittedEventArgs args) { Items.Clear(); Error.Text = ""; string tempUnit = ""; if (localSettings.Values["temp"] == null) { tempUnit = "metric"; } else { tempUnit = localSettings.Values["temp"].ToString(); } try { //get list of cities based on selected item result = await CityProxy.GetWeatherByCityName(args.QueryText, tempUnit); if (result.list.Count > 0) { //add to the list of ObservableCollection foreach (ListCity c in result.list) { Items.Add(c); } } else { Error.Text = "No results"; } } catch (Exception) { Error.Text = "No results"; } }
public void SetFocus() { SearchBox.IsTabStop = true; //var result = SearchBox.Focus(FocusState.Keyboard); // slightly delay setting focus Task.Run(async() => { await Task.Delay(4000).ConfigureAwait(false); return(Dispatcher.RunAsync(CoreDispatcherPriority.Low, () => { var result = SearchBox.Focus(FocusState.Programmatic); var(a, b, c, d, e) = (SearchBox.Visibility, SearchBox.IsEnabled, SearchBox.IsTabStop, SearchBox.IsLoaded, SearchBox.FocusState); Logger.Info( $"Set Focus to SearchBox successful: {result} (Visibility: {a}, Enabled: {b}, TabStob: {c}, Loaded: {d}, FocusState: {e})"); })); });
private async void OnSuggestionsRequested(SearchBox sender, SearchBoxSuggestionsRequestedEventArgs args) { if (args.QueryText.Length < 5) { return; } var deferral = args.Request.GetDeferral(); var results = await searchService.SearchAsync(args.QueryText); if (args.Request.IsCanceled) { return; } foreach (var result in results.Take(5)) { IRandomAccessStreamReference image = null; if (result.HasSmallThumbnail) { image = RandomAccessStreamReference.CreateFromUri(new Uri(result.SmallThumbnail, UriKind.Absolute)); } else { image = RandomAccessStreamReference.CreateFromUri(new Uri("ms-appx:///resources/images/mm_50x50.scale-100.jpg")); } args.Request.SearchSuggestionCollection.AppendResultSuggestion( result.Title, result.Authors, result.ItemLink, image, result.Title); } deferral.Complete(); }
private void InitialiseLabels(Orientation orientation) { var labelCount = 10; if (orientation == Orientation.Horizontal) { DockPanel.SetDock(SearchBox, Dock.Left); OptionsPanel.Orientation = Orientation.Horizontal; } else { // First measure how high the search box wants to be. SearchBox.Measure(new Size(double.MaxValue, double.MaxValue)); // Now find out how much space we have to lay out our labels. var availableSpace = MaxHeight // Start with the maximum window height - Padding.Top - Padding.Bottom // Subtract window padding - WindowDock.Margin.Top - WindowDock.Margin.Bottom // Subtract window dock margin - SearchBox.DesiredSize.Height // Subtract size of the search box (includes margins) - OptionsPanel.Margin.Top - OptionsPanel.Margin.Bottom; // Subtract the margins of the options panel var labelHeight = CalculateLabelHeight(); var labelFit = availableSpace / labelHeight; labelCount = (int)labelFit; if (!styleConfig.ScaleToFit) { var remainder = (labelFit - labelCount) * labelHeight; Log.Send($"Max height: {MaxHeight:F}, Available for labels: {availableSpace:F}, Total used by labels: {labelCount * labelHeight:F}, Remainder: {remainder:F}"); //MinHeight = MaxHeight; } } for (var i = 0; i < labelCount; i++) { var label = CreateLabel($"label_{i}"); AddLabel(label); } }
/// <summary>Initializes a new instance of the <see cref="SearchHamburgerItem"/> class.</summary> public SearchHamburgerItem() { _searchBox = new SearchBox(); _searchBox.Loaded += delegate { _searchBox.PlaceholderText = PlaceholderText; }; _searchBox.QuerySubmitted += OnQuerySubmitted; _searchBox.GotFocus += OnGotFocus; Content = _searchBox; Icon = new SymbolIcon(Symbol.Find); CanBeSelected = false; ShowContentIcon = false; Click += (sender, args) => { args.Hamburger.IsPaneOpen = true; args.Hamburger.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { _searchBox.Focus(FocusState.Programmatic); }); }; }
async private void filterBox_QuerySubmitted(SearchBox sender, SearchBoxQuerySubmittedEventArgs args) { var result = ((InspectionDetailsPageViewModel)this.DataContext).PoolofTasks; if (result != null) { try { this.detailsGrid.ItemsSource = result.Where(x => Convert.ToString(x.CaseNumber).Contains(args.QueryText) || Convert.ToString(x.CategoryType).Contains(args.QueryText) || Convert.ToString(x.Status).Contains(args.QueryText) || Convert.ToString(x.StatusDueDate).Contains(args.QueryText) || Convert.ToString(x.ContactName).Contains(args.QueryText) || Convert.ToString(x.CustomerName).Contains(args.QueryText) || Convert.ToString(x.ContactNumber).Contains(args.QueryText)); } catch (Exception ex) { AppSettings.Instance.ErrorMessage = ex.Message; } } }
internal void StartSearch(string startingText = null) { if (FocusManager.GetFocusedElement() == SearchBox.FindDescendant <TextBox>()) { return; } SearchBox.Focus(FocusState.Keyboard); var currentSearchText = SearchBox.Text; SearchBox.Text = string.Empty; if (!string.IsNullOrWhiteSpace(startingText)) { SearchBox.Text = startingText; } else { SearchBox.Text = currentSearchText; } }
private async void SearchBox_OnSuggestionsRequested(SearchBox sender, SearchBoxSuggestionsRequestedEventArgs e) { try { //Request deferral must be recieved to allow async search suggestion population var deferal = e.Request.GetDeferral(); // Add suggestions to Search Pane var destinations = await LocationsDataFetcher.Instance.FetchLocationsAsync(e.QueryText, false); var suggestions = destinations .OrderBy(location => location.City) .Take(5) .Select(location => location.City); e.Request.SearchSuggestionCollection.AppendQuerySuggestions(suggestions); deferal.Complete(); } catch (Exception) { } }
private void SearchBox_OnSearch(object sender, SearchEventArgs e) { SearchBox searchBox = sender as SearchBox; switch (searchBox.Name) { case "excelSearchBox": IsSearchingExcel = true; excelSearchKey = e.SearchText; FilterItems(excelListView); break; case "idSearchBox": IsSearchingId = true; idSearchKey = e.SearchText; FilterItems(idListView); break; default: break; } }
private void SearchBox_SuggestionsRequested(SearchBox sender, SearchBoxSuggestionsRequestedEventArgs args) { }
private void SearchBox_QueryChanged(SearchBox sender, SearchBoxQueryChangedEventArgs args) { int a = 0; a = a; }
private void SearchBox_QuerySubmitted(SearchBox sender, SearchBoxQuerySubmittedEventArgs args) { this.OUTPUT.ItemsSource = new SearchToShow(SearchBox.QueryText); this.AddButton.Visibility = Windows.UI.Xaml.Visibility.Visible; this.SelectAllButton.Visibility = Windows.UI.Xaml.Visibility.Visible; this.NotSelectAllButton.Visibility = Windows.UI.Xaml.Visibility.Visible; /* double H = Math.Floor(OUTPUT.RenderSize.Width / 300);//計算每頁數量 double W = Math.Floor(OUTPUT.RenderSize.Height / 200); double Page = H * W; PushSearchResult(true, (int)Page * 2);//輸出兩頁*/ }
private void Form1_Load(object sender, EventArgs e) { SpiderHost = new Spider.SpiderHost(new DummyService()); SpiderHost.Notify += SpiderHost_Notify; SpiderHost.RegistredAppTypes.Add("group", typeof(Apps.group)); SpiderHost.RegistredAppTypes.Add("internal", typeof(Apps.@internal)); SpiderHost.RegistredAppTypes.Add("playqueue", typeof(Apps.playqueue)); SpiderHost.RegistredAppTypes.Add("app", typeof(Apps.app)); SpiderHost.RegistredAppTypes.Add("artist", typeof(Apps.artist)); SpiderHost.RegistredAppTypes.Add("album", typeof(Apps.album)); SpiderHost.RegistredAppTypes.Add("search", typeof(Apps.search)); SpiderHost.RegistredAppTypes.Add("user", typeof(Apps.user)); tmrReload = new System.Windows.Forms.Timer(); listView = new SPListView(this.Stylesheet, SpiderHost); this.Controls.Add(SpiderHost); SpiderHost.Dock = DockStyle.Fill; this.Controls.Add(listView); listView.ItemInserted += listView_ItemInserted; listView.AddItem(new Uri("spotify:internal:home"), true); listView.AddItem("-", new Uri("spotify:internal:placeholder"), true); listView.ItemSelected += listView_ItemSelected; // this.SpiderHost.MusicService.ObjectsDelivered += MusicService_ObjectsDelivered; listView.ItemReordered += listView_ItemReordered; listView.Dock = DockStyle.Left; listView.Width = 270; this.SpiderHost.MusicService.RequestUserObjects(); this.SpiderHost.MusicService.PlaybackStarted += MusicService_PlaybackStarted; var panel = new AppHeader((PixelStyle)this.Stylesheet); panel.BackgroundImage = Properties.Resources.header; var panel2 = new AppHeader((PixelStyle)this.Stylesheet); panel2.BackgroundImage = Properties.Resources.footer; panel2.Dock = DockStyle.Bottom; panel.Dock = DockStyle.Top; panel2.Height = panel2.BackgroundImage.Height; panel2.MouseDown += panel2_MouseDown; panel.Height = panel.BackgroundImage.Height; infoBar = new infobar(this.Stylesheet); infoBar.Hide(); this.Controls.Add(infoBar); infoBar.Dock = DockStyle.Top; this.Controls.Add(panel); panel.MouseMove += panel_MouseMove; this.Controls.Add(panel2); searchBox = new SearchBox(); panel.Controls.Add(searchBox); searchBox.Left = 80; searchBox.Top = 26; searchBox.SearchClicked += searchBox_SearchClicked; // add some playlists }
public static void SetSearchBox(DependencyObject obj, SearchBox value) { obj.SetValue(SearchBoxProperty, value); }
private void SearchBox_OnQueryChanged(SearchBox sender, SearchBoxQueryChangedEventArgs args) { viewModel.DictionaryViewModel.Filter = sender.QueryText; }
private void search_QuerySubmitted(SearchBox sender, SearchBoxQuerySubmittedEventArgs args) { this.Frame.Navigate(typeof(HubPage), search.QueryText); }
private void SearchBox_QuerySubmitted(SearchBox sender, SearchBoxQuerySubmittedEventArgs args) { foreach (BubblePushpin bubblePushpin in _bubblePushpins) { // an empty search box acts as a 'reset' button, clear all selections if (string.IsNullOrWhiteSpace(args.QueryText)) { bubblePushpin.Searched = false; } else { bubblePushpin.Searched = bubblePushpin.Details.IndexOf(args.QueryText, StringComparison.OrdinalIgnoreCase) >= 0; } } }
private void SearchContact(SearchBox sender, SearchBoxQueryChangedEventArgs args) { if (DB_ContactList != null) { this.lista.ItemsSource = DB_ContactList.Where(x => x.Model.C_nome.ToUpper().Contains(findcontact.QueryText.ToUpper())); } }
private async void mainSearchBox_QuerySubmitted(SearchBox sender, SearchBoxQuerySubmittedEventArgs args) { // Show Progress Ring progressRing.IsActive = true; // Reset DataContext and Lists videos_data = null; videos_data = new ObservableCollection<Video>(); DataContext = videos_data; videosTitle.Text = "Videos - " + mainSearchBox.QueryText; var searchChannelVideosRequest = youtubeService.Search.List("snippet"); searchChannelVideosRequest.Q = mainSearchBox.QueryText; searchChannelVideosRequest.ChannelId = WinBetaChannelId; searchChannelVideosRequest.MaxResults = 25; var searchChannelVideosResponse = await searchChannelVideosRequest.ExecuteAsync(); foreach (var videoItem in searchChannelVideosResponse.Items) { if (videoItem.Id.Kind == "youtube#video") { // Create a video object to pass into the data context Video video = new Video() { Title = videoItem.Snippet.Title, // Video Title Thumbnail = GetVideoThumbnail(videoItem.Snippet.Thumbnails), // Video thumbnail <- This function gets the highest quality avaliable Date = ConvertVideoDateTime(videoItem.Snippet.PublishedAt), // Get the published date (formated and converted to correct time zone) Id = videoItem.Id.VideoId }; // Add video to data context list videos_data.Add(video); } } // Hide Progress Ring progressRing.IsActive = false; }
private async void searchPane_QuerySubmitted(SearchBox sender, SearchBoxQuerySubmittedEventArgs args) { //throw new NotImplementedException(); myMap.Children.Clear(); //Logic for geaocding the query text if (!string.IsNullOrWhiteSpace(args.QueryText)) { await new MessageDialog(args.QueryText).ShowAsync(); Uri geocodeUri = new Uri( string.Format("http://dev.virtualearth.net/REST/v1/Locations?q={0}&c={1}&key={2}", Uri.EscapeUriString(args.QueryText), args.Language, myMap.Credentials)); //Get response from Bing Maps REST services Response r = await GetResponse(geocodeUri); if(r != null && r.ResourceSets != null && r.ResourceSets.Length > 0 && r.ResourceSets[0].Resources != null && r.ResourceSets[0].Resources.Length > 0) { LocationCollection locations = new LocationCollection(); int i = 1; foreach(BingMapsRESTService.Common.JSON.Location l in r.ResourceSets[0].Resources) { //Get the Location of each result Bing.Maps.Location location = new Bing.Maps.Location(l.Point.Coordinates[0], l.Point.Coordinates[1]); //Create a pushpin each location Pushpin pin = new Pushpin() { Tag = l.Name, Text = i.ToString() }; i++; //Add a tapped event that will displau the name of the location pin.Tapped += async (s, a) => { var p = s as Pushpin; await new MessageDialog(p.Tag as string).ShowAsync(); }; //Set the location of the pushpin MapLayer.SetPosition(pin, location); //add th pushpin to the map myMap.Children.Add(pin); //Add the coordinates of the location to a location collection locations.Add(location); }//End foreach //set the map view based on the location collection myMap.SetView(new LocationRect(locations)); }//End IF else { await new MessageDialog("Nenhum resultado encontrado..").ShowAsync(); } } }