protected override void OnUpdate() { try { GsExtension extension = GsExtension.GetExtension(); IApplication application = ArcMap.Application; Enabled = ((application != null) && extension.Enabled); if (application != null) { var document = application.Document as IMxDocument; if (document != null) { var tocDisplayView = document.CurrentContentsView as TOCDisplayView; if (tocDisplayView != null) { var selectedItem = tocDisplayView.SelectedItem as ILayer; if (selectedItem != null) { _vectorLayer = VectorLayer.GetLayer(selectedItem); CycloMediaGroupLayer cycloMediaGroupLayer = extension.CycloMediaGroupLayer; _cycloMediaLayer = (cycloMediaGroupLayer == null) ? null : cycloMediaGroupLayer.GetLayer(selectedItem); if (_cycloMediaLayer != null) { Checked = _cycloMediaLayer.IsVisibleInGlobespotter; Enabled = _cycloMediaLayer.IsVisible; } if (_vectorLayer != null) { Checked = _vectorLayer.IsVisibleInGlobespotter; Enabled = _vectorLayer.IsVisible; } } } } } } catch (Exception ex) { _logClient.Error("GsShowInCyclorama.OnUpdate", ex.Message, ex); Trace.WriteLine(ex.Message, "GsShowInCyclorama.OnUpdate"); } }