How do I disable the Start Editing button in ArcMap when an added ArcSDE database version is the default?
IMxDocument pMxdoc = m_application.Document as IMxDocument;
IMap pMap = pMxdoc.FocusMap;
ILayer pLayer = pMap.get_Layer(0);
int count = pMap.LayerCount;
if (count == 0)
{
MessageBox.Show("Layer not found in ArcMap");
}
else
{
IFeatureLayer pFlayer = pLayer as IFeatureLayer;
IFeatureClass pFclass = pFlayer.FeatureClass;
IFeatureDataset pFDSet = pFclass.FeatureDataset;
IWorkspace pWorkspace = ((IDataset)pMxdoc.ActiveView.FocusMap.Layer[0]).Workspace;
IVersion version = pWorkspace as IVersion;
string versioname = version.VersionName;
IEditor editor = getEditor();
ICommandItem item = GetCommandItemByName("{59D2AFD0-9EA2-11D1-9165-0080C718DF97}");
ICommand cmd = item as ICommand;
string name = item.Name;
int indexval = item.Index;
bool value = Enabled();
//ToolbarControl1.SetBuddyControl(MapControl1);
//IToolbarPalette toolbarPalette = ToolbarControl1.GetItem(item.Index) as IToolbarPalette;
if (versioname != "SDE.DEFAULT")
{
cmd.Enabled = value;
}
if (versioname == "SDE.DEFAULT")
{
Enabled();
MessageBox.Show("Database in SDE Default version so that Start Editing option Disabled");
}
}