#region License
/**
* Ingenious MVC : An MVC framework for .NET 2.0
* Copyright (C) 2006, JDP Group
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Authors: - Kent Boogaart (kentcb@internode.on.net)
*/
#endregion
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Ingenious.Mvc.Configuration;
namespace Ingenious.Mvc.Visualizers{
public partial class ConfigurationInfoUserControl : UserControl
{
private ConfigurationInfo _configurationInfo;
public ConfigurationInfo ConfigurationInfo
{
get
{
return _configurationInfo;
}
set
{
_configurationInfo = value;
Update();
}
}
public ConfigurationInfoUserControl()
{
InitializeComponent();
}
private new void Update()
{
if (ConfigurationInfo != null)
{
_controllerFactoryTextBox.Text = (ConfigurationInfo.ControllerFactory == null) ? null : ConfigurationInfo.ControllerFactory.GetType().FullName;
_navigatorFactoryTextBox.Text = (ConfigurationInfo.NavigatorFactory == null) ? null : ConfigurationInfo.NavigatorFactory.GetType().FullName;
_viewFactoryTextBox.Text = (ConfigurationInfo.ViewFactory == null) ? null : ConfigurationInfo.ViewFactory.GetType().FullName;
_viewManagerFactoryTextBox.Text = (ConfigurationInfo.ViewManagerFactory == null) ? null : ConfigurationInfo.ViewManagerFactory.GetType().FullName;
//starting view ID column for navigators
_navigatorInfosListView.AddColumn<NavigatorInfo>("Starting View ID", 100, delegate(NavigatorInfo navigatorInfo)
{
if (navigatorInfo.StartViewInfo == null)
{
return null;
}
else
{
return navigatorInfo.StartViewInfo.Id;
}
});
//view manager ID column for navigators
_navigatorInfosListView.AddColumn<NavigatorInfo>("View Manager ID", 100, delegate(NavigatorInfo navigatorInfo)
{
if (navigatorInfo.ViewManagerInfo == null)
{
return null;
}
else
{
return navigatorInfo.ViewManagerInfo.Id;
}
});
//controller ID column for views
_viewsInfoListView.AddColumn<ViewInfo>("Controller ID", 100, delegate(ViewInfo viewInfo)
{
if (viewInfo.ControllerInfo == null)
{
return null;
}
else
{
return viewInfo.ControllerInfo.Id;
}
});
//find all controllers
InfoCollection<Id<IController>, ControllerInfo> controllerInfos = new InfoCollection<Id<IController>, ControllerInfo>();
foreach (ViewInfo viewInfo in _configurationInfo.ViewInfos)
{
if ((viewInfo.ControllerInfo != null) && (!controllerInfos.Contains(viewInfo.ControllerInfo)))
{
controllerInfos.Add(viewInfo.ControllerInfo);
}
}
//find all view managers
InfoCollection<Id<IViewManager>, ViewManagerInfo> viewManagerInfos = new InfoCollection<Id<IViewManager>, ViewManagerInfo>();
foreach (NavigatorInfo navigatorInfo in _configurationInfo.NavigatorInfos)
{
if ((navigatorInfo.ViewManagerInfo != null) && (!viewManagerInfos.Contains(navigatorInfo.ViewManagerInfo)))
{
viewManagerInfos.Add(navigatorInfo.ViewManagerInfo);
}
}
_controllersInfoListView.Initialize(controllerInfos);
_navigatorInfosListView.Initialize(_configurationInfo.NavigatorInfos);
_viewsInfoListView.Initialize(_configurationInfo.ViewInfos);
_viewManagersInfoListView.Initialize(viewManagerInfos);
}
}
}
}
|