Browse Source

Stylecop fixes for Perspex.Application.

pull/58/head
Steven Kirk 12 years ago
parent
commit
1f36f0e49a
  1. 4
      Perspex.Animation/LinearEasing.cs
  2. 14
      Perspex.Animation/Properties/AssemblyInfo.cs
  3. 64
      Perspex.Application/Application.cs
  4. 6
      Perspex.Application/Properties/AssemblyInfo.cs

4
Perspex.Animation/LinearEasing.cs

@ -22,11 +22,11 @@ namespace Perspex.Animation
/// </summary> /// </summary>
/// <typeparam name="T">The type.</typeparam> /// <typeparam name="T">The type.</typeparam>
/// <returns>An easing function.</returns> /// <returns>An easing function.</returns>
public static IEasing For<T>() public static IEasing<T> For<T>()
{ {
if (typeof(T) == typeof(double)) if (typeof(T) == typeof(double))
{ {
return new LinearDoubleEasing(); return (IEasing<T>)new LinearDoubleEasing();
} }
else else
{ {

14
Perspex.Animation/Properties/AssemblyInfo.cs

@ -1,9 +1,15 @@
using System.Resources; // -----------------------------------------------------------------------
// <copyright file="AssemblyInfo.cs" company="Steven Kirk">
// Copyright 2015 MIT Licence. See licence.md for more information.
// </copyright>
// -----------------------------------------------------------------------
using System.Resources;
using System.Reflection; using System.Reflection;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following // General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information // set of attributes. Change these attribute values to modify the information
// associated with an assembly. // associated with an assembly.
[assembly: AssemblyTitle("Perspex.Animation")] [assembly: AssemblyTitle("Perspex.Animation")]
@ -19,11 +25,11 @@ using System.Runtime.InteropServices;
// Version information for an assembly consists of the following four values: // Version information for an assembly consists of the following four values:
// //
// Major Version // Major Version
// Minor Version // Minor Version
// Build Number // Build Number
// Revision // Revision
// //
// You can specify all the values or you can default the Build and Revision Numbers // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyVersion("1.0.0.0")]

64
Perspex.Application/Application.cs

@ -16,12 +16,36 @@ namespace Perspex
using Perspex.Threading; using Perspex.Threading;
using Splat; using Splat;
/// <summary>
/// Encapsulates a Perspex application.
/// </summary>
/// <remarks>
/// The <see cref="Application"/> class encapsulates Perspex application-specific
/// functionality, including:
/// - A global set of <see cref="DataTemplates"/>.
/// - A global set of <see cref="Styles"/>.
/// - A <see cref="FocusManager"/>.
/// - An <see cref="InputManager"/>.
/// - Registers services needed by the rest of Perspex in the <see cref="RegisterServices"/>
/// method.
/// - Tracks the lifetime of the application.
/// </remarks>
public class Application : IGlobalDataTemplates, IGlobalStyles public class Application : IGlobalDataTemplates, IGlobalStyles
{ {
/// <summary>
/// The application-global data templates.
/// </summary>
private DataTemplates dataTemplates; private DataTemplates dataTemplates;
/// <summary>
/// The styler that will be used to apply styles to controls.
/// </summary>
private Styler styler = new Styler(); private Styler styler = new Styler();
/// <summary>
/// Initializes a new instance of the <see cref="Application"/> class.
/// </summary>
/// <param name="theme">The theme to use.</param>
public Application(Styles theme) public Application(Styles theme)
{ {
if (Current != null) if (Current != null)
@ -34,12 +58,24 @@ namespace Perspex
this.RegisterServices(); this.RegisterServices();
} }
/// <summary>
/// Gets the current instance of the <see cref="Application"/> class.
/// </summary>
/// <value>
/// The current instance of the <see cref="Application"/> class.
/// </value>
public static Application Current public static Application Current
{ {
get; get;
private set; private set;
} }
/// <summary>
/// Gets or sets the application's global data templates.
/// </summary>
/// <value>
/// The application's global data templates.
/// </value>
public DataTemplates DataTemplates public DataTemplates DataTemplates
{ {
get get
@ -58,24 +94,49 @@ namespace Perspex
} }
} }
/// <summary>
/// Gets the application's focus manager.
/// </summary>
/// <value>
/// The application's focus manager.
/// </value>
public IFocusManager FocusManager public IFocusManager FocusManager
{ {
get; get;
private set; private set;
} }
/// <summary>
/// Gets the application's input manager.
/// </summary>
/// <value>
/// The application's input manager.
/// </value>
public InputManager InputManager public InputManager InputManager
{ {
get; get;
private set; private set;
} }
/// <summary>
/// Gets the application's global styles.
/// </summary>
/// <value>
/// The application's global styles.
/// </value>
/// <remarks>
/// Global styles apply to all windows in the application.
/// </remarks>
public Styles Styles public Styles Styles
{ {
get; get;
private set; private set;
} }
/// <summary>
/// Runs the application's main loop until the <see cref="ICloseable"/> is closed.
/// </summary>
/// <param name="closable">The closable to track</param>
public void Run(ICloseable closable) public void Run(ICloseable closable)
{ {
var source = new CancellationTokenSource(); var source = new CancellationTokenSource();
@ -83,6 +144,9 @@ namespace Perspex
Dispatcher.UIThread.MainLoop(source.Token); Dispatcher.UIThread.MainLoop(source.Token);
} }
/// <summary>
/// Register's the services needed by Perspex.
/// </summary>
protected virtual void RegisterServices() protected virtual void RegisterServices()
{ {
var keyboardNavigation = new KeyboardNavigation(); var keyboardNavigation = new KeyboardNavigation();

6
Perspex.Application/Properties/AssemblyInfo.cs

@ -7,7 +7,7 @@
using System.Reflection; using System.Reflection;
using System.Resources; using System.Resources;
// General Information about an assembly is controlled through the following // General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information // set of attributes. Change these attribute values to modify the information
// associated with an assembly. // associated with an assembly.
[assembly: AssemblyTitle("Perspex.Application")] [assembly: AssemblyTitle("Perspex.Application")]
@ -23,11 +23,11 @@ using System.Resources;
// Version information for an assembly consists of the following four values: // Version information for an assembly consists of the following four values:
// //
// Major Version // Major Version
// Minor Version // Minor Version
// Build Number // Build Number
// Revision // Revision
// //
// You can specify all the values or you can default the Build and Revision Numbers // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyVersion("1.0.0.0")]

Loading…
Cancel
Save