CheckBox Walkthrough
CheckBoxWalkthrough.vb
' Copyright 2011 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 the use restrictions.
' 

Imports System
Imports System.Collections.Generic
Imports System.ComponentModel
Imports System.Data
Imports System.Drawing
Imports System.Linq
Imports System.Text

Imports ESRI.ArcGISExplorer
Imports ESRI.ArcGISExplorer.Application
Imports ESRI.ArcGISExplorer.Geometry
Imports ESRI.ArcGISExplorer.Mapping
Imports ESRI.ArcGISExplorer.Data
Imports ESRI.ArcGISExplorer.Threading

'Public Class CheckBoxWalkthrough
'  Inherits ESRI.ArcGISExplorer.Application.CheckBox

'  Public Overrides Sub OnClick()

'    ' grab the selected Image Overlay
'    Dim selItems As SelectedItemsCollection = ESRI.ArcGISExplorer.Application.Application.SelectedItems

'    If (selItems.Count = 1) AndAlso (TypeOf selItems(0) Is ImageOverlay) Then
'      Dim selected As ImageOverlay = TryCast(selItems(0), ImageOverlay)
'      If Me.Checked = True Then
'        ' Display the image overlay
'        selected.Visible = True
'      Else
'        ' Do not display the image overlay
'        selected.Visible = False
'      End If
'    End If
'  End Sub

'End Class


Public Class CheckBoxWalkthrough
  Inherits ESRI.ArcGISExplorer.Application.CheckBox
  Public Overrides Sub OnUpdate()
    ' grab the selected Image Overlay & change the state of the checkbox to match 
    Dim selected As ImageOverlay = TryCast(ESRI.ArcGISExplorer.Application.Application.SelectedItems.GetFirst(), ImageOverlay)
    If selected IsNot Nothing Then
      Me.Enabled = True
      Me.Checked = selected.Visible
    Else
      Me.Enabled = False
    End If
  End Sub
  Public Overrides Sub OnClick()
    ' grab the selected Image Overlay & change the state of the ImageOverlay
    Dim selected As ImageOverlay = TryCast(ESRI.ArcGISExplorer.Application.Application.SelectedItems.GetFirst(), ImageOverlay)
    If selected IsNot Nothing Then
      selected.Visible = Me.Checked
    End If
  End Sub
End Class