PageRenderTime 25ms CodeModel.GetById 15ms app.highlight 4ms RepoModel.GetById 1ms app.codeStats 0ms

/V4/PrismLibrary/Desktop/Prism/Regions/IRegionBehaviorFactory.cs

#
C# | 52 lines | 12 code | 3 blank | 37 comment | 0 complexity | 293d08f94b0dd7deae0a065fbd593533 MD5 | raw file
 1//===================================================================================
 2// Microsoft patterns & practices
 3// Composite Application Guidance for Windows Presentation Foundation and Silverlight
 4//===================================================================================
 5// Copyright (c) Microsoft Corporation.  All rights reserved.
 6// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY
 7// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT
 8// LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
 9// FITNESS FOR A PARTICULAR PURPOSE.
10//===================================================================================
11// The example companies, organizations, products, domain names,
12// e-mail addresses, logos, people, places, and events depicted
13// herein are fictitious.  No association with any real company,
14// organization, product, domain name, email address, logo, person,
15// places, or events is intended or should be inferred.
16//===================================================================================
17using System;
18using System.Collections.Generic;
19
20namespace Microsoft.Practices.Prism.Regions
21{
22    /// <summary>
23    /// Interface for RegionBehaviorFactories. This factory allows the registration of the default set of RegionBehaviors, that will
24    /// be added to the <see cref="IRegionBehaviorCollection"/>s of all <see cref="IRegion"/>s, unless overridden on a 'per-region' basis. 
25    /// </summary>
26    [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix", Justification = "It is more of a factory than a collection")]
27    public interface IRegionBehaviorFactory : IEnumerable<string>
28    {
29        /// <summary>
30        /// Adds a particular type of RegionBehavior if it was not already registered. the <paramref name="behaviorKey"/> string is used to check if the behavior is already present
31        /// </summary>
32        /// <param name="behaviorKey">The behavior key that's used to find if a certain behavior is already added.</param>
33        /// <param name="behaviorType">Type of the behavior to add. .</param>
34        void AddIfMissing(string behaviorKey, Type behaviorType);
35
36        /// <summary>
37        /// Determines whether a behavior with the specified key already exists
38        /// </summary>
39        /// <param name="behaviorKey">The behavior key.</param>
40        /// <returns>
41        /// <see langword="true"/> if a behavior with the specified key is present; otherwise, <see langword="false"/>.
42        /// </returns>
43        bool ContainsKey(string behaviorKey);
44
45        /// <summary>
46        /// Creates an instance of the Behaviortype that's registered using the specified key.
47        /// </summary>
48        /// <param name="key">The key that's used to register a behavior type.</param>
49        /// <returns>The created behavior. </returns>
50        IRegionBehavior CreateFromKey(string key);
51    }
52}