/// <summary> /// Adds an application module depended on the category /// </summary> /// <param name="demoModule">The demo module.</param> public void AddDemoModule(DemoModule demoModule) { PrepareDemoModuleBar(demoModule); PrepareDemoModuleRoot(demoModule); DepPropertyHelper.SubscribeToChanged(demoModule.Bar, RibbonPage.IsSelectedProperty, demoModule.BarIsSelectedChanged); AddDemoModuleBar(demoModule); List <DemoModule> demoModulesList; if (!_demoModules.TryGetValue(((ClassicShowType)demoModule.ShowMethodType).Category, out demoModulesList)) { demoModulesList = new List <DemoModule>(); _demoModules.Add(((ClassicShowType)demoModule.ShowMethodType).Category, demoModulesList); UpdateNavBar(); } demoModulesList.Add(demoModule); }
public void DependencyPropertyHelper_SubscribeToChanged() { bool eventRaised = false; TheDependencyObject theDependencyObject = new TheDependencyObject(); EventHandler changed = delegate(object sender, EventArgs e) { eventRaised = true; }; DepPropertyHelper.SubscribeToChanged(theDependencyObject, TheDependencyObject.IntValueProperty, changed); theDependencyObject.IntValue = 1; Assert.IsTrue(eventRaised); DepPropertyHelper.UnsubscribeFromChanged(theDependencyObject, TheDependencyObject.IntValueProperty, changed); eventRaised = false; theDependencyObject.IntValue = 2; Assert.IsFalse(eventRaised); }