Beispiel #1
0
        /// <summary>
        /// Called when an exit is requested.
        /// </summary>
        /// <param name="applicationFacade">
        /// The object that contains the methods that allow interaction
        /// with the kernel.
        /// </param>
        private static void OnExit(IAbstractApplications applicationFacade)
        {
            // If there is no application facade, then we're in
            // designer mode, or something else silly.
            if (applicationFacade == null)
            {
                return;
            }

            // the only catch is that the Shutdown method will return before
            // we know if the shutdown will be cancelled?
            applicationFacade.Shutdown();
        }
Beispiel #2
0
        /// <summary>
        /// Loads the kernel.
        /// </summary>
        private static void LoadKernel()
        {
            // At a later stage we need to clean this up.
            // there are two constants and a DI reference.
            var bootstrapper = new KernelBootstrapper(
                s_ShutdownEvent,
                container =>
            {
                s_UiContainer       = container;
                s_ScriptHost        = s_UiContainer.Resolve <IHostScripts>();
                s_Diagnostics       = s_UiContainer.Resolve <SystemDiagnostics>();
                s_ApplicationFacade = s_UiContainer.Resolve <IAbstractApplications>();
            });

            // Load the core system. This will automatically
            // run the UI bootstrapper which will then
            // load up the UI and display it.
            bootstrapper.Load();
        }
Beispiel #3
0
        /// <summary>
        /// Loads the kernel.
        /// </summary>
        private static void LoadKernel()
        {
            // At a later stage we need to clean this up.
            // there are two constants and a DI reference.
            var bootstrapper = new KernelBootstrapper(
                s_ShutdownEvent,
                container =>
                {
                    s_UiContainer = container;
                    s_ScriptHost = s_UiContainer.Resolve<IHostScripts>();
                    s_Diagnostics = s_UiContainer.Resolve<SystemDiagnostics>();
                    s_ApplicationFacade = s_UiContainer.Resolve<IAbstractApplications>();
                });

            // Load the core system. This will automatically
            // run the UI bootstrapper which will then
            // load up the UI and display it.
            bootstrapper.Load();
        }
Beispiel #4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ExitCommand"/> class.
 /// </summary>
 /// <param name="applicationFacade">
 /// The object that contains the methods that allow interaction
 /// with the kernel.
 /// </param>
 public ExitCommand(IAbstractApplications applicationFacade)
     : base(obj => OnExit(applicationFacade), obj => CanExit(applicationFacade))
 {
 }
Beispiel #5
0
 private static bool CanExit(IAbstractApplications applicationFacade)
 {
     // If there is no application facade, then we're in
     // designer mode, or something else silly.
     return(applicationFacade != null);
 }