Пример #1
0
        /// <summary>
        /// Shuts down the editor.
        /// </summary>
        /// <remarks>
        /// This method should only be called by the owner of the <see cref="EditorViewModel"/>.
        /// <see cref="EditorExtension"/>s should call <see cref="Exit"/> to end the application.
        /// </remarks>
        public void Shutdown()
        {
            Logger.Debug("Shutting down editor.");

            foreach (var extension in OrderedExtensions.Reverse())
            {
                extension.Shutdown();
            }

            foreach (var extension in OrderedExtensions.Reverse())
            {
                extension.Uninitialize();
            }

            Extensions.IsLocked = false;

            Settings.Default.Save();

            EditorHelper.UnregisterResources(_resourceDictionary);
        }
Пример #2
0
        /// <inheritdoc/>
        public override async Task <bool> CanCloseAsync()
        {
            foreach (var extension in OrderedExtensions.OfType <IGuardClose>())
            {
                bool canClose = await extension.CanCloseAsync();

                if (!canClose)
                {
                    return(false);
                }
            }

            foreach (var item in Items)
            {
                bool canClose = await item.CanCloseAsync();

                if (!canClose)
                {
                    return(false);
                }
            }

            return(await base.CanCloseAsync());
        }