Exemplo n.º 1
0
        public void StartEditDatabase(DatabaseData srcDatabaseData)
        {
            DatabaseData dstDatabaseData = model.SetDatabaseAsEdit(srcDatabaseData);

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

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

            TreeForm.SetDatabaseDefinition(databaseData);
            rrdDbForm.SetDatabaseDefinition(databaseData);
            TreeForm.SetEditMode(false);
            return(true);
        }
Exemplo n.º 4
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);
        }