/// <summary> /// Create a schedule /// </summary> /// <param name="scheduleLocation"></param> public Schedule(string scheduleLocation, ref CacheManager cacheManager, ref ClientInfo clientInfoForm) { Trace.WriteLine(string.Format("XMDS Location: {0}", ApplicationSettings.Default.XiboClient_xmds_xmds)); // Get the key for this display _hardwareKey = new HardwareKey(); // Save the schedule location _scheduleLocation = scheduleLocation; // Create a new collection for the layouts in the schedule _layoutSchedule = new Collection <ScheduleItem>(); // Set cachemanager _cacheManager = cacheManager; // Set client info form _clientInfoForm = clientInfoForm; // Create a Register Agent _registerAgent = new RegisterAgent(); _registerAgent.OnXmrReconfigure += _registerAgent_OnXmrReconfigure; _registerAgentThread = new Thread(new ThreadStart(_registerAgent.Run)); _registerAgentThread.Name = "RegisterAgentThread"; // Create a schedule manager _scheduleManager = new ScheduleManager(_cacheManager, scheduleLocation); _scheduleManager.OnNewScheduleAvailable += new ScheduleManager.OnNewScheduleAvailableDelegate(_scheduleManager_OnNewScheduleAvailable); _scheduleManager.OnRefreshSchedule += new ScheduleManager.OnRefreshScheduleDelegate(_scheduleManager_OnRefreshSchedule); _scheduleManager.OnScheduleManagerCheckComplete += _scheduleManager_OnScheduleManagerCheckComplete; _scheduleManager.ClientInfoForm = _clientInfoForm; // Create a schedule manager thread _scheduleManagerThread = new Thread(new ThreadStart(_scheduleManager.Run)); _scheduleManagerThread.Name = "ScheduleManagerThread"; // Create a RequiredFilesAgent _scheduleAndRfAgent = new ScheduleAndFilesAgent(); _scheduleAndRfAgent.CurrentCacheManager = cacheManager; _scheduleAndRfAgent.CurrentScheduleManager = _scheduleManager; _scheduleAndRfAgent.ScheduleLocation = scheduleLocation; _scheduleAndRfAgent.HardwareKey = _hardwareKey.Key; _scheduleAndRfAgent.OnFullyProvisioned += _requiredFilesAgent_OnFullyProvisioned; _scheduleAndRfAgent.ClientInfoForm = _clientInfoForm; _scheduleAndRfAgent.OnComplete += new ScheduleAndFilesAgent.OnCompleteDelegate(LayoutFileModified); // Create a thread for the RequiredFiles Agent to run in - but dont start it up yet. _scheduleAndRfAgentThread = new Thread(new ThreadStart(_scheduleAndRfAgent.Run)); _scheduleAndRfAgentThread.Name = "RequiredFilesAgentThread"; // Library Agent _libraryAgent = new LibraryAgent(); _libraryAgent.CurrentCacheManager = _cacheManager; // Create a thread for the Library Agent to run in - but dont start it up yet. _libraryAgentThread = new Thread(new ThreadStart(_libraryAgent.Run)); _libraryAgentThread.Name = "LibraryAgent"; // Log Agent _logAgent = new LogAgent(); _logAgentThread = new Thread(new ThreadStart(_logAgent.Run)); _logAgentThread.Name = "LogAgent"; // XMR Subscriber _xmrSubscriber = new XmrSubscriber(); _xmrSubscriber.HardwareKey = _hardwareKey; _xmrSubscriber.ClientInfoForm = _clientInfoForm; _xmrSubscriber.OnAction += _xmrSubscriber_OnAction; // Thread start _xmrSubscriberThread = new Thread(new ThreadStart(_xmrSubscriber.Run)); _xmrSubscriberThread.Name = "XmrSubscriber"; // Embedded Server _server = new EmbeddedServer(); _server.ClientInfoForm = _clientInfoForm; _server.OnServerClosed += _server_OnServerClosed; _serverThread = new Thread(new ThreadStart(_server.Run)); _serverThread.Name = "EmbeddedServer"; }
/// <summary> /// Create a schedule /// </summary> /// <param name="scheduleLocation"></param> public Schedule(string scheduleLocation, ref CacheManager cacheManager, ref ClientInfo clientInfoForm) { Trace.WriteLine(string.Format("XMDS Location: {0}", ApplicationSettings.Default.XiboClient_xmds_xmds)); // Get the key for this display _hardwareKey = new HardwareKey(); // Save the schedule location _scheduleLocation = scheduleLocation; // Create a new collection for the layouts in the schedule _layoutSchedule = new Collection <LayoutSchedule>(); // Set cachemanager _cacheManager = cacheManager; // Set client info form _clientInfoForm = clientInfoForm; // Create a Register Agent _registerAgent = new RegisterAgent(); _registerAgentThread = new Thread(new ThreadStart(_registerAgent.Run)); _registerAgentThread.Name = "RegisterAgentThread"; // Create a schedule manager _scheduleManager = new ScheduleManager(_cacheManager, scheduleLocation); _scheduleManager.OnNewScheduleAvailable += new ScheduleManager.OnNewScheduleAvailableDelegate(_scheduleManager_OnNewScheduleAvailable); _scheduleManager.OnRefreshSchedule += new ScheduleManager.OnRefreshScheduleDelegate(_scheduleManager_OnRefreshSchedule); _scheduleManager.ClientInfoForm = _clientInfoForm; // Create a schedule manager thread _scheduleManagerThread = new Thread(new ThreadStart(_scheduleManager.Run)); _scheduleManagerThread.Name = "ScheduleManagerThread"; // Create a Schedule Agent _scheduleAgent = new ScheduleAgent(); _scheduleAgent.CurrentScheduleManager = _scheduleManager; _scheduleAgent.ScheduleLocation = scheduleLocation; _scheduleAgent.HardwareKey = _hardwareKey.Key; _scheduleAgent.ClientInfoForm = _clientInfoForm; // Create a thread for the Schedule Agent to run in - but dont start it up yet. _scheduleAgentThread = new Thread(new ThreadStart(_scheduleAgent.Run)); _scheduleAgentThread.Name = "ScheduleAgentThread"; // Create a RequiredFilesAgent _requiredFilesAgent = new RequiredFilesAgent(); _requiredFilesAgent.CurrentCacheManager = cacheManager; _requiredFilesAgent.HardwareKey = _hardwareKey.Key; _requiredFilesAgent.ClientInfoForm = _clientInfoForm; _requiredFilesAgent.OnComplete += new RequiredFilesAgent.OnCompleteDelegate(LayoutFileModified); // Create a thread for the RequiredFiles Agent to run in - but dont start it up yet. _requiredFilesAgentThread = new Thread(new ThreadStart(_requiredFilesAgent.Run)); _requiredFilesAgentThread.Name = "RequiredFilesAgentThread"; // Library Agent _libraryAgent = new LibraryAgent(); _libraryAgent.CurrentCacheManager = _cacheManager; // Create a thread for the Library Agent to run in - but dont start it up yet. _libraryAgentThread = new Thread(new ThreadStart(_libraryAgent.Run)); _libraryAgentThread.Name = "LibraryAgent"; // Log Agent _logAgent = new LogAgent(); _logAgentThread = new Thread(new ThreadStart(_logAgent.Run)); _logAgentThread.Name = "LogAgent"; }