public PropertyGrid2() { this.processIncrementalCall = new DelayedCall(this.ProcessIncrementalPropertyAdd, DispatcherPriority.Background); this.filterCall = new DelayedCall(this.ProcessFilter, DispatcherPriority.Background); this.InitializeComponent(); this.Loaded += this.HandleLoaded; this.Unloaded += this.HandleUnloaded; this.CommandBindings.Add(new CommandBinding(PropertyGrid2.ShowBindingErrorsCommand, this.HandleShowBindingErrors, this.CanShowBindingErrors)); this.CommandBindings.Add(new CommandBinding(PropertyGrid2.ClearCommand, this.HandleClear, this.CanClear)); this.CommandBindings.Add(new CommandBinding(PropertyGrid2.SortCommand, this.HandleSort)); filterTimer = new DispatcherTimer(); filterTimer.Interval = TimeSpan.FromSeconds(0.3); filterTimer.Tick += (s, e) => { this.filterCall.Enqueue(); filterTimer.Stop(); }; }
public PropertyGrid2() { processRefreshCall = new DelayedCall(ProcessRefresh, DispatcherPriority.ApplicationIdle); processIncrementalCall = new DelayedCall(ProcessIncrementalPropertyAdd, DispatcherPriority.Background); filterCall = new DelayedCall(ProcessFilter, DispatcherPriority.Background); InitializeComponent(); Loaded += HandleLoaded; Unloaded += HandleUnloaded; CommandBindings.Add(new CommandBinding(ShowBindingErrorsCommand, HandleShowBindingErrors, CanShowBindingErrors)); CommandBindings.Add(new CommandBinding(ClearCommand, HandleClear, CanClear)); CommandBindings.Add(new CommandBinding(SortCommand, HandleSort)); filterTimer = new DispatcherTimer(); filterTimer.Interval = TimeSpan.FromSeconds(0.3); filterTimer.Tick += (s, e) => { filterCall.Enqueue(); filterTimer.Stop(); }; }
public SnoopUI() { this.filterCall = new DelayedCall(this.ProcessFilter, DispatcherPriority.Background); this.InheritanceBehavior = InheritanceBehavior.SkipToThemeNext; this.InitializeComponent(); // wrap the following PresentationTraceSources.Refresh() call in a try/catch // sometimes a NullReferenceException occurs // due to empty <filter> elements in the app.config file of the app you are snooping // see the following for more info: // http://snoopwpf.codeplex.com/discussions/236503 // http://snoopwpf.codeplex.com/workitem/6647 try { PresentationTraceSources.Refresh(); PresentationTraceSources.DataBindingSource.Switch.Level = SourceLevels.Error; } catch (NullReferenceException) { // swallow this exception since you can Snoop just fine anyways. } this.CommandBindings.Add(new CommandBinding(SnoopUI.IntrospectCommand, this.HandleIntrospection)); this.CommandBindings.Add(new CommandBinding(SnoopUI.RefreshCommand, this.HandleRefresh)); this.CommandBindings.Add(new CommandBinding(SnoopUI.HelpCommand, this.HandleHelp)); this.CommandBindings.Add(new CommandBinding(SnoopUI.InspectCommand, this.HandleInspect)); this.CommandBindings.Add(new CommandBinding(SnoopUI.SelectFocusCommand, this.HandleSelectFocus)); this.CommandBindings.Add(new CommandBinding(SnoopUI.SelectFocusScopeCommand, this.HandleSelectFocusScope)); //NOTE: this is up here in the outer UI layer so ESC will clear any typed filter regardless of where the focus is // (i.e. focus on a selected item in the tree, not in the property list where the search box is hosted) this.CommandBindings.Add(new CommandBinding(SnoopUI.ClearSearchFilterCommand, this.ClearSearchFilterHandler)); this.CommandBindings.Add(new CommandBinding(SnoopUI.CopyPropertyChangesCommand, this.CopyPropertyChangesHandler)); InputManager.Current.PreProcessInput += this.HandlePreProcessInput; this.Tree.SelectedItemChanged += this.HandleTreeSelectedItemChanged; // we can't catch the mouse wheel at the ZoomerControl level, // so we catch it here, and relay it to the ZoomerControl. this.MouseWheel += this.SnoopUI_MouseWheel; filterTimer = new DispatcherTimer(); filterTimer.Interval = TimeSpan.FromSeconds(0.3); filterTimer.Tick += (s, e) => { EnqueueAfterSettingFilter(); filterTimer.Stop(); }; InitShell(); }