using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using Tango.Core.Commands;
using Tango.MachineStudio.DB.CustomAttributes;
using Tango.MachineStudio.DB.Views.DBViews;
namespace Tango.MachineStudio.DB.Managers
{
///
/// Represents the data table views manager.
///
public static class ViewsManager
{
///
/// Gets or sets the displayed views.
///
public static ObservableCollection DisplayedViews { get; set; }
///
/// Gets or sets all the views.
///
public static ObservableCollection DbViews { get; set; }
///
/// Initializes the class.
///
static ViewsManager()
{
DisplayedViews = new ObservableCollection();
DbViews = new ObservableCollection();
foreach (var type in typeof(ViewsManager).Assembly.GetTypes().Where(x => x.CustomAttributes.Count() > 0 && x.CustomAttributes.First().AttributeType == typeof(DBViewAttribute)).OrderBy(x => x.Name))
{
DbViews.Add(new RegisteredView(type.Name.Replace("View", "").ToTitle(), Activator.CreateInstance(type) as FrameworkElement));
}
}
}
}