Esempio n. 1
0
        bool DeleteProfile(SceneExportProfile settings)
        {
            if (comboBox_Profile.Items.Count <= 1)
              {
            EditorManager.ShowMessageBox("Can't delete the last export preset '" + settings.ProfileName + "'", "Delete Export Preset Failed", MessageBoxButtons.OK, MessageBoxIcon.Information);
            return false;
              }

              if (EditorManager.ShowMessageBox("Do you want to delete the export preset '" + settings.ProfileName + "'?", "Delete Export Preset?", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
              {
            return false;
              }

              if (!settings.DeleteFile())
              {
            EditorManager.ShowMessageBox("Failed to delete preset '" + settings.ProfileName + "'.\nMake sure the file '" + settings.FileName + "' is writable.", "Delete Export Preset Failed", MessageBoxButtons.OK, MessageBoxIcon.Error);
            return false;
              }

              // We do not want that popup that the export preset we just deleted is modified.
              _bForceReturnNotModified = true;
              // Rebuild the export preset combobox and select its new first index.
              FillProfileCombobox();
              comboBox_Profile.SelectedIndex = 0;
              // Changing SelectedIndex does not invoke selection changed, so we do so manually.
              comboBox_Profile_SelectionChangeCommitted(null, null);
              _bForceReturnNotModified = false;
              // The Settings property has now been modified and we need to push it back to the global settings as it may still be the just deleted one.
              EditorManager.Scene.CurrentExportProfile = Settings;
              return true;
        }