private void ButtonInfo_Click(ProcedureUI.Button sender)
 {
     if (Script != null)
     {
         EditorMessageBox.ShowInfo(GetInfo(Script));
     }
 }
Esempio n. 2
0
        public static bool IsInstalled(string packageName)
        {
            var fileName = Path.Combine(PackagesFolder, "PackagesState.txt");

            if (File.Exists(fileName))
            {
                var block = TextBlockUtility.LoadFromRealFile(fileName, out var error);
                if (!string.IsNullOrEmpty(error))
                {
                    EditorMessageBox.ShowWarning(error);
                    return(false);
                }

                foreach (var child in block.Children)
                {
                    if (child.Name == "Package")
                    {
                        if (child.GetAttribute("Name") == packageName)
                        {
                            return(true);
                        }
                    }
                }
            }
            return(false);
        }
Esempio n. 3
0
        private void kryptonButtonDelete_Click(object sender, EventArgs e)
        {
            if (selectedPackage == null)
            {
                return;
            }
            if (!File.Exists(selectedPackage.FullFilePath))
            {
                return;
            }

            var template = Translate("Are you sure you want to delete \'{0}\'?");
            var text     = string.Format(template, selectedPackage.FullFilePath);

            if (EditorMessageBox.ShowQuestion(text, EMessageBoxButtons.YesNo) == EDialogResult.No)
            {
                return;
            }

            try
            {
                File.Delete(selectedPackage.FullFilePath);
            }
            catch (Exception e2)
            {
                EditorMessageBox.ShowWarning(e2.Message);
                return;
            }

            needUpdateList = true;
        }
Esempio n. 4
0
        private void ButtonExport_Click(ProcedureUI.Button sender)
        {
            var meshes = GetObjects <Component_Mesh>();

            if (meshes.Length != 1)
            {
                return;
            }
            var mesh = meshes[0];

#if !DEPLOY
            var dialog = new SaveFileDialog();
            //dialog.InitialDirectory = Path.GetDirectoryName( RealFileName );
            //dialog.FileName = RealFileName;
            dialog.Filter           = "FBX files (*.fbx)|*.fbx";
            dialog.RestoreDirectory = true;
            if (dialog.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            var fileName = dialog.FileName;

            if (!mesh.ExportToFBX(fileName, out var error))
            {
                EditorMessageBox.ShowWarning(error);
            }
#endif
        }
Esempio n. 5
0
        private void ButtonClearAll_Click(ProcedureUI.Button sender)
        {
            if (EditorMessageBox.ShowQuestion(Translate("Delete all objects and child components?"), MessageBoxButtons.YesNo) != DialogResult.Yes)
            {
                return;
            }

            var undoMultiAction = new UndoMultiAction();

            foreach (var groupOfObjects in GetObjects <Component_GroupOfObjects>())
            {
                var indexes = groupOfObjects.ObjectsGetAll();
                if (indexes.Count != 0)
                {
                    var action = new Component_GroupOfObjects_Editor.UndoActionCreateDelete(groupOfObjects, indexes.ToArray(), false, true);
                    undoMultiAction.AddAction(action);
                }

                var components = groupOfObjects.GetComponents();
                undoMultiAction.AddAction(new UndoActionComponentCreateDelete(Provider.DocumentWindow.Document, components, false));
            }

            if (undoMultiAction.Actions.Count != 0)
            {
                Provider.DocumentWindow.Document.CommitUndoAction(undoMultiAction);
            }
        }
Esempio n. 6
0
        void PackagingUpdate()
        {
            //check ended
            if (packageBuildInstance != null && packageBuildInstance.State != ProductBuildInstance.StateEnum.Building)
            {
                var instance2 = packageBuildInstance;
                packageBuildInstance = null;

                if (instance2.State == ProductBuildInstance.StateEnum.Error)
                {
                    EditorMessageBox.ShowWarning(instance2.Error);
                }
            }

            //update controls

            var building = packageBuildInstance != null && packageBuildInstance.State == ProductBuildInstance.StateEnum.Building;

            kryptonButtonPackageCreate.Enabled             = CanPackageProject();
            kryptonButtonPackageCreateAndRun.Enabled       = kryptonButtonPackageCreate.Enabled && GetSelectedBuildConfiguration() != null && GetSelectedBuildConfiguration().SupportsBuildAndRun;
            kryptonTextBoxPackageDestinationFolder.Enabled = !building;
            kryptonButtonPackageBrowse.Enabled             = !building;
            contentBrowserPackage.Enabled = !building;
            if (packageBuildInstance != null)
            {
                progressBarBuild.Value = (int)(packageBuildInstance.Progress * 100);
            }
            progressBarBuild.Visible         = building;
            kryptonButtonBuildCancel.Visible = building;
        }
Esempio n. 7
0
        private void ButtonClearObjects_Click(ProcedureUI.Button obj)
        {
            if (EditorMessageBox.ShowQuestion(Translate("Delete all objects of the element?"), MessageBoxButtons.YesNo) != DialogResult.Yes)
            {
                return;
            }

            var undoMultiAction = new UndoMultiAction();

            foreach (var element in GetObjects <Component_GroupOfObjectsElement>())
            {
                var groupOfObjects = element.Parent as Component_GroupOfObjects;
                if (groupOfObjects != null)
                {
                    var indexes = element.GetObjectsOfElement();
                    if (indexes.Count != 0)
                    {
                        var action = new Component_GroupOfObjects_Editor.UndoActionCreateDelete(groupOfObjects, indexes.ToArray(), false, true);
                        undoMultiAction.AddAction(action);
                    }
                }
            }

            if (undoMultiAction.Actions.Count != 0)
            {
                Provider.DocumentWindow.Document.CommitUndoAction(undoMultiAction);
            }
        }
Esempio n. 8
0
        private void ButtonUpload_Click(ProcedureUI.Button sender)
        {
            if (EditorMessageBox.ShowQuestion("Upload selected products to the store?", EMessageBoxButtons.OKCancel) == EDialogResult.Cancel)
            {
                return;
            }

            var item = ScreenNotifications.ShowSticky("Processing...");

            try
            {
                foreach (var product in GetObjects <Component_StoreProduct>())
                {
                    if (!product.BuildArchive())
                    {
                        return;
                    }
                }
            }
            catch (Exception e)
            {
                Log.Warning(e.Message);
                return;
            }
            finally
            {
                item.Close();
            }

            ScreenNotifications.Show("The product was prepared successfully.");
        }
        private void ButtonGenerate_Click(ProcedureUI.Button sender)
        {
            //!!!!support undo
            var text = "Generate world?\n\nUnable to undo the action.";

            if (EditorMessageBox.ShowQuestion(text, EMessageBoxButtons.OKCancel) == EDialogResult.Cancel)
            {
                return;
            }

            var notification = ScreenNotifications.ShowSticky("Processing...");

            try
            {
                foreach (var generator in GetObjects <Component_WorldGenerator>())
                {
                    generator.Generate(Provider.DocumentWindow.Document);
                }

                //!!!!
                //clear undo history
                Provider.DocumentWindow.Document?.UndoSystem.Clear();
            }
            finally
            {
                notification.Close();
            }
        }
Esempio n. 10
0
        private void kryptonNavigator1_TabClicked(object sender, ComponentFactory.Krypton.Navigator.KryptonPageEventArgs e)
        {
            //if( e.Item == kryptonPageSettings )
            //{
            //	Hide();
            //	EditorAPI.ShowProjectSettings();
            //	return;
            //}

            if (e.Item == kryptonPageBuild)
            {
                if (packagingNeedInit)
                {
                    PackagingInit();
                }
                return;
            }

            if (e.Item == kryptonPageExit)
            {
                if (EditorMessageBox.ShowQuestion(Translate("Exit the editor?"), EMessageBoxButtons.OKCancel) == EDialogResult.OK)
                {
                    EditorForm.Instance.Close();
                }
                return;
            }
        }
Esempio n. 11
0
        public static bool ChangeInstalledState(string packageName, bool installed)
        {
            var fileName = Path.Combine(PackagesFolder, "PackagesState.txt");

            //load
            TextBlock block;

            if (File.Exists(fileName))
            {
                block = TextBlockUtility.LoadFromRealFile(fileName, out var error);
                if (!string.IsNullOrEmpty(error))
                {
                    EditorMessageBox.ShowWarning(error);
                    return(false);
                }
            }
            else
            {
                block = new TextBlock();
            }

            //update
            {
                foreach (var child in block.Children)
                {
                    if (child.Name == "Package")
                    {
                        if (child.GetAttribute("Name") == packageName)
                        {
                            block.DeleteChild(child);
                            break;
                        }
                    }
                }

                if (installed)
                {
                    var child = block.AddChild("Package");
                    child.SetAttribute("Name", packageName);
                }
            }

            //save
            {
                if (!Directory.Exists(PackagesFolder))
                {
                    Directory.CreateDirectory(PackagesFolder);
                }

                TextBlockUtility.SaveToRealFile(block, fileName, out var error);
                if (!string.IsNullOrEmpty(error))
                {
                    EditorMessageBox.ShowWarning(error);
                    return(false);
                }
            }

            return(true);
        }
Esempio n. 12
0
        private unsafe void ButtonUpdateVariations_Click(ProcedureUI.Button sender)
        {
            if (EditorMessageBox.ShowQuestion(Translate("Update variations of the objects?"), MessageBoxButtons.YesNo) != DialogResult.Yes)
            {
                return;
            }

            UpdateSurfaceElementVariations(false);
        }
Esempio n. 13
0
        private void ButtonResetColors_Click(ProcedureUI.Button obj)
        {
            if (EditorMessageBox.ShowQuestion(Translate("Reset color of the objects to \'1 1 1\'?"), MessageBoxButtons.YesNo) != DialogResult.Yes)
            {
                return;
            }

            ResetColors();
        }
Esempio n. 14
0
        private void ButtonRandomizeGroups_Click(ProcedureUI.Button obj)
        {
            if (EditorMessageBox.ShowQuestion(Translate("Refresh surface groups randomly?"), MessageBoxButtons.YesNo) != DialogResult.Yes)
            {
                return;
            }

            UpdateSurfaceElementVariations(true);
        }
Esempio n. 15
0
        void CreateScene(ContentBrowser.Item item)
        {
            try
            {
                var prefix = VirtualDirectory.Exists("Scenes") ? @"Scenes\" : "";

                string fileName = null;
                for (int n = 1; ; n++)
                {
                    string f = prefix + string.Format(@"New{0}.scene", n > 1 ? n.ToString() : "");
                    if (!VirtualFile.Exists(f))
                    {
                        fileName = f;
                        break;
                    }
                }

                if (!string.IsNullOrEmpty(fileName))
                {
                    var realFileName = VirtualPathUtility.GetRealPathByVirtual(fileName);

                    var    template   = (Component_Scene.NewObjectSettingsScene.TemplateClass)item.Tag;
                    string name       = template.Name + ".scene";
                    var    sourceFile = VirtualPathUtility.GetRealPathByVirtual(@"Base\Tools\NewResourceTemplates\" + name);

                    //copy scene file

                    var text = File.ReadAllText(sourceFile);

                    var directoryName = Path.GetDirectoryName(realFileName);
                    if (!Directory.Exists(directoryName))
                    {
                        Directory.CreateDirectory(directoryName);
                    }

                    File.WriteAllText(realFileName, text);

                    //copy additional folder if exist
                    var sourceFolderPath = sourceFile + "_Files";
                    if (Directory.Exists(sourceFolderPath))
                    {
                        var destFolderPath = realFileName + "_Files";
                        IOUtility.CopyDirectory(sourceFolderPath, destFolderPath);
                    }

                    EditorAPI.SelectFilesOrDirectoriesInMainResourcesWindow(new string[] { realFileName });
                    EditorAPI.OpenFileAsDocument(realFileName, true, true);
                }
            }
            catch (Exception e)
            {
                EditorMessageBox.ShowWarning(e.Message);
                //Log.Warning( e.Message );
                return;
            }
        }
Esempio n. 16
0
        void PackageCreate(bool run)
        {
            string folder = kryptonTextBoxPackageDestinationFolder.Text.Trim();

            if (string.IsNullOrEmpty(folder))
            {
                return;
            }

            //clear destination folder
            if (Directory.Exists(folder) && !IOUtility.IsDirectoryEmpty(folder))
            {
                var text = string.Format(Translate("Destination folder \'{0}\' is not empty. Clear folder and continue?"), folder);
                if (EditorMessageBox.ShowQuestion(text, MessageBoxButtons.OKCancel) == DialogResult.Cancel)
                {
                    return;
                }

                //delete
                try
                {
                    DirectoryInfo info = new DirectoryInfo(folder);
                    foreach (FileInfo file in info.GetFiles())
                    {
                        file.Delete();
                    }
                    foreach (DirectoryInfo directory in info.GetDirectories())
                    {
                        directory.Delete(true);
                    }
                }
                catch (Exception e)
                {
                    EditorMessageBox.ShowWarning(e.Message);
                    return;
                }
            }

            //start
            try
            {
                if (!Directory.Exists(folder))
                {
                    Directory.CreateDirectory(folder);
                }

                packageBuildInstance = ProductBuildInstance.Start(GetSelectedBuildConfiguration(), folder, run);
            }
            catch (Exception e)
            {
                EditorMessageBox.ShowWarning(e.Message);
                return;
            }

            PackagingUpdate();
        }
Esempio n. 17
0
        private void kryptonButtonDarkTheme_Click(object sender, EventArgs e)
        {
            if (EditorMessageBox.ShowQuestion("Set the dark theme and restart the editor to apply changes?", MessageBoxButtons.OKCancel) == DialogResult.Cancel)
            {
                return;
            }

            ProjectSettings.Get.Theme = Component_ProjectSettings.ThemeEnum.Dark;
            ProjectSettings.SaveToFileAndUpdate();
            EditorAPI.BeginRestartApplication();
        }
Esempio n. 18
0
        private void kryptonButtonDelete_Click(object sender, EventArgs e)
        {
            if (selectedPackage == null)
            {
                return;
            }

            bool installed = PackageManager.IsInstalled(selectedPackage.Identifier);

            //Uninstall & Delete
            var skipDeleteMessage = false;

            if (installed)
            {
                if (!TryUninstall())
                {
                    return;
                }
                skipDeleteMessage = true;
            }

            //check can delete
            if (!File.Exists(selectedPackage.FullFilePath))
            {
                return;
            }

            //ask to delete
            if (!skipDeleteMessage)
            {
                var template = Translate("Are you sure you want to delete \'{0}\'?");
                var text     = string.Format(template, selectedPackage.FullFilePath);
                if (EditorMessageBox.ShowQuestion(text, EMessageBoxButtons.YesNo) == EDialogResult.No)
                {
                    return;
                }
            }

            //delete
            try
            {
                File.Delete(selectedPackage.FullFilePath);
            }
            catch (Exception e2)
            {
                EditorMessageBox.ShowWarning(e2.Message);
                return;
            }

            needUpdateList = true;
        }
Esempio n. 19
0
 public static void AddFilesToDeletionAtStartup(List <string> fileNames)
 {
     try
     {
         var txtFileName = Path.Combine(PackagesFolder, "FilesToDeleteAtStartup.txt");
         foreach (var file in fileNames)
         {
             File.AppendAllText(txtFileName, file + "\r\n");
         }
     }
     catch (Exception e)
     {
         EditorMessageBox.ShowInfo(e.Message);
     }
 }
Esempio n. 20
0
        public static void ExportComponentToFile(Component component)
        {
#if !DEPLOY
            var componentFolder = "";
            {
                var fileName = ComponentUtility.GetOwnedFileNameOfComponent(component);
                if (!string.IsNullOrEmpty(fileName))
                {
                    componentFolder = Path.GetDirectoryName(VirtualPathUtility.GetRealPathByVirtual(fileName));
                }
            }

            var name = component.Name;
            if (string.IsNullOrEmpty(name))
            {
                name = "Component";
            }

            var extension = "component";
            {
                var attribs = component.GetType().GetCustomAttributes <ResourceFileExtensionAttribute>().ToArray();
                if (attribs.Length != 0)
                {
                    extension = attribs[0].Extension;
                }
            }

            var initialFileName = GetFixedName(name + "." + extension);

            var dialog = new SaveFileDialog();
            dialog.InitialDirectory = componentFolder;
            dialog.FileName         = initialFileName;
            dialog.Filter           = "All files (*.*)|*.*";
            dialog.RestoreDirectory = true;
            if (dialog.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            var saveAsFileName = dialog.FileName;

            if (!ComponentUtility.SaveComponentToFile(component, saveAsFileName, null, out var error))
            {
                EditorMessageBox.ShowWarning(error);
            }
#endif
        }
Esempio n. 21
0
        public static void DeleteFilesAsStartup()
        {
            try
            {
                var txtFileName = Path.Combine(PackagesFolder, "FilesToDeleteAtStartup.txt");
                if (File.Exists(txtFileName))
                {
                    var fileNames = File.ReadAllLines(txtFileName);

                    foreach (var file in fileNames)
                    {
                        var fullName = Path.Combine(VirtualFileSystem.Directories.Project, file);

                        var       startTime = DateTime.Now;
                        Exception e         = null;
                        do
                        {
                            try
                            {
                                if (File.Exists(fullName))
                                {
                                    File.Delete(fullName);
                                }
                                e = null;
                                break;
                            }
                            catch (Exception e2)
                            {
                                e = e2;
                            }
                        } while((DateTime.Now - startTime).TotalSeconds < 30);

                        if (e != null)
                        {
                            throw e;
                        }
                    }

                    File.Delete(txtFileName);
                }
            }
            catch (Exception e)
            {
                EditorMessageBox.ShowWarning(e.Message);
            }
        }
Esempio n. 22
0
        //return: Cancel
        internal bool ShowDialogAndSaveDocument(DockWindow window)
        {
            var documentWindow = window as DocumentWindow;

            if (documentWindow == null)
            {
                return(false);
            }

            // If the page is dirty then we need to ask if it should be saved
            if (documentWindow.IsMainWindowInWorkspace && !documentWindow.IsDocumentSaved())
            {
                EDialogResult result;
                if (window.ShowDialogAndSaveDocumentAutoAnswer.HasValue)
                {
                    result = window.ShowDialogAndSaveDocumentAutoAnswer.Value;
                }
                else
                {
                    var text = EditorLocalization.Translate("General", "Save changes to the following files?") + "\n";
                    text  += "\n" + documentWindow.Document.Name;
                    result = EditorMessageBox.ShowQuestion(text, EMessageBoxButtons.YesNoCancel);
                }

                switch (result)
                {
                case EDialogResult.Cancel:

                    //!!!!тут?
                    EditorAPI.SetRestartApplication(false);

                    return(true);

                case EDialogResult.Yes:
                    //!!!!check error, return null
                    documentWindow.SaveDocument();
                    return(false);

                case EDialogResult.No:
                    return(false);
                }
            }

            return(false);
        }
Esempio n. 23
0
        private void kryptonButtonNewCreate_Click(object sender, EventArgs e)
        {
            //!!!!

            string folder = kryptonTextBoxNewFolder.Text.Trim();

            if (string.IsNullOrEmpty(folder))
            {
                return;
            }

            try
            {
                while (Directory.Exists(folder) && !IOUtility.IsDirectoryEmpty(folder))
                {
                    var text   = string.Format(Translate("Destination folder \'{0}\' is not empty. Clear folder and continue?"), folder);
                    var result = EditorMessageBox.ShowQuestion(text, MessageBoxButtons.OKCancel);
                    if (result == DialogResult.Cancel)
                    {
                        return;
                    }

                    IOUtility.ClearDirectory(folder);
                }

                if (!Directory.Exists(folder))
                {
                    Directory.CreateDirectory(folder);
                }

                creationInProgress             = true;
                progressBarNew.Visible         = true;
                kryptonButtonNewCancel.Visible = true;
                creationDirectory = folder;

                var tag = objectsBrowserNew.SelectedItems[0].Tag as string;
                creationTask = new Task(CreationFunction, tag);
                creationTask.Start();
            }
            catch (Exception ex)
            {
                EditorMessageBox.ShowWarning(ex.Message);
                return;
            }
        }
Esempio n. 24
0
        private void kryptonButtonLogin_Click(object sender, EventArgs e)
        {
            var email    = kryptonTextBoxLoginEmail.Text.Trim().ToLower();
            var password = kryptonTextBoxLoginPassword.Text;

            if (string.IsNullOrEmpty(email) || string.IsNullOrEmpty(password))
            {
                return;
            }

            if (!IsValidEmail(email))
            {
                EditorMessageBox.ShowWarning("Invalid email.");
                return;
            }

            LoginUtility.SetCurrentLicense(kryptonTextBoxLoginEmail.Text, kryptonTextBoxLoginPassword.Text);
        }
Esempio n. 25
0
        void CreateUIControl()
        {
            try
            {
                var prefix = VirtualDirectory.Exists("UI") ? @"UI\" : "";

                string fileName = null;
                for (int n = 1; ; n++)
                {
                    string f = prefix + string.Format(@"New{0}.ui", n > 1 ? n.ToString() : "");
                    if (!VirtualFile.Exists(f))
                    {
                        fileName = f;
                        break;
                    }
                }

                if (!string.IsNullOrEmpty(fileName))
                {
                    var realFileName = VirtualPathUtility.GetRealPathByVirtual(fileName);

                    var sourceFile = VirtualPathUtility.GetRealPathByVirtual(@"Base\Tools\NewResourceTemplates\UIControl.ui");

                    var text = VirtualFile.ReadAllText(sourceFile);

                    var directoryName = Path.GetDirectoryName(realFileName);
                    if (!Directory.Exists(directoryName))
                    {
                        Directory.CreateDirectory(directoryName);
                    }

                    File.WriteAllText(realFileName, text);

                    EditorAPI.SelectFilesOrDirectoriesInMainResourcesWindow(new string[] { realFileName });
                    EditorAPI.OpenFileAsDocument(realFileName, true, true);
                }
            }
            catch (Exception e)
            {
                EditorMessageBox.ShowWarning(e.Message);
                //Log.Warning( e.Message );
                return;
            }
        }
Esempio n. 26
0
        private void buttonTypeSettingsDefaultValue_Click(object sender, EventArgs e)
        {
            var component = GetTypeSettingsComponent();

            if (component != null)
            {
                var text = EditorLocalization.Translate("SettingsWindow", "Reset to default?");
                if (EditorMessageBox.ShowQuestion(text, EMessageBoxButtons.YesNo) == EDialogResult.Yes)
                {
                    var oldValue = component.TypeSettingsPrivateObjects;

                    component.TypeSettingsPrivateObjects = null;

                    var undoItem = new UndoActionPropertiesChange.Item(component, (Metadata.Property)MetadataManager.GetTypeOfNetType(typeof(Component)).MetadataGetMemberBySignature("property:TypeSettingsPrivateObjects"), oldValue, null);
                    ObjectSettingsWindow.Document.UndoSystem.CommitAction(new UndoActionPropertiesChange(undoItem));
                    ObjectSettingsWindow.Document.Modified = true;
                }
            }
        }
Esempio n. 27
0
        private void KryptonButtonReset_Click(object sender, EventArgs e)
        {
            var settings = GetSettings();

            if (settings == null)
            {
                return;
            }

            if (EditorMessageBox.ShowQuestion(Translate("Reset the configuration of shortcuts to default?"), EMessageBoxButtons.YesNo) == EDialogResult.No)
            {
                return;
            }

            settings.ResetToDefault();
            if (Owner?.DocumentWindow?.Document != null)
            {
                Owner.DocumentWindow.Document.Modified = true;
            }
        }
Esempio n. 28
0
        public virtual bool TryDeleteObjects()
        {
            //!!!!!игнорить выделенные-вложенные. где еще так

            if (!CanDeleteObjects(out var objectsToDelete))
            {
                return(false);
            }

            string text;

            if (objectsToDelete.Count == 1)
            {
                string template = EditorLocalization.Translate("DocumentWindow", "Are you sure you want to delete \'{0}\'?");
                var    name     = objectsToDelete[0].ToString();
                text = string.Format(template, name);
            }
            else
            {
                string template = EditorLocalization.Translate("DocumentWindow", "Are you sure you want to delete selected objects?");
                text = string.Format(template, objectsToDelete.Count);
            }

            if (EditorMessageBox.ShowQuestion(text, EMessageBoxButtons.YesNo) == EDialogResult.No)
            {
                return(false);
            }

            //!!!!может сцену выбрать? везде так
            //clear selected objects
            SelectObjects(null);

            //add to undo with deletion
            var action = new UndoActionComponentCreateDelete(Document, objectsToDelete.Cast <Component>().ToArray(), false);

            Document.UndoSystem.CommitAction(action);
            Document.Modified = true;

            return(true);
        }
Esempio n. 29
0
        // сохранить только выбранные окна. не обязательно все. например может использоваться
        // из метода "Закрыть все окна кроме текущего".
        internal bool?ShowDialogAndSaveDocuments(IEnumerable <DockWindow> windows)
        {
            var unsavedDocs = new List <DocumentInstance>();

            foreach (var wnd in windows)
            {
                if (wnd is IDocumentWindow docWnd && !docWnd.IsDocumentSaved())
                {
                    unsavedDocs.Add(docWnd.Document);
                }
            }

            if (unsavedDocs.Count == 0)
            {
                return(false);
            }

            var text = EditorLocalization.Translate("General", "Save changes to the following files?") + "\n";

            foreach (var doc in unsavedDocs)
            {
                text += "\n" + doc.Name;
            }

            switch (EditorMessageBox.ShowQuestion(text, MessageBoxButtons.YesNoCancel))
            {
            case DialogResult.Cancel:
                return(null);

            case DialogResult.Yes:
                //!!!!check error, return null
                unsavedDocs.ForEach(doc => doc.Save());
                return(true);

            case DialogResult.No:
                return(false);
            }

            return(false);
        }
        private void ButtonResizeMasks_Click(ProcedureUI.Button sender)
        {
            var terrain = GetTerrain();

            if (terrain == null)
            {
                return;
            }

            var layers = GetLayersToResizeMask(terrain);

            if (layers.Count == 0)
            {
                return;
            }

            var text = string.Format(EditorLocalization.Translate("Terrain", "Resize masks of selected layers to {0}x{0}?"), terrain.GetPaintMaskSizeInteger());

            if (EditorMessageBox.ShowQuestion(text, EMessageBoxButtons.OKCancel) == EDialogResult.OK)
            {
                var undoMultiAction = new UndoMultiAction();

                foreach (var layer in layers)
                {
                    var oldValue = layer.Mask;

                    layer.Mask = Component_PaintLayer.ResizeMask(layer.Mask, terrain.GetPaintMaskSizeInteger());

                    var property = (Metadata.Property)layer.MetadataGetMemberBySignature("property:Mask");
                    var undoItem = new UndoActionPropertiesChange.Item(layer, property, oldValue);
                    undoMultiAction.AddAction(new UndoActionPropertiesChange(undoItem));
                }

                if (undoMultiAction.Actions.Count != 0)
                {
                    Provider.DocumentWindow.Document.CommitUndoAction(undoMultiAction);
                }
            }
        }