#region File Description
//-----------------------------------------------------------------------------
// ServiceContainer.cs
//
// Microsoft XNA Community Game Platform
// Copyright (C) Microsoft Corporation. All rights reserved.
//-----------------------------------------------------------------------------
#endregion
#region Using Statements
using System;
using System.Collections.Generic;
#endregion
namespace Darwinbots3.DrawingSurface
{
///
/// Container class implements the IServiceProvider interface. This is used
/// to pass shared services between different components, for instance the
/// ContentManager uses it to locate the IGraphicsDeviceService implementation.
///
public class ServiceContainer : IServiceProvider
{
Dictionary services = new Dictionary();
///
/// Adds a new service to the collection.
///
public void AddService(T service)
{
services.Add(typeof(T), service);
}
///
/// Looks up the specified service.
///
public object GetService(Type serviceType)
{
object service;
services.TryGetValue(serviceType, out service);
return service;
}
}
}