Esempio n. 1
0
        public SimilarHighlighter(MainWindow mainWindow)
        {
            _mainWindow = mainWindow;
            _action     = new SingularAction(_mainWindow.Dispatcher);

            _mainWindow.Tree.SelectedItemChanged        += OnSelectedItemChanged;
            _mainWindow.PropertyChanged                 += OnMainWindowPropertyChanged;
            Properties.Settings.Default.PropertyChanged += OnSettingsPropertyChanged;
        }
Esempio n. 2
0
        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);
        }
Esempio n. 3
0
        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);
            });
        }
Esempio n. 4
0
 public void AddAction(SingularAction sa)
 {
     actions.Add(sa);
 }
Esempio n. 5
0
 public Finder(MainWindow parentWindow)
 {
     _parentWindow = parentWindow;
     _action       = new SingularAction(_parentWindow.Dispatcher);
 }