/// <summary> /// View Hanlder /// </summary> /// <param name="e"></param> private void ViewHandler(TreeNodeMouseClickEventArgs e) { statusStripMain.Items[0].Text = "Selected View:" + e.Node.Text; DelMongoCollectionToolStripMenuItem.Enabled = true; if (e.Button == MouseButtons.Right) { contextMenuStripMain = new ContextMenuStrip(); contextMenuStripMain.Items.Add(DelMongoCollectionToolStripMenuItem.Clone()); e.Node.ContextMenuStrip = contextMenuStripMain; contextMenuStripMain.Show(trvsrvlst.PointToScreen(e.Location)); } }
/// <summary> /// View Hanlder /// </summary> /// <param name="e"></param> private void ViewHandler(TreeNodeMouseClickEventArgs e) { statusStripMain.Items[0].Text = GuiConfig.GetText("Selected View", "SelectedView") + ":" + e.Node.Text; DelMongoCollectionToolStripMenuItem.Enabled = true; if (e.Button == MouseButtons.Right) { contextMenuStripMain = new ContextMenuStrip(); contextMenuStripMain.Items.Add(DelMongoCollectionToolStripMenuItem.Clone()); var ViewInfoToolStripMenuItem = new ToolStripMenuItem("ViewInfo"); ViewInfoToolStripMenuItem.Click += ViewInfoToolStripMenuItem_Click; contextMenuStripMain.Items.Add(ViewInfoToolStripMenuItem); e.Node.ContextMenuStrip = contextMenuStripMain; contextMenuStripMain.Show(trvsrvlst.PointToScreen(e.Location)); } }
/// <summary> /// View Hanlder /// </summary> /// <param name="e"></param> private void ViewHandler(TreeNodeMouseClickEventArgs e) { statusStripMain.Items[0].Text = GuiConfig.GetText("Selected View", "SelectedView") + ":" + e.Node.Text; DelMongoCollectionToolStripMenuItem.Enabled = true; if (e.Button == MouseButtons.Right) { contextMenuStripMain = new ContextMenuStrip(); contextMenuStripMain.Items.Add(DelMongoCollectionToolStripMenuItem.Clone()); var ViewInfoToolStripMenuItem = new ToolStripMenuItem("ViewInfo"); ViewInfoToolStripMenuItem.Click += ViewInfoToolStripMenuItem_Click; contextMenuStripMain.Items.Add(ViewInfoToolStripMenuItem); e.Node.ContextMenuStrip = contextMenuStripMain; contextMenuStripMain.Show(trvsrvlst.PointToScreen(e.Location)); } //PlugIn foreach (ToolStripMenuItem item in plugInToolStripMenuItem.DropDownItems) { if (PlugIn.PlugInList[item.Tag.ToString()].RunLv == PlugInBase.PathLv.CollectionLv) { item.Enabled = true; } } }
/// <summary> /// Collection Hanlder. /// </summary> /// <param name="e">E.</param> private void CollectionHandler(TreeNodeMouseClickEventArgs e) { if (GuiConfig.IsUseDefaultLanguage) { statusStripMain.Items[0].Text = "Selected Collection:" + RuntimeMongoDbContext.SelectTagData; } else { statusStripMain.Items[0].Text = GuiConfig.GetText(TextType.SelectedCollection) + ":" + RuntimeMongoDbContext.SelectTagData; } var mongoCol = RuntimeMongoDbContext.GetCurrentCollection(); //解禁 删除数据集 if (!Operater.IsSystemCollection()) { //系统数据库无法删除!! if (!RuntimeMongoDbContext.CurrentMongoConnectionconfig.IsReadOnly) { DelMongoCollectionToolStripMenuItem.Enabled = true; RenameCollectionToolStripMenuItem.Enabled = true; } } if (!RuntimeMongoDbContext.CurrentMongoConnectionconfig.IsReadOnly) { ImportCollectionToolStripMenuItem.Enabled = true; CompactToolStripMenuItem.Enabled = true; } if (!Operater.IsSystemCollection() && !RuntimeMongoDbContext.CurrentMongoConnectionconfig.IsReadOnly) { IndexManageToolStripMenuItem.Enabled = true; ReIndexToolStripMenuItem.Enabled = true; } DumpCollectionToolStripMenuItem.Enabled = true; ExportCollectionToolStripMenuItem.Enabled = true; AggregationToolStripMenuItem.Enabled = true; ViewDataToolStripMenuItem.Enabled = true; CollectionStatusToolStripMenuItem.Enabled = true; ValidateToolStripMenuItem.Enabled = true; ExportToFileToolStripMenuItem.Enabled = true; if (!mongoCol.IsCapped()) { ConvertToCappedtoolStripMenuItem.Enabled = true; } if (e.Button == MouseButtons.Right) { contextMenuStripMain = new ContextMenuStrip(); if (SystemManager.MonoMode) { //悲催MONO不支持 var delMongoCollection = DelMongoCollectionToolStripMenuItem.Clone(); delMongoCollection.Click += DelMongoCollectionToolStripMenuItem_Click; contextMenuStripMain.Items.Add(delMongoCollection); var renameCollection = RenameCollectionToolStripMenuItem.Clone(); renameCollection.Click += RenameCollectionToolStripMenuItem_Click; contextMenuStripMain.Items.Add(renameCollection); var dumpCollection = DumpCollectionToolStripMenuItem.Clone(); dumpCollection.Click += DumpCollectionToolStripMenuItem_Click; contextMenuStripMain.Items.Add(dumpCollection); var restoreMongo = RestoreMongoToolStripMenuItem.Clone(); restoreMongo.Click += RestoreMongoToolStripMenuItem_Click; contextMenuStripMain.Items.Add(restoreMongo); var importCollection = ImportCollectionToolStripMenuItem.Clone(); importCollection.Click += ImportCollectionToolStripMenuItem_Click; contextMenuStripMain.Items.Add(importCollection); var exportCollection = ExportCollectionToolStripMenuItem.Clone(); exportCollection.Click += ExportCollectionToolStripMenuItem_Click; contextMenuStripMain.Items.Add(exportCollection); var compact = CompactToolStripMenuItem.Clone(); compact.Click += CompactToolStripMenuItem_Click; contextMenuStripMain.Items.Add(compact); contextMenuStripMain.Items.Add(new ToolStripSeparator()); var viewData = ViewDataToolStripMenuItem.Clone(); viewData.Click += (x, y) => ViewDataObj(); contextMenuStripMain.Items.Add(viewData); var aggregationMenu = AggregationToolStripMenuItem.Clone(); var distinct = distinctToolStripMenuItem.Clone(); distinct.Click += distinctToolStripMenuItem_Click; aggregationMenu.DropDownItems.Add(distinct); var mapReduce = mapReduceToolStripMenuItem.Clone(); mapReduce.Click += mapReduceToolStripMenuItem_Click; aggregationMenu.DropDownItems.Add(mapReduce); contextMenuStripMain.Items.Add(aggregationMenu); contextMenuStripMain.Items.Add(new ToolStripSeparator()); var indexManage = IndexManageToolStripMenuItem.Clone(); indexManage.Click += IndexManageToolStripMenuItem_Click; contextMenuStripMain.Items.Add(indexManage); var reIndex = ReIndexToolStripMenuItem.Clone(); reIndex.Click += ReIndexToolStripMenuItem_Click; contextMenuStripMain.Items.Add(reIndex); contextMenuStripMain.Items.Add(new ToolStripSeparator()); var collectionStatus = CollectionStatusToolStripMenuItem.Clone(); collectionStatus.Click += CollectionStatusToolStripMenuItem_Click; contextMenuStripMain.Items.Add(collectionStatus); } else { contextMenuStripMain.Items.Add(DelMongoCollectionToolStripMenuItem.Clone()); contextMenuStripMain.Items.Add(RenameCollectionToolStripMenuItem.Clone()); contextMenuStripMain.Items.Add(ConvertToCappedtoolStripMenuItem.Clone()); contextMenuStripMain.Items.Add(DumpCollectionToolStripMenuItem.Clone()); contextMenuStripMain.Items.Add(RestoreMongoToolStripMenuItem.Clone()); contextMenuStripMain.Items.Add(ImportCollectionToolStripMenuItem.Clone()); contextMenuStripMain.Items.Add(ExportCollectionToolStripMenuItem.Clone()); contextMenuStripMain.Items.Add(ExportToFileToolStripMenuItem.Clone()); contextMenuStripMain.Items.Add(CompactToolStripMenuItem.Clone()); contextMenuStripMain.Items.Add(new ToolStripSeparator()); contextMenuStripMain.Items.Add(ViewDataToolStripMenuItem.Clone()); contextMenuStripMain.Items.Add(AggregationToolStripMenuItem.Clone()); contextMenuStripMain.Items.Add(new ToolStripSeparator()); contextMenuStripMain.Items.Add(IndexManageToolStripMenuItem.Clone()); contextMenuStripMain.Items.Add(ReIndexToolStripMenuItem.Clone()); contextMenuStripMain.Items.Add(new ToolStripSeparator()); contextMenuStripMain.Items.Add(CollectionStatusToolStripMenuItem.Clone()); contextMenuStripMain.Items.Add(ValidateToolStripMenuItem.Clone()); } e.Node.ContextMenuStrip = contextMenuStripMain; contextMenuStripMain.Show(trvsrvlst.PointToScreen(e.Location)); } //PlugIn foreach (ToolStripMenuItem item in plugInToolStripMenuItem.DropDownItems) { if (PlugIn.PlugInList[item.Tag.ToString()].RunLv == PlugInBase.PathLv.CollectionLv) { item.Enabled = true; } } }
private void CollectionHandler(TreeNodeMouseClickEventArgs e) { if (GuiConfig.IsUseDefaultLanguage) { statusStripMain.Items[0].Text = "Selected Collection:" + RuntimeMongoDbContext.SelectTagData; } else { statusStripMain.Items[0].Text = GuiConfig.GetText(TextType.SelectedCollection) + ":" + RuntimeMongoDbContext.SelectTagData; } //解禁 删除数据集 if (!Operater.IsSystemCollection()) { //系统数据库无法删除!! if (!RuntimeMongoDbContext.CurrentMongoConnectionconfig.IsReadOnly) { DelMongoCollectionToolStripMenuItem.Enabled = true; RenameCollectionToolStripMenuItem.Enabled = true; } } if (!RuntimeMongoDbContext.CurrentMongoConnectionconfig.IsReadOnly) { ImportCollectionToolStripMenuItem.Enabled = true; CompactToolStripMenuItem.Enabled = true; } if (!Operater.IsSystemCollection() && !RuntimeMongoDbContext.CurrentMongoConnectionconfig.IsReadOnly) { IndexManageToolStripMenuItem.Enabled = true; ReIndexToolStripMenuItem.Enabled = true; } DumpCollectionToolStripMenuItem.Enabled = true; ExportCollectionToolStripMenuItem.Enabled = true; AggregationToolStripMenuItem.Enabled = true; ViewDataToolStripMenuItem.Enabled = true; CollectionStatusToolStripMenuItem.Enabled = true; ValidateToolStripMenuItem.Enabled = true; ExportToFileToolStripMenuItem.Enabled = true; if (e.Button == MouseButtons.Right) { contextMenuStripMain = new ContextMenuStrip(); if (SystemManager.MonoMode) { //悲催MONO不支持 var t1 = DelMongoCollectionToolStripMenuItem.Clone(); t1.Click += DelMongoCollectionToolStripMenuItem_Click; contextMenuStripMain.Items.Add(t1); var t2 = RenameCollectionToolStripMenuItem.Clone(); t2.Click += RenameCollectionToolStripMenuItem_Click; contextMenuStripMain.Items.Add(t2); var t3 = DumpCollectionToolStripMenuItem.Clone(); t3.Click += DumpCollectionToolStripMenuItem_Click; contextMenuStripMain.Items.Add(t3); var t4 = RestoreMongoToolStripMenuItem.Clone(); t4.Click += RestoreMongoToolStripMenuItem_Click; contextMenuStripMain.Items.Add(t4); var t5 = ImportCollectionToolStripMenuItem.Clone(); t5.Click += ImportCollectionToolStripMenuItem_Click; contextMenuStripMain.Items.Add(t5); var t6 = ExportCollectionToolStripMenuItem.Clone(); t6.Click += ExportCollectionToolStripMenuItem_Click; contextMenuStripMain.Items.Add(t6); var t7 = CompactToolStripMenuItem.Clone(); t7.Click += CompactToolStripMenuItem_Click; contextMenuStripMain.Items.Add(t7); contextMenuStripMain.Items.Add(new ToolStripSeparator()); var t8 = ViewDataToolStripMenuItem.Clone(); t8.Click += (x, y) => ViewDataObj(); contextMenuStripMain.Items.Add(t8); var aggregationMenu = AggregationToolStripMenuItem.Clone(); var t9 = countToolStripMenuItem.Clone(); t9.Click += countToolStripMenuItem_Click; aggregationMenu.DropDownItems.Add(t9); var t10 = distinctToolStripMenuItem.Clone(); t10.Click += distinctToolStripMenuItem_Click; aggregationMenu.DropDownItems.Add(t10); var t11 = groupToolStripMenuItem.Clone(); t11.Click += groupToolStripMenuItem_Click; aggregationMenu.DropDownItems.Add(t11); var t12 = mapReduceToolStripMenuItem.Clone(); t12.Click += mapReduceToolStripMenuItem_Click; aggregationMenu.DropDownItems.Add(t12); contextMenuStripMain.Items.Add(aggregationMenu); contextMenuStripMain.Items.Add(new ToolStripSeparator()); var t13 = IndexManageToolStripMenuItem.Clone(); t13.Click += IndexManageToolStripMenuItem_Click; contextMenuStripMain.Items.Add(t13); var t14 = ReIndexToolStripMenuItem.Clone(); t14.Click += ReIndexToolStripMenuItem_Click; contextMenuStripMain.Items.Add(t14); contextMenuStripMain.Items.Add(new ToolStripSeparator()); var t15 = CollectionStatusToolStripMenuItem.Clone(); t15.Click += CollectionStatusToolStripMenuItem_Click; contextMenuStripMain.Items.Add(t15); } else { contextMenuStripMain.Items.Add(DelMongoCollectionToolStripMenuItem.Clone()); contextMenuStripMain.Items.Add(RenameCollectionToolStripMenuItem.Clone()); contextMenuStripMain.Items.Add(DumpCollectionToolStripMenuItem.Clone()); contextMenuStripMain.Items.Add(RestoreMongoToolStripMenuItem.Clone()); contextMenuStripMain.Items.Add(ImportCollectionToolStripMenuItem.Clone()); contextMenuStripMain.Items.Add(ExportCollectionToolStripMenuItem.Clone()); contextMenuStripMain.Items.Add(ExportToFileToolStripMenuItem.Clone()); contextMenuStripMain.Items.Add(CompactToolStripMenuItem.Clone()); contextMenuStripMain.Items.Add(new ToolStripSeparator()); contextMenuStripMain.Items.Add(ViewDataToolStripMenuItem.Clone()); contextMenuStripMain.Items.Add(AggregationToolStripMenuItem.Clone()); contextMenuStripMain.Items.Add(new ToolStripSeparator()); contextMenuStripMain.Items.Add(IndexManageToolStripMenuItem.Clone()); contextMenuStripMain.Items.Add(ReIndexToolStripMenuItem.Clone()); contextMenuStripMain.Items.Add(new ToolStripSeparator()); contextMenuStripMain.Items.Add(CollectionStatusToolStripMenuItem.Clone()); contextMenuStripMain.Items.Add(ValidateToolStripMenuItem.Clone()); } e.Node.ContextMenuStrip = contextMenuStripMain; contextMenuStripMain.Show(trvsrvlst.PointToScreen(e.Location)); } //PlugIn foreach (ToolStripMenuItem item in plugInToolStripMenuItem.DropDownItems) { if (PlugIn.PlugInList[item.Tag.ToString()].RunLv == PlugInBase.PathLv.CollectionLv) { item.Enabled = true; } } }