public SimilarHighlighter(MainWindow mainWindow) { _mainWindow = mainWindow; _action = new SingularAction(_mainWindow.Dispatcher); _mainWindow.Tree.SelectedItemChanged += OnSelectedItemChanged; _mainWindow.PropertyChanged += OnMainWindowPropertyChanged; Properties.Settings.Default.PropertyChanged += OnSettingsPropertyChanged; }
public CustomTreeView() { Debug.Assert(System.Threading.Thread.CurrentThread.ManagedThreadId == 1); Config.PropertyChanged += OnConfigPropertyChanged; _action = new SingularAction(this.Dispatcher); _action.PropertyChanged += OnActionPropertyChanged; CommandBinding copyCommandBinding = new CommandBinding { Command = ApplicationCommands.Copy }; copyCommandBinding.Executed += OnCopyCommandExecuted; copyCommandBinding.CanExecute += OnCopyCommandCanExecute; this.CommandBindings.Add(copyCommandBinding); }
internal void ApplyExpandRule(CustomTreeView tree) { if (_expandByRules == null) { _expandByRules = new SingularAction(tree.Dispatcher); } FileLogger.Assert(_expandByRules.Dispatcher == tree.Dispatcher); bool expandedSomething = false; _expandByRules.BeginInvoke( System.Windows.Threading.DispatcherPriority.Background, async(actionId, action) => { foreach (JsonObject jsonObj in this.AllChildren) { int?depth = jsonObj.Rules.ExpandChildren; if (depth.HasValue) { tree.ExpandToItem(jsonObj.ViewObject); tree.ExpandSubtree(jsonObj.ViewObject, depth.Value); expandedSomething = true; } if (!await action.YieldAndContinue(actionId)) { return(false); } } if (!expandedSomething) { tree.ExpandAll(this.ExpandLevelWithLessThanCount(50)); } return(true); }); }
public void AddAction(SingularAction sa) { actions.Add(sa); }
public Finder(MainWindow parentWindow) { _parentWindow = parentWindow; _action = new SingularAction(_parentWindow.Dispatcher); }