示例#1
0
 public DatabaseConnection(GeoDatabaseType databaseType, string name, string connection, string secureConnection)
 {
     DatabaseType      = databaseType;
     Name              = name;
     ConnectionString  = connection;
     _secureConnection = secureConnection;
 }
        public IServerItem AddServer(GeoDatabaseType databaseType)
        {
            var node = CreateNode(RepositoryItemType.Server);

            node.LeftImageIndices = new[] { GetServerIcon(databaseType) };
            node.Text             = databaseType.EnumToString();
            node.TagObject        = new ServerItemMetadata(databaseType);
            node.ExpandedOnce     = true;
            return(AddNode(node) as IServerItem);
        }
        private static int GetServerIcon(GeoDatabaseType type)
        {
            switch (type)
            {
            case GeoDatabaseType.PostGis:
                return((int)RepositoryIcon.PostGis);

            case GeoDatabaseType.SpatiaLite:
                return((int)RepositoryIcon.Sqlite);

            case GeoDatabaseType.MsSql:
                return((int)RepositoryIcon.MsSql);

            case GeoDatabaseType.MySql:
                return((int)RepositoryIcon.MySql);

            default:
                throw new ArgumentOutOfRangeException("type");
            }
        }
示例#4
0
 public ServerItemMetadata(GeoDatabaseType databaseType)
 {
     DatabaseType = databaseType;
 }
示例#5
0
        public IRepositoryItem GetServer(GeoDatabaseType databaseType)
        {
            var item = GetSpecialItem(RepositoryItemType.Databases);

            return(item.SubItems.OfType <IServerItem>().FirstOrDefault(db => db.DatabaseType == databaseType));
        }