Exemple #1
0
 public void ShowDialog()
 {
     using (System.Windows.Forms.Form f = new FrmOption())
     {
         f.ShowDialog();
     }
 }
Exemple #2
0
        /// <summary>
        ///     初始化
        /// </summary>
        public static void Init()
        {
            //MongoDB驱动版本的取得
            Debug.Print(Path.DirectorySeparatorChar.ToString());
            var info =
                FileVersionInfo.GetVersionInfo(Application.StartupPath + Path.DirectorySeparatorChar +
                                               "MongoDB.Driver.dll");

            MongoHelper.MongoDbDriverVersion = info.ProductVersion;
            info =
                FileVersionInfo.GetVersionInfo(Application.StartupPath + Path.DirectorySeparatorChar +
                                               "MongoDB.Bson.dll");
            MongoHelper.MongoDbBsonVersion = info.ProductVersion;
            //版本设定
            Version          = Application.ProductVersion;
            DebugMode        = false;
            MonoMode         = Type.GetType("Mono.Runtime") != null;
            GuiConfig.IsMono = MonoMode;
            //Can't know for OSVersion to diff Mac or Unix....
            //异常处理器的初始化
            Utility.ExceptionAppendInfo = "MongoDbDriverVersion:" + MongoHelper.MongoDbDriverVersion +
                                          Environment.NewLine;
            Utility.ExceptionAppendInfo += "MongoDbBsonVersion:" + MongoHelper.MongoDbBsonVersion +
                                           Environment.NewLine;
            //config
            SystemConfig.AppPath = Application.StartupPath + Path.DirectorySeparatorChar;
            MongoConfig.AppPath  = Application.StartupPath + Path.DirectorySeparatorChar;
            var localconfigfile = Application.StartupPath + Path.DirectorySeparatorChar +
                                  SystemConfig.SystemConfigFilename;

            if (File.Exists(localconfigfile))
            {
                SystemConfig.LoadFromConfigFile();
                InitLanguage();
                MongodbDosCommand.MongoBinPath = SystemConfig.MongoBinPath;
            }
            else
            {
                SystemConfig = new SystemConfig();
                var frmLanguage = new FrmLanguage();
                frmLanguage.ShowDialog();
                InitLanguage();
                var frmOption = new FrmOption();
                frmOption.ShowDialog();
                SystemConfig.SaveSystemConfig();
            }
            localconfigfile = Application.StartupPath + Path.DirectorySeparatorChar + MongoConfig.MongoConfigFilename;
            if (File.Exists(localconfigfile))
            {
                MongoConfig.LoadFromConfigFile();
                RuntimeMongoDbContext.MongoConnectionConfigList = MongoConnectionConfig.MongoConfig.ConnectionList;
            }
            Application.Run(new FrmMain());
            //delete tempfile directory when exit
            if (Directory.Exists(Gfs.TempFileFolder))
            {
                Directory.Delete(Gfs.TempFileFolder, true);
            }
        }
Exemple #3
0
        private void MIOption_Click(object sender, EventArgs e)
        {
            FrmOption option = new FrmOption();
            //try
            //{
            FormTools formTools = new FormTools();

            formTools.showFrom(this, option);
            //}
            //catch
            //{

            //}
        }