private void fireSearchStarted(SuggestedDisplaySortMode suggestedSortMode) { if (SearchStarted != null) { SearchStarted.Invoke(suggestedSortMode); } }
/// <summary> /// Raises the search started event. /// </summary> /// <param name="e">The event argument.</param> protected virtual void OnSearchStarted(EventArgs e) { if (SearchStarted != null) { SearchStarted.GetInvocationList().InvokeEventGUIThreadSafe(this, e); } }
public void SearchForInterfaces() { _searching = true; SearchStarted?.Invoke(this, EventArgs.Empty); SearchTxt(); SearchTx(); }
public IEnumerable <FileSystemInfo> Search() { var startFinishEventArgs = new StartFinishEventArgs(); SearchStarted?.Invoke(this, startFinishEventArgs); if (startFinishEventArgs.StopSearch) { SearchFinished?.Invoke(this, startFinishEventArgs); return(new List <FileSystemInfo>()); } var result = GetFileSystemInfo(new DirectoryInfo(_startPath)).ToList(); SearchFinished?.Invoke(this, startFinishEventArgs); return(result); }
public FileSystemInfoCustomCollection <CustomFileItem> GetItemsRecursively(FilterMask filterMask) { isFirstFilteredFileFound = false; SearchStarted?.Invoke(this, new EventArgs()); var output = GetItemsRecursively(DirectoryPath, filterMask); SearchFinished?.Invoke(this, new EventArgs()); if (filterMask.HasFlag(FilterMask.SortByName)) { output.Sort(); } return(output); }
public List <string> Search(string path) { if (string.IsNullOrEmpty(path)) { throw new ArgumentException("path to directory is not valid"); } SearchStarted?.Invoke(); var items = new List <string>(); try { foreach (var item in GetFiles(path)) { var itemFoundArgs = new ItemFoundArgs(item); if (Filter(item)) { FilteredItemFound?.Invoke(this, itemFoundArgs); } else { ItemFound?.Invoke(this, itemFoundArgs); } if (itemFoundArgs.RemoveItemFromResult && itemFoundArgs.EndSearch) { break; } if (itemFoundArgs.RemoveItemFromResult) { continue; } items.Add(item); if (itemFoundArgs.EndSearch) { break; } } return(items); } finally { SearchFinished?.Invoke(); } }
public async Task <MoveViewer> CpuMove(int maxDepth) { SearchStarted?.Invoke(this, new EventArgs()); var searchResults = await Task.Run(() => search.Go(board, CpuColour, maxDepth)); SearchCompleted?.Invoke(this, new SearchCompleteEventArgs(searchResults)); var chosenMove = searchResults.MoveEvaluations .OrderByDescending(x => x.Score) .FirstOrDefault(); if (chosenMove == null) { return(new MoveViewer(0)); } ApplyMove(board, CpuColour, chosenMove.Move); return(chosenMove.Move); }
protected void OnSearchStarted(string keyword) { SearchStarted?.Invoke(keyword); }
private async Task SearchAsync() { if (string.IsNullOrEmpty(mSearchString)) { return; } if (mSearchTask?.IsCanceled == false && mSearchTask?.IsCompleted == false) { //Cancel if previous search is running await CancelSearchAsync(); } xSearchBtn.Visibility = Visibility.Collapsed; xSearchClearBtn.Visibility = Visibility.Visible; mCancellationTokenSource = new CancellationTokenSource(); mSearchTask = new Task(() => { this.Dispatcher.Invoke(() => { try { mCancellationTokenSource.Token.ThrowIfCancellationRequested(); if (SearchStarted == null) { //If event is not hooked we say searching status on main window Reporter.ToStatus(eStatusMsgKey.Search, null, ": " + mSearchString); } else { //If event is hookded then no point in showing status on main window. //child window need to handle it in the window. E.g. Windows Explorer SearchStarted.Invoke(Tree, new EventArgs()); } Mouse.OverrideCursor = Cursors.Wait; xTreeViewTree.FilterItemsByText(xTreeViewTree.TreeItemsCollection, mSearchString, mCancellationTokenSource.Token); } catch (Exception ex) { Reporter.ToLog(eLogLevel.ERROR, "Failed to search : ", ex); } finally { if (SearchStarted == null) { Reporter.HideStatusMessage(); } else { SearchCompleted.Invoke(Tree, new EventArgs()); } Mouse.OverrideCursor = null; mCancellationTokenSource.Dispose(); } }); }, mCancellationTokenSource.Token, TaskCreationOptions.LongRunning); mSearchTask.Start(); }
public static void OnSearchStarted() { SearchStarted?.Invoke(); }
protected virtual void OnSearchStarted() { SearchStarted?.Invoke(); }
private void RiseSearchStarted() { SearchStarted?.Invoke(); }
public void OnSearchStarted(EventArgs e) => SearchStarted?.Invoke(this, e);
protected virtual void OnSearchStarted(EventArgs args) { SearchStarted?.Invoke(this, args); }