/// <summary> /// Initializes a new instance of the ConsoleViewPresenter class. /// </summary> /// <param name="consoleView">Console view.</param> /// <param name="fileWatcherController">FileWatcherController.</param> /// <param name="logger">Logger.</param> /// <param name="formatter">Log formatter.</param> /// <param name="xmlConfigFilePath">Path of the configuration XML file.</param> /// <param name="xmlSchemaConfigFilePath">Path of the configuration XML Schema file.</param> /// <exception cref="ArgumentNullException">xmlConfigFilePath is null.</exception> /// <exception cref="ArgumentNullException">xmlSchemaConfigFilePath is null.</exception> public ConsoleViewPresenter(IConsoleView consoleView, FileWatcherController fileWatcherController, ILogger logger, IFormatter formatter, string xmlConfigFilePath, string xmlSchemaConfigFilePath) : base(fileWatcherController, logger, formatter) { if (consoleView == null) { throw new ArgumentNullException("consoleView", Resources.ArgumentNullException); } if (xmlConfigFilePath == null) { throw new ArgumentNullException("xmlConfigFilePath", Resources.ArgumentNullException); } if (xmlSchemaConfigFilePath == null) { throw new ArgumentNullException("xmlSchemaConfigFilePath", Resources.ArgumentNullException); } _consoleView = consoleView; _xmlConfigFilePath = xmlConfigFilePath; _xmlSchemaConfigFilePath = xmlSchemaConfigFilePath; SubscribeToConsoleViewEvents(); }
/// <summary> /// Initializes a new instance of the OptionsViewPresenter class. /// </summary> /// <param name="optionsView">Options view.</param> /// <param name="mainView">Main view.</param> /// <param name="fileWatcherController">FileWatcherController.</param> /// <param name="applicationOptionsController">ApplicationOptionsController.</param> /// <exception cref="ArgumentNullException">fileWatcherController is null.</exception> public OptionsViewPresenter(IOptionsView optionsView, IMainView mainView, FileWatcherController fileWatcherController, ApplicationOptionsController applicationOptionsController) { if (mainView == null) { throw new ArgumentNullException("mainView", Resources.ArgumentNullException); } if (optionsView == null) { throw new ArgumentNullException("optionsView", Resources.ArgumentNullException); } if (fileWatcherController == null) { throw new ArgumentNullException("fileWatcherController", Resources.ArgumentNullException); } if (applicationOptionsController == null) { throw new ArgumentNullException("applicationOptionsController", Resources.ArgumentNullException); } _optionsView = optionsView; _mainView = mainView; _fileWatcherController = fileWatcherController; _applicationOptionsController = applicationOptionsController; SubscribeToMainViewEvents(); SubscribeToOptionsViewEvents(); }
/// <summary> /// Initializes a new instance of the ApplicationOptionsController class. /// </summary> /// <param name="fileWatcherController">FileWatcherController.</param> /// <param name="xmlApplicationOptionsFilePath">Path of the configuration XML file.</param> /// <param name="xmlSchemaApplicationOptionsFilePath">Path of the configuration XML Schema file.</param> /// <param name="applicationOptions">Application options.</param> /// <exception cref="ArgumentNullException">fileWatcherController is null.</exception> /// <exception cref="ArgumentNullException">xmlApplicationOptionsFilePath is null.</exception> /// <exception cref="ArgumentNullException">xmlSchemaApplicationOptionsFilePath is null.</exception> /// <exception cref="ArgumentNullException">applicationOptions is null.</exception> public ApplicationOptionsController(FileWatcherController fileWatcherController, string xmlApplicationOptionsFilePath, string xmlSchemaApplicationOptionsFilePath, ApplicationOptions applicationOptions) { if (fileWatcherController == null) { throw new ArgumentNullException("fileWatcherController", Resources.ArgumentNullException); } if (xmlApplicationOptionsFilePath == null) { throw new ArgumentNullException("xmlApplicationOptionsFilePath", Resources.ArgumentNullException); } if (xmlSchemaApplicationOptionsFilePath == null) { throw new ArgumentNullException("xmlSchemaApplicationOptionsFilePath", Resources.ArgumentNullException); } if (applicationOptions == null) { throw new ArgumentNullException("applicationOptions", Resources.ArgumentNullException); } _fileWatcherController = fileWatcherController; _xmlApplicationOptionsFilePath = xmlApplicationOptionsFilePath; _xmlSchemaApplicationOptionsFilePath = xmlSchemaApplicationOptionsFilePath; _internalApplicationOptions = applicationOptions; }
/// <summary> /// Initializes a new instance of the LogViewPresenterBase class. /// </summary> /// <param name="fileWatcherController">FileWatcherController.</param> /// <param name="formatter">Log formatter.</param> /// <param name="logMessageSize">Log message size.</param> /// <exception cref="ArgumentNullException">fileWatcherController is null.</exception> /// <exception cref="ArgumentNullException">formatter is null.</exception> public LogViewPresenterBase(FileWatcherController fileWatcherController, IFormatter formatter, int logMessageSize) { if (fileWatcherController == null) { throw new ArgumentNullException("fileWatcherController", Resources.ArgumentNullException); } if (formatter == null) { throw new ArgumentNullException("formatter", Resources.ArgumentNullException); } _fileWatcherController = fileWatcherController; _formatter = formatter; LogMessageSize = logMessageSize; SubscribeToFileWatcherControllerEvents(); }
/// <summary> /// Initializes a new instance of the MainViewPresenterBase class. /// </summary> /// <param name="fileWatcherController">FileWatcherController.</param> /// <param name="logger">Logger.</param> /// <param name="formatter">Log formatter.</param> /// <exception cref="ArgumentNullException">fileWatcherController is null.</exception> /// <exception cref="ArgumentNullException">logger is null.</exception> /// <exception cref="ArgumentNullException">formatter is null.</exception> public MainViewPresenterBase(FileWatcherController fileWatcherController, ILogger logger, IFormatter formatter) { if (fileWatcherController == null) { throw new ArgumentNullException("fileWatcherController", Resources.ArgumentNullException); } if (logger == null) { throw new ArgumentNullException("logger", Resources.ArgumentNullException); } if (formatter == null) { throw new ArgumentNullException("formatter", Resources.ArgumentNullException); } _fileWatcherController = fileWatcherController; _logger = logger; _formatter = formatter; SubscribeToFileWatcherControllerEvents(); }
/// <summary> /// Dispose. /// </summary> /// <param name="disposing">True if disposing.</param> protected virtual void Dispose(bool disposing) { if (disposing) { if (_fileWatcherController != null) { _fileWatcherController.Dispose(); _fileWatcherController = null; } } }
/// <summary> /// Initializes a new instance of the PropertiesViewPresenter class. /// </summary> /// <param name="propertiesView">Properties view.</param> /// <param name="mainView">Main view.</param> /// <param name="fileWatcherController">FileWatcherController.</param> /// <param name="xmlConfigFilePath">Path of the configuration XML file.</param> /// <param name="xmlSchemaConfigFilePath">Path of the configuration XML Schema file.</param> /// <exception cref="ArgumentNullException">propertiesView is null.</exception> /// <exception cref="ArgumentNullException">mainView is null.</exception> /// <exception cref="ArgumentNullException">fileWatcherController is null.</exception> /// <exception cref="ArgumentNullException">xmlConfigFilePath is null.</exception> /// <exception cref="ArgumentNullException">xmlSchemaConfigFilePath is null.</exception> public PropertiesViewPresenter(IPropertiesView propertiesView, IMainView mainView, FileWatcherController fileWatcherController, string xmlConfigFilePath, string xmlSchemaConfigFilePath) { if (propertiesView == null) { throw new ArgumentNullException("propertiesView", Resources.ArgumentNullException); } if (mainView == null) { throw new ArgumentNullException("mainView", Resources.ArgumentNullException); } if (fileWatcherController == null) { throw new ArgumentNullException("fileWatcherController", Resources.ArgumentNullException); } if (xmlConfigFilePath == null) { throw new ArgumentNullException("xmlConfigFilePath", Resources.ArgumentNullException); } if (xmlSchemaConfigFilePath == null) { throw new ArgumentNullException("xmlSchemaConfigFilePath", Resources.ArgumentNullException); } _propertiesView = propertiesView; _mainView = mainView; _fileWatcherController = fileWatcherController; _xmlConfigFilePath = xmlConfigFilePath; _xmlSchemaConfigFilePath = xmlSchemaConfigFilePath; SubscribeToMainViewEvents(); SubscribeToPropertiesViewEvents(); }
/// <summary> /// Initializes a new instance of the MainViewPresenter class. /// </summary> /// <param name="mainView">Main view.</param> /// <param name="fileWatcherController">FileWatcherController.</param> /// <param name="logger">Logger.</param> /// <param name="formatter">Log formatter.</param> /// <param name="xmlConfigFilePath">Path of the configuration XML file.</param> /// <param name="xmlSchemaConfigFilePath">Path of the configuration XML Schema file.</param> /// <param name="viewUpdateInterval">View update interval.</param> /// <exception cref="ArgumentNullException">mainView is null.</exception> /// <exception cref="ArgumentNullException">fileWatcherController is null.</exception> /// <exception cref="ArgumentNullException">logger is null.</exception> /// <exception cref="ArgumentNullException">formatter is null.</exception> /// <exception cref="ArgumentNullException">xmlConfigFilePath is null.</exception> /// <exception cref="ArgumentNullException">xmlSchemaConfigFilePath is null.</exception> public MainViewPresenter(IMainView mainView, FileWatcherController fileWatcherController, ILogger logger, IFormatter formatter, string xmlConfigFilePath, string xmlSchemaConfigFilePath, double viewUpdateInterval) : base(fileWatcherController, logger, formatter) { if (mainView == null) { throw new ArgumentNullException("mainView", Resources.ArgumentNullException); } if (fileWatcherController == null) { throw new ArgumentNullException("fileWatcherController", Resources.ArgumentNullException); } if (logger == null) { throw new ArgumentNullException("logger", Resources.ArgumentNullException); } if (formatter == null) { throw new ArgumentNullException("formatter", Resources.ArgumentNullException); } if (xmlConfigFilePath == null) { throw new ArgumentNullException("xmlConfigFilePath", Resources.ArgumentNullException); } if (xmlSchemaConfigFilePath == null) { throw new ArgumentNullException("xmlSchemaConfigFilePath", Resources.ArgumentNullException); } _mainView = mainView; _xmlConfigFilePath = xmlConfigFilePath; _xmlSchemaConfigFilePath = xmlSchemaConfigFilePath; // Check if view interval is less than default value. if (viewUpdateInterval < 100) { _updateTimer.Interval = 100; } else { _updateTimer.Interval = viewUpdateInterval; } // Subscribe to timer event. (updates view). _updateTimer.Elapsed += new ElapsedEventHandler(OnElapsed); // Set synchronization context for running events in main thread. SetSynchronizationContext(); SubscribeToMainViewEvents(); SetFileWatcherSortedDictionary(); // Write message to log. base.WriteApplicationStartedMessage(); }
/// <summary> /// Initializes a new instance of the LogViewPresenterBase class. /// </summary> /// <param name="logView">Log view.</param> /// <param name="mainView">Main view.</param> /// <param name="applicationOptionsController">ApplicationOptionsController.</param> /// <param name="fileWatcherController">FileWatcherController.</param> /// <param name="formatter">Log formatter.</param> /// <param name="viewUpdateInterval">View update interval.</param> /// <param name="logMessageSize">Log message size.</param> /// <exception cref="ArgumentNullException">Log view is null.</exception> /// <exception cref="ArgumentNullException">fileWatcherController is null.</exception> /// <exception cref="ArgumentNullException">formatter is null.</exception> public LogViewPresenter(ILogView logView, IMainView mainView, ApplicationOptionsController applicationOptionsController, FileWatcherController fileWatcherController, IFormatter formatter, double viewUpdateInterval, int logMessageSize) : base(fileWatcherController, formatter, logMessageSize) { if (logView == null) { throw new ArgumentNullException("logView", Resources.ArgumentNullException); } if (mainView == null) { throw new ArgumentNullException("mainView", Resources.ArgumentNullException); } if (applicationOptionsController == null) { throw new ArgumentNullException("applicationOptionsController", Resources.ArgumentNullException); } if (fileWatcherController == null) { throw new ArgumentNullException("fileWatcherController", Resources.ArgumentNullException); } if (formatter == null) { throw new ArgumentNullException("formatter", Resources.ArgumentNullException); } _logView = logView; _mainView = mainView; _applicationOptionsController = applicationOptionsController; // Check if view interval is less than default value. if (viewUpdateInterval < 100) { _updateTimer.Interval = 100; } else { _updateTimer.Interval = viewUpdateInterval; } SubscribeToLogViewEvents(); SubscribeToMainViewEvents(); SubscribeToApplicationOptionsControllerEvents(); // Subscribe to timer event. (updates view). _updateTimer.Elapsed += new ElapsedEventHandler(OnElapsed); // Set synchronization context for running events in main thread. SetSynchronizationContext(); }