|
#region Using directives
using System;
using System.Collections.Generic;
using System.Text;
using SmartInstitute.ObjectModel;
using SmartInstitute.Client.Automation.Helpers;
using System.Windows.Forms;
using SmartInstitute.Client.Automation.Views;
using SmartInstitute.Automation.Misc;
using SmartInstitute.Automation.Helpers;
#endregion
namespace SmartInstitute.Client.Automation
{
/// <summary>
/// Singleton root class for automation model. ThD:\VUES\UMS\UniversityManagementAutomation\_Application.cse entire automation
/// library starts from it.
/// </summary>
public static class _Application
{
#region Delegates
public delegate void SendReceiveHandler(object source, SendReceiveArgs e);
public delegate void QuitHandler();
#endregion
#region Events
public static event SendReceiveHandler OnSendReceive;
public static event QuitHandler OnQuit;
#endregion
#region Collections
/// <summary>
/// Collection of open views of object model. Each view contains
/// one model which contains the data. The view shows the data in
/// some way on the UI.
/// </summary>
private readonly static DocumentCollection _Documents = new DocumentCollection();
public static DocumentCollection Documents
{
get
{
return _Documents;
}
}
/// <summary>
/// Collection of students loaded from server. This collection normally contains
/// all the students university has received so far and their basic profile.
/// </summary>
private readonly static StudentModelCollection _Students = new StudentModelCollection();
public static StudentModelCollection Students
{
get
{
return _Students;
}
}
/// <summary>
/// Collection of courses loaded from server.
/// </summary>
private readonly static CourseModelCollection _Courses = new CourseModelCollection();
public static CourseModelCollection Courses
{
get
{
return _Courses;
}
}
#endregion
#region Public Static Methods
public static void Start()
{
LoadHelpers();
}
private static readonly IList<IHelper> _Helpers = new List<IHelper>();
private static void LoadHelpers()
{
// We can make this XML driven which can truly make this extensible
_Helpers.Add(new SettingsHelper());
_Helpers.Add(new SendReceiveHelper());
foreach (IHelper helper in _Helpers)
helper.Init();
}
private static void CloseHelpers()
{
foreach (IHelper helper in _Helpers)
helper.Close();
}
public static bool Close()
{
return true;
}
public static void Quit()
{
CloseHelpers();
if( Close() )
OnQuit();
}
public static void SendReceive(object source, IList<StudentModel> students)
{
if (null != OnSendReceive)
OnSendReceive(source, new SendReceiveArgs(students));
}
#endregion
public readonly static Settings Settings = new Settings();
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.
A list of licenses authors might use can be found here