Beispiel #1
0
        public void StartEditDatabase(DatabaseData srcDatabaseData)
        {
            DatabaseData dstDatabaseData = model.SetDatabaseAsEdit(srcDatabaseData);

            TreeForm.SetDatabaseDefinition(dstDatabaseData);
            TreeForm.SetEditMode(true);
        }
Beispiel #2
0
        public void DatabaseCreated()
        {
            DatabaseData databaseData = model.GetDatabasedata();

            TreeForm.SetDatabaseDefinition(databaseData);
            TreeForm.SetEditMode(true);
            rrdDbForm.SetDatabaseDefinition(databaseData);
        }
Beispiel #3
0
        public bool OpenDatabase(string databasePath)
        {
            DatabaseData databaseData = model.AddDatabase(databasePath);

            TreeForm.SetDatabaseDefinition(databaseData);
            rrdDbForm.SetDatabaseDefinition(databaseData);
            TreeForm.SetEditMode(false);
            return(true);
        }
Beispiel #4
0
        public void DatabaseUpdated(DatabaseData srcDatabaseData)
        {
            DatabaseData reloadedData;

            if (srcDatabaseData != null)
            {
                reloadedData = model.ReloadDatabase(srcDatabaseData);
            }
            else
            {
                reloadedData = model.EditingDatabaseData;
            }
            rrdDbForm.SetDatabaseDefinition(reloadedData);
            TreeForm.SetDatabaseDefinition(reloadedData);
        }
Beispiel #5
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);
        }
Beispiel #6
0
 public void NewDatabase(string databaseName, DateTime startTime, long step)
 {
     TreeForm.SetDatabaseDefinition(model.CreateDatabase(databaseName, startTime, step));
     rrdDbForm.SetDatabaseDefinition(model.CreateDatabase(databaseName, startTime, step));
 }