示例#1
0
 /// <summary>
 ///     切换Tab的时候,必须切换当前对象
 /// </summary>
 public frmMain()
 {
     InitializeComponent();
     GetSystemIcon.InitMainTreeImage();
     GetSystemIcon.InitTabViewImage();
     trvsrvlst.ImageList = GetSystemIcon.MainTreeImage;
     tabView.ImageList   = GetSystemIcon.TabViewImage;
     SetMenuImage();
     GuiConfig.Translateform(this);
     if (!GuiConfig.IsUseDefaultLanguage)
     {
         //其他控件
         statusStripMain.Items[0].Text = GuiConfig.GetText(TextType.MainStatusBarTextReady);
     }
     //Init ToolBar
     InitToolBar();
     Text += "  " + SystemManager.Version;
     Icon  = Icon.ExtractAssociatedIcon(Application.ExecutablePath);
     if (SystemManager.MonoMode)
     {
         Text += " MONO";
     }
     //新建文档的文档获得方法注入
     CtlDocumentView._getDocument = () =>
     {
         var frmInsertDoc = new frmCreateDocument();
         Utility.OpenForm(frmInsertDoc, false, true);
         return(frmInsertDoc.MBsonDocument);
     };
 }
示例#2
0
        /// <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);
            }
        }
示例#3
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);
            }
        }
示例#4
0
        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();
        }
示例#5
0
        /// <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);
            };
        }