Beispiel #1
0
        /// <summary>
        /// Shuts the application down.
        /// </summary>
        public void Shutdown()
        {
            if (m_IsApplicationShuttingDown)
            {
                return;
            }

            m_Diagnostics.Log(
                LevelToLog.Trace,
                HostConstants.LogPrefix,
                Resources.UserInterface_LogMessage_ShuttingDown);

            var context = new ShutdownApplicationContext();

            try
            {
                Debug.Assert(m_Service.Contains(ShutdownApplicationCommand.CommandId), "A command has gone missing.");
                m_Service.Invoke(ShutdownApplicationCommand.CommandId, context);
            }
            catch (ArgumentException e)
            {
                m_Diagnostics.Log(
                    LevelToLog.Error,
                    HostConstants.LogPrefix,
                    string.Format(
                        CultureInfo.InvariantCulture,
                        Resources.UserInterface_LogMessage_ShutDownFailed_WithError,
                        e));
            }
        }
Beispiel #2
0
        /// <summary>
        /// Creates a new project.
        /// </summary>
        public void NewProject()
        {
            if (!CanCreateNewProject())
            {
                throw new CannotCreateNewProjectException();
            }

            var context = new CreateProjectContext();

            Debug.Assert(m_Service.Contains(CreateProjectCommand.CommandId), "A command has gone missing.");
            m_Service.Invoke(CreateProjectCommand.CommandId, context);

            var project = context.Result;

            if (project == null)
            {
                throw new FailedToCreateProjectException();
            }

            m_Facade = new ProjectFacade(project.Result);

            RaiseOnNewProjectLoaded();
        }