/// <summary> /// /// </summary> /// <param name="demoModule"></param> public void RemoveDemoModule(DemoModule demoModule) { DepPropertyHelper.UnsubscribeFromChanged(demoModule.Bar, RibbonPage.IsSelectedProperty, demoModule.BarIsSelectedChanged); var demoModulesList = _demoModules[((ClassicShowType)demoModule.ShowMethodType).Category]; demoModulesList.Remove(demoModule); if (demoModulesList.Count == 0) { _demoModules.Remove(((ClassicShowType)demoModule.ShowMethodType).Category); UpdateNavBar(); } RemoveDemoModuleBar(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); }