//===================================================================================
// 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.ComponentModel;
using System.Windows;
using System.Windows.Controls;
using Microsoft.Practices.Composite.Regions;
namespace Microsoft.Practices.Composite.Presentation.Tests.Mocks
{
class MockRegion : IRegion
{
public MockViewsCollection MockViews = new MockViewsCollection();
public MockViewsCollection MockActiveViews = new MockViewsCollection();
public MockRegion()
{
Behaviors = new MockRegionBehaviorCollection();
}
public IRegionManager Add(object view)
{
MockViews.Items.Add(view);
return null;
}
public void Remove(object view)
{
MockViews.Items.Remove(view);
MockActiveViews.Items.Remove(view);
}
public void Activate(object view)
{
MockActiveViews.Items.Add(view);
}
public IRegionManager Add(object view, string viewName)
{
throw new NotImplementedException();
}
public IRegionManager Add(object view, string viewName, bool createRegionManagerScope)
{
throw new NotImplementedException();
}
public object GetView(string viewName)
{
throw new NotImplementedException();
}
public IRegionManager RegionManager { get; set; }
public IRegionBehaviorCollection Behaviors { get; set; }
public IViewsCollection Views
{
get { return MockViews; }
}
public IViewsCollection ActiveViews
{
get { return MockActiveViews; }
}
public void Deactivate(object view)
{
MockActiveViews.Items.Remove(view);
}
private object context;
public object Context
{
get { return context; }
set
{
context = value;
OnPropertyChange("Context");
}
}
private string name;
public string Name
{
get { return this.name; }
set
{
this.name = value;
this.OnPropertyChange("Name");
}
}
public event PropertyChangedEventHandler PropertyChanged;
public void OnPropertyChange(string propertyName)
{
if (PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
}
}
}