public PostgreTableDataRepositoryItem() { Icon = new BitmapImage(new Uri("/GisEditorPluginCore;component/Images/table.png", UriKind.RelativeOrAbsolute)); MenuItem propertyItem = new MenuItem(); propertyItem.Icon = DataRepositoryHelper.GetMenuIcon("/GisEditorPluginCore;component/Images/properties.png", 16, 16); propertyItem.Header = "Properties"; propertyItem.Command = new RelayCommand(() => { LayerPlugin matchingLayerPlugin = GisEditor.LayerManager.GetActiveLayerPlugins <LayerPlugin>() .FirstOrDefault(tmpPlugin => tmpPlugin.Name.Equals("PostgreSql", StringComparison.OrdinalIgnoreCase)); PostgreSqlFeatureLayer newLayer = GetPostgreSqlFeatureLayers().FirstOrDefault(); if (newLayer != null) { UserControl userControl = matchingLayerPlugin.GetPropertiesUI(newLayer); Window propertiesDockWindow = new Window() { Content = userControl, Title = GisEditor.LanguageManager.GetStringResource("MapElementsListPluginProperties"), SizeToContent = SizeToContent.WidthAndHeight, ResizeMode = System.Windows.ResizeMode.NoResize, Style = Application.Current.FindResource("WindowStyle") as System.Windows.Style }; propertiesDockWindow.ShowDialog(); } }); ContextMenu.Items.Add(propertyItem); }
private void AddMenuItems() { if (CanRename) { MenuItem renameFileItem = new MenuItem(); renameFileItem.Header = GisEditor.LanguageManager.GetStringResource("DataRepositoryRenameMenuItemLabel"); renameFileItem.Icon = DataRepositoryHelper.GetMenuIcon("/GisEditorPluginCore;component/Images/rename.png", 16, 16); renameFileItem.Command = new RelayCommand(() => DataRepositoryContentViewModel.SelectedDataRepositoryItem.IsRenaming = true); ContextMenu.Items.Add(renameFileItem); } if (fileInfo.Extension.Equals(".csv", StringComparison.InvariantCultureIgnoreCase)) { MenuItem editConfigItem = new MenuItem(); editConfigItem.Header = GisEditor.LanguageManager.GetStringResource("DataRepositoryEditColumnMappingMenuItemLabel"); editConfigItem.Icon = DataRepositoryHelper.GetMenuIcon("/GisEditorPluginCore;component/Images/dr_edit.png", 16, 16); editConfigItem.Command = new RelayCommand(() => { try { var configFilePath = fileInfo.FullName + ".config"; CSVInfoModel csvInfoModel = File.Exists(configFilePath) ? CSVInfoModel.FromConfig(configFilePath) : new CSVInfoModel(fileInfo.FullName, ","); CSVConfigWindow csvConfigWindow = new CSVConfigWindow(new CSVViewModel(new Collection <CSVInfoModel> { csvInfoModel })); csvConfigWindow.ShowDialog(); } catch (Exception ex) { GisEditor.LoggerManager.Log(LoggerLevel.Debug, ex.Message, new ExceptionInfo(ex)); System.Windows.Forms.MessageBox.Show(ex.Message, GisEditor.LanguageManager.GetStringResource("DataRepositoryWarningLabel")); } }); ContextMenu.Items.Add(editConfigItem); } MenuItem showInWindowsExplorerItem = new MenuItem(); showInWindowsExplorerItem.Header = GisEditor.LanguageManager.GetStringResource("ShowInWindowsExplorerMenuItemLabel"); showInWindowsExplorerItem.Icon = DataRepositoryHelper.GetMenuIcon("/GisEditorPluginCore;component/Images/windows explorer.png", 16, 16); showInWindowsExplorerItem.Command = new ObservedCommand(() => ProcessUtils.OpenPath(fileInfo.FullName), () => fileInfo != null && File.Exists(fileInfo.FullName)); ContextMenu.Items.Add(showInWindowsExplorerItem); MenuItem propertyItem = new MenuItem(); propertyItem.Icon = DataRepositoryHelper.GetMenuIcon("/GisEditorPluginCore;component/Images/properties.png", 16, 16); propertyItem.Header = "Properties"; propertyItem.Command = new RelayCommand(() => { GetLayersParameters getLayersParameters = new GetLayersParameters(); getLayersParameters.LayerUris.Add(new Uri(fileInfo.FullName)); Layer layer = matchingLayerPlugin.GetLayers(getLayersParameters).FirstOrDefault(); UserControl userControl = matchingLayerPlugin.GetPropertiesUI(layer); Window propertiesDockWindow = new Window() { Content = userControl, Title = GisEditor.LanguageManager.GetStringResource("MapElementsListPluginProperties"), SizeToContent = SizeToContent.WidthAndHeight, ResizeMode = System.Windows.ResizeMode.NoResize, Style = Application.Current.FindResource("WindowStyle") as System.Windows.Style }; propertiesDockWindow.ShowDialog(); }); ContextMenu.Items.Add(propertyItem); }