private void InitializeButtons() { buttons = new ObservableCollection <GoogleEarthModel>(); GoogleEarthModel saveRasterKMLButton = new GoogleEarthModel(); saveRasterKMLButton.Name = "Save as raster KML"; saveRasterKMLButton.Icon = new BitmapImage(new Uri("pack://application:,,,/GisEditorPluginCore;component/Images/rasterkml.png")); GoogleEarthModel saveVectorKMLButton = new GoogleEarthModel(); saveVectorKMLButton.Name = "Save as vector KML"; saveVectorKMLButton.Icon = new BitmapImage(new Uri("pack://application:,,,/GisEditorPluginCore;component/Images/vectorkml.png")); GoogleEarthModel openGoogleEarthButton = new GoogleEarthModel(); openGoogleEarthButton.Name = "Open in Google earth"; openGoogleEarthButton.Icon = new BitmapImage(new Uri("pack://application:,,,/GisEditorPluginCore;component/Images/googleEarth.png")); GoogleEarthModel openGoogleEarthProButton = new GoogleEarthModel(); openGoogleEarthProButton.Name = "Open in Google earth Pro"; openGoogleEarthProButton.Icon = new BitmapImage(new Uri("pack://application:,,,/GisEditorPluginCore;component/Images/googleEarth.png")); buttons.Add(saveRasterKMLButton); buttons.Add(saveVectorKMLButton); buttons.Add(openGoogleEarthButton); buttons.Add(openGoogleEarthProButton); }
public void UpdateButtonStates() { GoogleEarthModel ogeButton = buttons.Where(b => b.Name.Equals("Open in Google earth", StringComparison.OrdinalIgnoreCase)).FirstOrDefault(); GoogleEarthModel ogeProButton = buttons.Where(b => b.Name.Equals("Open in Google earth Pro", StringComparison.OrdinalIgnoreCase)).FirstOrDefault(); googleEarthInstalledPath = GoogleEarthHelper.GetGoogleEarthInstalledPath(); googleEarthProInstalledPath = GoogleEarthHelper.GetGoogleEarthProInstalledPath(); ogeButton.IsEnabled = !string.IsNullOrEmpty(googleEarthInstalledPath); ogeProButton.IsEnabled = !string.IsNullOrEmpty(googleEarthProInstalledPath); }