Geodatabase Designer
bin\GeometricNetworkEditor.cls

' Copyright 2008 ESRI
' 
' All rights reserved under the copyright laws of the United States
' and applicable international laws, treaties, and conventions.
' 
' You may freely redistribute and use this sample code, with or
' without modification, provided you include the original copyright
' notice and use restrictions.
' 
' See use restrictions at <your ArcGIS install location>/developerkit/userestrictions.txt.
' 




Option Explicit

Private Const COMMAND_CAPTION As String = "GeometricNetwork Editor"
Private Const MODULE_NAME As String = "GeometricNetworkEditor.cls"

Private mPictureDisp As IPictureDisp
Private mApplication As esriFramework.IApplication

Implements ICommand

Private Sub Class_Initialize()
    Set mPictureDisp = LoadResPicture("GN_EDITOR", 0)
End Sub

Private Sub Class_Terminate()
    Set mPictureDisp = Nothing
    Set mApplication = Nothing
End Sub

Private Property Get ICommand_Bitmap() As esriSystem.OLE_HANDLE
    ICommand_Bitmap = mPictureDisp
End Property

Private Property Get ICommand_Caption() As String
    ICommand_Caption = COMMAND_CAPTION
End Property

Private Property Get ICommand_Category() As String
    ICommand_Category = COMMAND_CATEGORY
End Property

Private Property Get ICommand_Checked() As Boolean
    '
End Property

Private Property Get ICommand_Enabled() As Boolean
    On Error GoTo ErrorHandler
    '
    Dim pGxApplication As esriCatalogUI.IGxApplication
    Dim pGxObject As esriCatalog.IGxObject
    Dim pGxDataset As esriCatalog.IGxDataset
    '
    Set pGxApplication = mApplication
    Set pGxObject = pGxApplication.SelectedObject
    '
    If TypeOf pGxObject Is esriCatalog.IGxDataset Then
        Set pGxDataset = pGxObject
        If pGxDataset.Type = esriDTGeometricNetwork Then
            ICommand_Enabled = True
        Else
            ICommand_Enabled = False
        End If
    Else
        ICommand_Enabled = False
    End If
    '
    Exit Property
ErrorHandler:
    Call HandleError(True, "ICommand_Enabled " & MODULE_NAME & " (" & CStr(Erl) & ")", Err.Number, Err.Source, Err.Description)
End Property

Private Property Get ICommand_HelpContextID() As Long
    '
End Property

Private Property Get ICommand_HelpFile() As String
    '
End Property

Private Property Get ICommand_Message() As String
    ICommand_Message = COMMAND_CAPTION
End Property

Private Property Get ICommand_Name() As String
    ICommand_Name = "GeodatabaseDesigner_GeometricNetworkEditor"
End Property

Private Sub ICommand_OnClick()
    On Error GoTo ErrorHandler
    '
    Call frmGeometricNetwork.Init(mApplication)
    '
    Exit Sub
ErrorHandler:
    Call HandleError(True, "ICommand_OnClick " & MODULE_NAME & " (" & CStr(Erl) & ")", Err.Number, Err.Source, Err.Description)
End Sub

Private Sub ICommand_OnCreate(ByVal hook As Object)
    Set mApplication = hook
End Sub

Private Property Get ICommand_Tooltip() As String
    ICommand_Tooltip = COMMAND_CAPTION
End Property