public PropertyObserver <IConfigurationObject> GetObserver(IConfigurationObject obj) { int key = obj.GetHashCode(); if (!ContainsObserver(obj)) { PropertyObserver <IConfigurationObject> pb = new PropertyObserver <IConfigurationObject>(obj); observers.Add(key, pb); } return(observers[key]); }
public AvalonDockScreen(string name) : base(name) { CacheViews = false; observer = new PropertyObserver<AvalonDockScreen>(this); observer.RegisterHandler(n => n.Type, screen => { var manager = IoC.Get<IDockScreenManager>(); if (screen.Type == DockType.Document) { if (!manager.Documents.Contains(this)) { manager.Documents.Add(this); } } else if (manager.Documents.Contains(this)) { manager.Documents.Remove(this); } }); }