//===================================================================================
// Microsoft patterns & practices
// Composite Application Guidance for Windows Presentation Foundation and Silverlight
//===================================================================================
// Copyright (c) Microsoft Corporation. All rights reserved.
// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY
// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT
// LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
// FITNESS FOR A PARTICULAR PURPOSE.
//===================================================================================
// The example companies, organizations, products, domain names,
// e-mail addresses, logos, people, places, and events depicted
// herein are fictitious. No association with any real company,
// organization, product, domain name, email address, logo, person,
// places, or events is intended or should be inferred.
//===================================================================================
using System;
using System.Windows;
using Microsoft.Practices.Composite.Presentation.Regions;
using Microsoft.Practices.Composite.Regions;
namespace Microsoft.Practices.Composite.Presentation.Tests.Mocks
{
internal class MockRegionManagerAccessor : IRegionManagerAccessor
{
public Func<DependencyObject, string> GetRegionName;
public Func<DependencyObject, IRegionManager> GetRegionManager;
public event EventHandler UpdatingRegions;
string IRegionManagerAccessor.GetRegionName(DependencyObject element)
{
return this.GetRegionName(element);
}
IRegionManager IRegionManagerAccessor.GetRegionManager(DependencyObject element)
{
if (this.GetRegionManager != null)
{
return this.GetRegionManager(element);
}
return null;
}
public void UpdateRegions()
{
if (this.UpdatingRegions != null)
{
this.UpdatingRegions(this, EventArgs.Empty);
}
}
public int GetSubscribersCount()
{
return this.UpdatingRegions != null ? this.UpdatingRegions.GetInvocationList().Length : 0;
}
}
}