Paradox Game Engine  v1.0.0 beta06
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros Pages
IViewModelServiceProvider.cs
Go to the documentation of this file.
1 // Copyright (c) 2014 Silicon Studio Corp. (http://siliconstudio.co.jp)
2 // This file is distributed under GPL v3. See LICENSE.md for details.
3 using System;
4 
5 namespace SiliconStudio.Presentation.ViewModel
6 {
7  /// <summary>
8  /// A service provider class for view model objects.
9  /// </summary>
10  public interface IViewModelServiceProvider
11  {
12  /// <summary>
13  /// Clones this <see cref="IViewModelServiceProvider"/> using shallow copy.
14  /// </summary>
15  /// <returns></returns>
17 
18  /// <summary>
19  /// Gets a service of the given type, if available.
20  /// </summary>
21  /// <param name="serviceType">The type of service to retrieve.</param>
22  /// <returns>An instance of the service that match the given type if available, <c>null</c> otherwise.</returns>
23  /// <exception cref="InvalidOperationException">Multiple services match the given type.</exception>
24  object TryGet(Type serviceType);
25 
26  /// <summary>
27  /// Gets a service of the given type, if available.
28  /// </summary>
29  /// <typeparam name="T">The type of service to retrieve.</typeparam>
30  /// <returns>An instance of the service that match the given type if available, <c>null</c> otherwise.</returns>
31  /// <exception cref="InvalidOperationException">Multiple services match the given type.</exception>
32  T TryGet<T>() where T : class;
33 
34  /// <summary>
35  /// Gets a service of the given type.
36  /// </summary>
37  /// <param name="serviceType">The type of service to retrieve.</param>
38  /// <returns>An instance of the service that match the given type.</returns>
39  /// <exception cref="InvalidOperationException">No service matches the given type.</exception>
40  /// <exception cref="InvalidOperationException">Multiple services match the given type.</exception>
41  object Get(Type serviceType);
42 
43  /// <summary>
44  /// Gets a service of the given type.
45  /// </summary>
46  /// <typeparam name="T">The type of service to retrieve.</typeparam>
47  /// <returns>An instance of the service that match the given type.</returns>
48  /// <exception cref="InvalidOperationException">No service matches the given type.</exception>
49  /// <exception cref="InvalidOperationException">Multiple services match the given type.</exception>
50  T Get<T>() where T : class;
51  }
52 }