private async void SearchButtonOnClick(object sender, RoutedEventArgs e) { ChangeBgImage(); if (CurrentSearch?.IsSearching == true) { CurrentSearch.StopSearch(); ChangeSearchVisual(false); return; } ChangeSearchVisual(true); StatusTextBlock.Text = ""; var para = SearchControl.GetSearchPara(); CurrentSearch = new SearchSession(Settings, para); para.CurrentSearch = CurrentSearch; SiteTextBlock.Text = CurrentSearch.GetCurrentSearchStateText(); Settings.HistoryKeywords.AddHistory(CurrentSearch.CurrentSearchPara.Keyword, Settings); MoeExplorer.ResetVisual(); var t = await CurrentSearch.TrySearchNextPageAsync(); if (t.IsCanceled || t.Exception != null) { if (!CurrentSearch.IsSearching) { ChangeSearchVisual(false); } } else { ChangeSearchVisual(false); MoeExplorer.AddPage(CurrentSearch); } }
// Add a new char to current search, causes searc to fire private Task <Boolean> UpdateSearchText(AlphaInputViewModel viewModel) { var currentSearch = CurrentSearch; var indexOption = viewModel.CurrentIndexOption == null ? string.Empty : viewModel.CurrentIndexOption.Name; if (string.Compare(indexOption, "_") == 0) { indexOption = " "; } if (string.Compare(indexOption, "back") == 0) { if (CurrentSearch.Length > 0) { CurrentSearch = CurrentSearch.Substring(0, CurrentSearch.Length - 1); } } else { CurrentSearch = CurrentSearch + indexOption; } return(Task.FromResult(true)); }
private void ApplyConditionalCellFormatting(DataGridViewCell cell, SearchParams.TargetType targType) { var modified = false; if (CurrentSearch != null) { var matchText = cell.Value as string; if (matchText != null && CurrentSearch.Match(targType, matchText)) { cell.Style.BackColor = Color.GreenYellow; modified = true; } } if (ShowNullValuesAsGrayed && string.IsNullOrWhiteSpace(cell.Value as string)) { cell.Style.BackColor = Color.Gainsboro; modified = true; } if (!modified) { cell.Style.BackColor = dataGridView1.DefaultCellStyle.BackColor; } }
private void Start() { _allSearch = GameObject.Find("Canvas/ItemMenuCanvas/ClickedItemCanvas/VoiceCanvas/InsertAllPath/InputAllPath").GetComponent <AllSearch>(); _currentSearch = GameObject.Find("Canvas/ItemMenuCanvas/ClickedItemCanvas/VoiceCanvas/InsertCurrentPath/InputCurrentPath").GetComponent <CurrentSearch>(); _scrollRect = GameObject.Find("Canvas/ItemMenuCanvas/ClickedItemCanvas/VoiceCanvas/Scroll View").GetComponent <ScrollRect>(); _startDBController = GameObject.Find("StartDBController").GetComponent <StartDBController>(); }
/// <summary> /// Clear all of the searches and go to the Top List without any chosen results /// </summary> public void ClearSearches() { AllSearches.Clear(); var newSearch = new SearchVM(); AllSearches.Add(newSearch); CurrentSearch = newSearch; CurrentSearch.GoToTopList(); }
private async Task StartSearch(string from) { if (!SearchFetchInProgress) { SearchFetchInProgress = true; await CurrentSearch.Start(from); SearchFetchInProgress = false; } }
private async Task PreviousSearch() { if (CurrentSearch != null && !SearchFetchInProgress && CurrentSearch.HasPrevious) { SearchFetchInProgress = true; await CurrentSearch.Previous(); SearchFetchInProgress = false; } }
private async Task NextSearch() { if (CurrentSearch != null && !SearchFetchInProgress && CurrentSearch.HasNext) { SearchFetchInProgress = true; await CurrentSearch.Next(); SearchFetchInProgress = false; } }
private void AddSearchItem(object item) { var itemString = (string)item; if (!string.IsNullOrWhiteSpace(itemString)) { var needNewline = PageContent != "" && !PageContent.EndsWith("\n"); var newLine = needNewline ? "\n" : ""; PageContent += newLine + CurrentSearch.FullItemString(itemString); _navigatorService.NavigateToUploadPage(); } }
public object GetCollectionElement(PropertyInfo prop, int collectionIndex) { var collection = prop.GetValue(_object) as IEnumerable <object>; if (collection == null) { return(null); } var skipCount = CurrentSearch.GetCollectionNo(collectionIndex) - 1; return(collection.Skip(skipCount).FirstOrDefault()); }
public async Task GetImage() { try { var endpoint = new ImageEndpoint(client); var image = await endpoint.GetImageAsync(" "); CurrentSearch.Clear(); CurrentSearch.Add(fillPicture(image)); Debug.Write("Image retrieved. Image Url: " + image.Link); } catch (ImgurException imgurEx) { Debug.Write("An error occurred getting an image from Imgur."); Debug.Write(imgurEx.Message); } }
// Normally you should call RequestRefreshTreeView() instead of this function public void RefreshTreeView() { if (Disposing || IsDisposed || Program.Exiting) { return; } Program.Invoke(Program.MainWindow, () => { if (ignoreRefreshTreeView > 0) { calledRefreshTreeView = true; return; } ignoreRefreshTreeView++; // Some events can be ignored while rebuilding the tree try { var newRootNode = treeBuilder.CreateNewRootNode(CurrentSearch.AddFullTextFilter(searchTextBox.Text), NavigationMode); treeBuilder.RefreshTreeView(newRootNode, searchTextBox.Text, NavigationMode); } catch (Exception exn) { log.Error(exn, exn); #if DEBUG if (Debugger.IsAttached) { throw; } #endif } finally { ignoreRefreshTreeView--; } if (TreeViewRefreshed != null) { TreeViewRefreshed(); } }); }
private void SearchLog() { int howManyItems = DataAccessContext.ProductRepository.CountQuickSearchResult( StoreContext.Culture, CurrentSearch, DataAccessContext.Configurations.GetValueList("ProductSearchBy"), "ProductID", new StoreRetriever().GetCurrentStoreID(), DataAccessContext.Configurations.GetValue("RootCategory", new StoreRetriever().GetStore()), DataAccessContext.Configurations.GetValue("SearchMode", new StoreRetriever().GetStore())); if (howManyItems > 0) { SearchLogAccess.Create(CurrentSearch.ToLower().Trim(), true); } else { SearchLogAccess.Create(CurrentSearch.ToLower().Trim(), false); } }
public async Task GetRandomGalleryAsync() { var endpoint = new GalleryEndpoint(client); var images = await endpoint.GetRandomGalleryAsync(); CurrentSearch.Clear(); foreach (IGalleryItem item in images) { if (item is IGalleryImage) { CurrentSearch.Add(fillPicture(item as IGalleryImage)); } else if (item is IGalleryAlbum) { if ((item as IGalleryAlbum).Images.First() != null) { CurrentSearch.Add(fillPicture((item as IGalleryAlbum).Images.First())); } } } }
public async Task GetGalleryTagAsync(string tagName) { var endpoint = new GalleryEndpoint(client); var tag = await endpoint.GetGalleryTagAsync(tagName); CurrentSearch.Clear(); foreach (IGalleryItem item in tag.Items) { if (item is IGalleryImage) { CurrentSearch.Add(fillPicture(item as IGalleryImage)); } else if (item is IGalleryAlbum) { if ((item as IGalleryAlbum).Images.First() != null) { CurrentSearch.Add(fillPicture((item as IGalleryAlbum).Images.First())); } } } }
private async void NextPageButtonOnClick(object sender, RoutedEventArgs e) { ChangeSearchVisual(true); var t = await CurrentSearch.TrySearchNextPageAsync(); if (t.IsCanceled || t.Exception != null) { if (!CurrentSearch.IsSearching) { ChangeSearchVisual(false); } } else { ChangeSearchVisual(false); if (Settings.IsClearImgsWhenSerachNextPage) { MoeExplorer.ResetVisual(); } MoeExplorer.AddPage(CurrentSearch); } }
public void SelectNextSearchResult() { if (CurrentSearch == null) { return; } var keyColumn = dataGridView1.Columns[Properties.Resources.ColNameKey]; var currentRow = dataGridView1.CurrentCell?.RowIndex ?? dataGridView1.RowCount; var currentColumn = dataGridView1.CurrentCell?.ColumnIndex ?? -1; foreach (DataGridViewRow row in dataGridView1.Rows.Cast <DataGridViewRow>().ToList().Rotate(currentRow)) { foreach (DataGridViewCell cell in row.Cells) { if (cell.ColumnIndex <= currentColumn) { continue; } if (!(cell.Value is string s)) { continue; } if (CurrentSearch.Match(cell.OwningColumn == keyColumn ? SearchParams.TargetType.Key : SearchParams.TargetType.Text, s)) { dataGridView1.CurrentCell = cell; return; } } // Skip cells only in the currently selected row (the selected row is first in order thanks to Rotate call) currentColumn = -1; } }