Exemple #1
0
 public void RemoveDatabase(DatabaseData databaseData)
 {
     if (model.RemoveDatabase(databaseData))
     {
         TreeForm.RemoveDatabaseDefinition(databaseData.Definition.Path);
     }
 }
Exemple #2
0
        public void CreateDatabase(string databasePath)
        {
            if (model.EditingDatabaseData == null)
            {
                throw new ApplicationException("Not in edit mode");
            }

            string oldpath     = model.EditingDatabaseData.Definition.Path;
            RrdDb  srcDatabase = null;

            if (!string.IsNullOrEmpty(model.EditingDatabaseData.SourceDatabasePath))
            {
                srcDatabase = new RrdDb(model.EditingDatabaseData.SourceDatabasePath);
            }
            RrdDef rrdDef = model.EditingDatabaseData.Definition;

            rrdDef.setPath(databasePath);
            RrdDb dstDatabase = new RrdDb(rrdDef);

            if (srcDatabase != null)
            {
                srcDatabase.copyStateTo(dstDatabase);
            }

            if (srcDatabase != null)
            {
                srcDatabase.close();
            }
            dstDatabase.close();
            model.DatabaseDirty       = false;
            model.EditingDatabaseData = null;
            DatabaseData databaseData = model.AddDatabase(databasePath);

            rrdDbForm.SetDatabaseDefinition(databaseData);

            TreeForm.RemoveDatabaseDefinition(oldpath);
            TreeForm.SetDatabaseDefinition(databaseData);
            TreeForm.SetEditMode(false);
        }
Exemple #3
0
 public void DeleteDatabaseDefinition()
 {
     TreeForm.RemoveDatabaseDefinition(model.EditingDatabaseData.Definition.Path);
     model.EditingDatabaseData = null;
     model.DatabaseDirty       = false;
 }