/// <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; }
/// <summary> /// Initializes a new instance of the <see cref="UserInterfaceService"/> class. /// </summary> /// <param name="container">The container that stores all the references for the application.</param> /// <param name="onStartService"> /// The method that stores the IOC container that contains the references for the entire application. /// </param> /// <param name="diagnostics">The object that provides the diagnostics methods for the application.</param> /// <exception cref="ArgumentNullException"> /// Thrown if <paramref name="container"/> is <see langword="null"/>. /// </exception> /// <exception cref="ArgumentNullException"> /// Thrown when <paramref name="onStartService"/> is <see langword="null"/>. /// </exception> /// <exception cref="ArgumentNullException"> /// Thrown if <paramref name="diagnostics"/> is <see langword="null" />. /// </exception> public UserInterfaceService(IContainer container, Action <IContainer> onStartService, SystemDiagnostics diagnostics) : base(diagnostics) { { Enforce.Argument(() => container); Enforce.Argument(() => onStartService); } m_Container = container; m_NotificationNames = container.Resolve <INotificationNameConstants>(); m_Diagnostics = container.Resolve <SystemDiagnostics>(); m_OnStartService = onStartService; m_Commands = container.Resolve <ICommandContainer>(); { m_Commands.Add( ShutdownApplicationCommand.CommandId, () => new ShutdownApplicationCommand(() => m_Core.Shutdown())); m_Commands.Add( CreateProjectCommand.CommandId, () => new CreateProjectCommand( () => { m_Projects.CreateNewProject(); return(m_Projects.Current); })); m_Commands.Add( LoadProjectCommand.CommandId, () => new LoadProjectCommand( persistenceInformation => { m_Projects.LoadProject(persistenceInformation); return(m_Projects.Current); })); m_Commands.Add( UnloadProjectCommand.CommandId, () => new UnloadProjectCommand(() => m_Projects.UnloadProject())); } }
/// <summary> /// Initializes a new instance of the <see cref="UserInterfaceService"/> class. /// </summary> /// <param name="container">The container that stores all the references for the application.</param> /// <param name="onStartService"> /// The method that stores the IOC container that contains the references for the entire application. /// </param> /// <param name="diagnostics">The object that provides the diagnostics methods for the application.</param> /// <exception cref="ArgumentNullException"> /// Thrown if <paramref name="container"/> is <see langword="null"/>. /// </exception> /// <exception cref="ArgumentNullException"> /// Thrown when <paramref name="onStartService"/> is <see langword="null"/>. /// </exception> /// <exception cref="ArgumentNullException"> /// Thrown if <paramref name="diagnostics"/> is <see langword="null" />. /// </exception> public UserInterfaceService(IContainer container, Action<IContainer> onStartService, SystemDiagnostics diagnostics) : base(diagnostics) { { Enforce.Argument(() => container); Enforce.Argument(() => onStartService); } m_Container = container; m_NotificationNames = container.Resolve<INotificationNameConstants>(); m_Diagnostics = container.Resolve<SystemDiagnostics>(); m_OnStartService = onStartService; m_Commands = container.Resolve<ICommandContainer>(); { m_Commands.Add( ShutdownApplicationCommand.CommandId, () => new ShutdownApplicationCommand(() => m_Core.Shutdown())); m_Commands.Add( CreateProjectCommand.CommandId, () => new CreateProjectCommand( () => { m_Projects.CreateNewProject(); return m_Projects.Current; })); m_Commands.Add( LoadProjectCommand.CommandId, () => new LoadProjectCommand( persistenceInformation => { m_Projects.LoadProject(persistenceInformation); return m_Projects.Current; })); m_Commands.Add( UnloadProjectCommand.CommandId, () => new UnloadProjectCommand(() => m_Projects.UnloadProject())); } }