Projektdateien hinzufügen.
This commit is contained in:
29
VideoBrowserTestApp/Helpers/ReflectionHelper.cs
Normal file
29
VideoBrowserTestApp/Helpers/ReflectionHelper.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
namespace VideoBrowserTestApp.Helpers
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
|
||||
/// <summary>
|
||||
/// Defines the <see cref="ReflectionHelper" />.
|
||||
/// </summary>
|
||||
public static class ReflectionHelper
|
||||
{
|
||||
#region Methods
|
||||
|
||||
/// <summary>
|
||||
/// The GetInstances.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">.</typeparam>
|
||||
/// <returns>The <see cref="IList{T}"/>.</returns>
|
||||
public static IList<T> GetInstances<T>()
|
||||
{
|
||||
return (from t in Assembly.GetExecutingAssembly().GetTypes()
|
||||
where t.BaseType == (typeof(T)) && t.GetConstructor(Type.EmptyTypes) != null
|
||||
select (T)Activator.CreateInstance(t)).ToList();
|
||||
}
|
||||
|
||||
#endregion Methods
|
||||
}
|
||||
}
|
||||
38
VideoBrowserTestApp/Helpers/WindowFactory.cs
Normal file
38
VideoBrowserTestApp/Helpers/WindowFactory.cs
Normal file
@@ -0,0 +1,38 @@
|
||||
namespace VideoBrowserTestApp.Helpers
|
||||
{
|
||||
using MahApps.Metro.Controls;
|
||||
using System.Windows;
|
||||
|
||||
/// <summary>
|
||||
/// Defines the <see cref="WindowFactory" />.
|
||||
/// </summary>
|
||||
internal static class WindowFactory
|
||||
{
|
||||
#region Methods
|
||||
|
||||
/// <summary>
|
||||
/// The Create.
|
||||
/// </summary>
|
||||
/// <param name="view">The view<see cref="FrameworkElement"/>.</param>
|
||||
/// <param name="ownerWindow">The ownerWindow<see cref="Window"/>.</param>
|
||||
/// <returns>The <see cref="MetroWindow"/>.</returns>
|
||||
internal static MetroWindow Create(FrameworkElement view, Window ownerWindow)
|
||||
{
|
||||
var window = new MetroWindow { Content = view, MinWidth = 600, MinHeight = 400, SizeToContent = SizeToContent.WidthAndHeight, Owner = ownerWindow };
|
||||
return window;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The CreateAndShow.
|
||||
/// </summary>
|
||||
/// <param name="view">The view<see cref="FrameworkElement"/>.</param>
|
||||
/// <param name="ownerWindow">The ownerWindow<see cref="Window"/>.</param>
|
||||
internal static void CreateAndShow(FrameworkElement view, Window ownerWindow)
|
||||
{
|
||||
var window = new Window { Content = view, MinWidth = 600, MinHeight = 400, SizeToContent = SizeToContent.WidthAndHeight, Owner = ownerWindow };
|
||||
window.Show();
|
||||
}
|
||||
|
||||
#endregion Methods
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user