예제 #1
0
        /// <summary>
        /// Registers the notification.
        /// </summary>
        /// <param name="name">The name of the notification.</param>
        /// <param name="callback">The callback method that is called when the notification is activated.</param>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="name"/> is <see langword="null" />.
        /// </exception>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="callback"/> is <see langword="null" />.
        /// </exception>
        public void RegisterNotification(NotificationName name, Action <INotificationArguments> callback)
        {
            if (m_IsApplicationShuttingDown)
            {
                return;
            }

            m_Service.RegisterNotification(name, callback);
        }
예제 #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;
        }
예제 #3
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;
        }