Example #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ApplicationFacade"/> class.
        /// </summary>
        /// <param name="service">
        /// The user interface service that handles the communication with the rest of the system.
        /// </param>
        /// <param name="notificationNames">The object that defines the application level notification names.</param>
        /// <param name="diagnostics">The object that provides the diagnostics methods for the application.</param>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="service"/> is <see langword="null" />.
        /// </exception>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="notificationNames"/> is <see langword="null" />.
        /// </exception>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="diagnostics"/> is <see langword="null" />.
        /// </exception>
        internal ApplicationFacade(IUserInterfaceService service, INotificationNameConstants notificationNames, SystemDiagnostics diagnostics)
        {
            {
                Enforce.Argument(() => service);
            }

            m_Service = service;
            m_Service.RegisterNotification(notificationNames.SystemShuttingDown, HandleApplicationShutdown);

            // Initialize the system information object.
            m_SystemInformation = new SystemInformation(
                () => DateTimeOffset.Now,
                () => new SystemInformationStorage() { StartupTime = DateTimeOffset.Now });

            m_Diagnostics = diagnostics;
        }
Example #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ApplicationFacade"/> class.
        /// </summary>
        /// <param name="service">
        /// The user interface service that handles the communication with the rest of the system.
        /// </param>
        /// <param name="notificationNames">The object that defines the application level notification names.</param>
        /// <param name="diagnostics">The object that provides the diagnostics methods for the application.</param>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="service"/> is <see langword="null" />.
        /// </exception>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="notificationNames"/> is <see langword="null" />.
        /// </exception>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="diagnostics"/> is <see langword="null" />.
        /// </exception>
        internal ApplicationFacade(IUserInterfaceService service, INotificationNameConstants notificationNames, SystemDiagnostics diagnostics)
        {
            {
                Enforce.Argument(() => service);
            }

            m_Service = service;
            m_Service.RegisterNotification(notificationNames.SystemShuttingDown, HandleApplicationShutdown);

            // Initialize the system information object.
            m_SystemInformation = new SystemInformation(
                () => DateTimeOffset.Now,
                () => new SystemInformationStorage()
            {
                StartupTime = DateTimeOffset.Now
            });

            m_Diagnostics = diagnostics;
        }