/// <summary> /// </summary> /// <returns></returns> public override int Run() { var frm = new FrmSelectTable(); frm.mServer = (MongoServer)PlugObj; UIAssistant.OpenModalForm(frm, true, true); return(Success); }
/// <summary> /// Load Form /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void frmMain_Load(object sender, EventArgs e) { //加载到菜单 PlugIn.LoadPlugInMenuItem(plugInToolStripMenuItem); //禁用操作 DisableAllOpr(); //Set Tool bar button enable SetToolBarEnabled(); //Open ConnectionManagement Form UIAssistant.OpenModalForm(new frmConnect(), true, true); //多文档管理器的设定 var parentMenuItems = new List <ToolStripMenuItem> { CollectionToolStripMenuItem, JavaScriptStripMenuItem }; MultiTabManger.Init(tabView, parentMenuItems); //MultiTab固定项目的初始化 var serverStatusCtl = new CtlServerStatus() { IsFixedItem = true, SelectObjectTag = "[ServerStatus]", BindingMenu = StatusToolStripMenuItem }; MultiTabManger.AddView(serverStatusCtl, GuiConfig.IsUseDefaultLanguage ? "Status" : GuiConfig.GetText("MainMenu.MangtStatus"), string.Empty); //刷新 RefreshToolStripMenuItem_Click(sender, e); serverStatusCtl.RefreshGui(); MultiTabManger.SelectTab("[ServerStatus]"); //委托设置 trvsrvlst.NodeMouseClick += trvsrvlst_NodeMouseClick; trvsrvlst.NodeMouseDoubleClick += (x, y) => ViewDataObj(); ViewDataToolStripMenuItem.Click += (x, y) => ViewDataObj(); trvsrvlst.KeyDown += trvsrvlst_KeyDown; tabView.SelectedIndexChanged += tabView_SelectedIndexChanged; //CommandHelper.RunCommandComplete += CommandLog; //长时间操作时候,实时提示进度在状态栏中 lblAction.Text = string.Empty; MongoHelper.ActionDone += (x, y) => { //1.lblAction 没有InvokeRequired //2.DoEvents必须 lblAction.Text = y.Message; Application.DoEvents(); }; if (trvsrvlst.Nodes.Count > 0) { trvsrvlst.SelectedNode = trvsrvlst.Nodes[0]; } }
private void cmdCreateGroupFields_Click(object sender, EventArgs e) { var frmInsertDoc = new frmCreateDocument(); UIAssistant.OpenModalForm(frmInsertDoc, false, true); if (frmInsertDoc.mBsonDocument != null) { FieldsElement = new BsonElement("fields", frmInsertDoc.mBsonDocument); UiHelper.FillDataToTreeView("GroupId", TreeViewGroupFields, frmInsertDoc.mBsonDocument); } }
/// <summary> /// 显示这个Pipeline /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ViewInfoToolStripMenuItem_Click(object sender, EventArgs e) { var pipeline = new List <BsonDocument>(); pipeline.Add(RuntimeMongoDbContext.GetCurrentCollectionInfo()); var frm = new frmDataView(); frm.ShowData = pipeline; frm.Title = "ViewInfo"; UIAssistant.OpenModalForm(frm, true, true); }
/// <summary> /// 修改 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void cmdModifyCon_Click(object sender, EventArgs e) { if (lstConnection.CheckedItems.Count != 1) { return; } var connectionName = lstConnection.CheckedItems[0].Text; UIAssistant.OpenModalForm(new FrmConnectionMgr(connectionName), true, true); RefreshConnection(); }
/// <summary> /// CreateQuery /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void cmdCreateQueryDocument_Click(object sender, EventArgs e) { var frmInsertDoc = new frmCreateDocument(); UIAssistant.OpenModalForm(frmInsertDoc, false, true); QueryDoc = frmInsertDoc.mBsonDocument; if (QueryDoc != null) { UiHelper.FillDataToTreeView("Query", QueryTreeView, frmInsertDoc.mBsonDocument); } }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnCollation_Click(object sender, EventArgs e) { var frm = new frmCreateCollation(); UIAssistant.OpenModalForm(frm, false, true); if (frm.mCollation != null) { mCollation = frm.mCollation; UiHelper.FillDataToTreeView("Collation", trvCollation, mCollation.ToBsonDocument()); } }
/// <summary> /// CollectionStatus /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void CollectionStatusToolStripMenuItem_Click(object sender, EventArgs e) { if (SystemManager.MonoMode) { UIAssistant.OpenModalForm(new FrmStatusMono(), true, true); } else { UIAssistant.OpenModalForm(new FrmStatus(), true, true); } }
/// <summary> /// Aggregation Builder /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnAggrBuilder_Click(object sender, EventArgs e) { var frmAggregationBuilder = new FrmStageBuilder(); UIAssistant.OpenModalForm(frmAggregationBuilder, false, true); foreach (var item in frmAggregationBuilder.Aggregation) { stages.Add(item); } FillStagesTreeview(); }
private void btnPickDoc_Click(object sender, EventArgs e) { var frmInsertDoc = new frmCreateDocument(); UIAssistant.OpenModalForm(frmInsertDoc, false, true); if (frmInsertDoc.mBsonDocument == null) { return; } customData = frmInsertDoc.mBsonDocument; lblcustomDocument.Text = "Custom Document:" + customData.ToString(); }
private void cmdCustom_Click(object sender, EventArgs e) { var frm = new frmCustomMonitorItems(); UIAssistant.OpenModalForm(frm, false, true); if (frm.SelectedItems != null) { MonitorItemsChanged(frm.SelectedItems); MonitorItems = frm.SelectedItems; cmbCatalog.SelectedIndex = cmbCatalog.Items.Count - 1; } }
/// <summary> /// 检查MongoDB执行目录是否存在 /// </summary> /// <returns></returns> private bool MongoPathCheck() { if (Directory.Exists(SystemManager.SystemConfig.MongoBinPath)) { return(true); } MyMessageBox.ShowMessage("Exception", "Mongo Bin Path Can't be found", "Mongo Bin Path[" + SystemManager.SystemConfig.MongoBinPath + "]Can't be found"); UIAssistant.OpenModalForm(new FrmOption(), true, true); return(false); }
/// <summary> /// Options /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void OptionToolStripMenuItem_Click(object sender, EventArgs e) { UIAssistant.OpenModalForm(new FrmOption(), true, true); SystemManager.InitLanguage(); if (GuiConfig.IsUseDefaultLanguage) { MyMessageBox.ShowMessage("Language", "Language will change to \"English\" when you restart this tool"); } else { GuiConfig.Translateform(this); } }
/// <summary> /// 运行 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void cmdRun_Click(object sender, EventArgs e) { var map = new BsonJavaScript(ctlMapFunction.Context); var reduce = new BsonJavaScript(ctlReduceFunction.Context); //TODO:这里可能会超时,失去响应 //需要设置SocketTimeOut var args = new MapReduceArgs() { MapFunction = map, ReduceFunction = reduce }; if (!string.IsNullOrEmpty(ctlFinalizeFunction.Context)) { args.FinalizeFunction = new BsonJavaScript(ctlFinalizeFunction.Context); } args.OutputMode = (MapReduceOutputMode)cmbOutputMode.SelectedIndex; if (!string.IsNullOrEmpty(txtOutputCollectionName.Text)) { args.OutputCollectionName = txtOutputCollectionName.Text; } if (NumLimit.Value != 0) { args.Limit = (long)NumLimit.Value; } args.JsMode = chkjsMode.Checked; args.Verbose = chkverbose.Checked; args.BypassDocumentValidation = chkbypassDocumentValidation.Checked; if (QueryDoc != null) { args.Query = new QueryDocument(QueryDoc); } if (mCollation != null) { args.Collation = mCollation; } try { var mMapReduceResult = RuntimeMongoDbContext.GetCurrentCollection().MapReduce(args); var frm = new frmDataView() { ShowDocument = mMapReduceResult.Response, Title = "MapReduce Result" }; UIAssistant.OpenModalForm(frm, true, true); } catch (Exception ex) { Utility.ExceptionDeal(ex); } }
private void cmdCreateValidation_Click(object sender, EventArgs e) { try { var frmInsertDoc = new frmCreateDocument(); UIAssistant.OpenModalForm(frmInsertDoc, false, true); ValidationDoc = frmInsertDoc.mBsonDocument; if (ValidationDoc != null) { UiHelper.FillDataToTreeView("Validation", trvValidationDoc, frmInsertDoc.mBsonDocument); } } catch (Exception ex) { Utility.ExceptionDeal(ex); } }
/// <summary> /// 增加条件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void cmdAddCondition_Click(object sender, EventArgs e) { try { var frmAddStage = new FrmAddStage(); UIAssistant.OpenModalForm(frmAddStage, false, true); if (frmAddStage.DialogResult == DialogResult.OK) { stages.AddRange(frmAddStage.BsonDocumentList); FillStagesTreeview(); } } catch (Exception ex) { Utility.ExceptionDeal(ex); } }
/// <summary> /// 生成管道 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnAggrBuilder_Click(object sender, EventArgs e) { if (cmbViewOn.SelectedIndex == -1) { //必须先选中Collection return; } RuntimeMongoDbContext.SetCurrentCollection(cmbViewOn.Text); var frmAggregationBuilder = new FrmStageBuilder(); UIAssistant.OpenModalForm(frmAggregationBuilder, false, true); foreach (var item in frmAggregationBuilder.Aggregation) { stages.Add(item); } UiHelper.FillDataToTreeView("stages", trvNewStage, stages.Values.ToList().Select(x => (BsonDocument)x).ToList(), 0); }
/// <summary> /// Create Collection /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void CreateMongoCollectionToolStripMenuItem_Click(object sender, EventArgs e) { //Advance CreateCollection var frm = new frmCreateCollection { StrSvrPathWithTag = RuntimeMongoDbContext.SelectObjectTag, TreeNode = trvsrvlst.SelectedNode }; UIAssistant.OpenModalForm(frm, true, true); if (frm.Result) { //这里表示: Client / Server 一个Client 可能连结复数Server var srvkey = RuntimeMongoDbContext.GetCurrentServerKey() + "/" + RuntimeMongoDbContext.GetCurrentServerKey(); var newCol = UiHelper.FillCollectionInfoToTreeNode( RuntimeMongoDbContext.GetCurrentIMongoDataBase().GetCollection <BsonDocument>(frm.CollectionName), srvkey); if (TagInfo.GetTagType(trvsrvlst.SelectedNode.Tag.ToString()) == ConstMgr.CollectionListTag) { //选中CollectionList添加 trvsrvlst.SelectedNode.Nodes.Add(newCol); } else { //选中Database添加 foreach (TreeNode item in trvsrvlst.SelectedNode.Nodes) { var strNodeType = TagInfo.GetTagType(item.Tag.ToString()); if (strNodeType == ConstMgr.CollectionListTag) { //自己添加的Collection不是SystemCollection item.Nodes.Add(newCol); break; } } } DisableAllOpr(); } }
/// <summary> /// CreateRole /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void AddDBCustomeRoleStripMenuItem_Click(object sender, EventArgs e) { UIAssistant.OpenModalForm(new FrmAddRole(), true, true); }
/// <summary> /// Eval JS /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void evalJSToolStripMenuItem_Click(object sender, EventArgs e) { UIAssistant.OpenModalForm(new FrmEvalJs(), true, true); }
public override int Run() { UIAssistant.OpenModalForm(new FrmGenerateConfigIni(), true, true); return(Success); }
public override int Run() { UIAssistant.OpenModalForm(new FrmDosCommand(), true, true); return(Success); }
/// <summary> /// Connection Management /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void AddConnectionToolStripMenuItem_Click(object sender, EventArgs e) { UIAssistant.OpenModalForm(new frmConnect(), true, true); RefreshToolStripMenuItem_Click(sender, e); }
/// <summary> /// Profilling Level /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void profillingLevelToolStripMenuItem_Click(object sender, EventArgs e) { UIAssistant.OpenModalForm(new FrmProfilling(), true, true); }
/// <summary> /// Create User /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void AddUserToolStripMenuItem_Click(object sender, EventArgs e) { UIAssistant.OpenModalForm(new FrmUser(false), true, true); }
/// <summary> /// validate /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void validateToolStripMenuItem_Click(object sender, EventArgs e) { UIAssistant.OpenModalForm(new FrmValidate(), true, true); }
/// <summary> /// 添加 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void cmdAddCon_Click(object sender, EventArgs e) { UIAssistant.OpenModalForm(new FrmConnectionMgr(), true, true); RefreshConnection(); }
/// <summary> /// 索引管理 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void IndexManageToolStripMenuItem_Click(object sender, EventArgs e) { UIAssistant.OpenModalForm(new frmCollectionIndex(), true, true); }
/// <summary> /// 获得数据对象方法的注入 /// </summary> private static void GetInject() { //新建文档的文档获得方法注入 CtlDocumentView._getDocument = () => { var frmInsertDoc = new frmCreateDocument(); UIAssistant.OpenModalForm(frmInsertDoc, false, true); return(frmInsertDoc.mBsonDocument); }; ctlBsonValue.GetDocument = () => { var frmInsertDoc = new frmCreateDocument(); UIAssistant.OpenModalForm(frmInsertDoc, false, true); return(frmInsertDoc.mBsonDocument); }; ctlBsonValue.GetArray = () => { var frmInsertArray = new frmArrayCreator(); UIAssistant.OpenModalForm(frmInsertArray, false, true); return(frmInsertArray.mBsonArray); }; ctlBsonValue.GetGeoPoint = () => { var frmGeo = new frmCreateGeo(); UIAssistant.OpenModalForm(frmGeo, false, true); return(frmGeo.mBsonArray); }; frmGeoNear.GetGeo = () => { var frmGeo = new frmCreateGeo(); UIAssistant.OpenModalForm(frmGeo, false, true); return(frmGeo.mBsonArray); }; FrmServerMonitor.FreshTimeChanged = (time) => { SystemManager.SystemConfig.RefreshStatusTimer = time; SystemManager.SystemConfig.SaveSystemConfig(); }; FrmServerMonitor.MonitorItemsChanged = (items) => { SystemManager.SystemConfig.MonitorItems = items; SystemManager.SystemConfig.SaveSystemConfig(); }; RuntimeMongoDbContext.GetPassword = (username) => { var Password = MyMessageBox.ShowPasswordInput("Please Input Password of " + username, "Password"); return(Password); }; CtlUserView.OpenAddNewUserForm = (isAdmin) => { UIAssistant.OpenModalForm(new FrmUser(isAdmin), true, true); }; CtlUserView.OpenChangePasswordForm = (isAdmin, name) => { UIAssistant.OpenModalForm(new FrmUser(isAdmin, name), true, true); }; CtlDocumentView.ElementOp = (isUpdate, selectedNode, isElement) => { var f = new FrmElement(isUpdate, selectedNode, isElement); f.ShowDialog(); }; CtlGfsView.GetUploadFileOption = () => { var opt = new Gfs.UpLoadFileOption(); var frm = new FrmGfsOption(); frm.ShowDialog(); opt.AlreadyOpt = frm.Option; opt.DirectorySeparatorChar = frm.DirectorySeparatorChar; opt.FileNameOpt = frm.Filename; opt.IgnoreSubFolder = frm.IgnoreSubFolder; return(opt); }; }
/// <summary> /// CreateView /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void CreateViewtoolStripMenuItem_Click(object sender, EventArgs e) { var frm = new frmCreateView(); UIAssistant.OpenModalForm(frm, true, true); }