Exemple #1
0
        public void InstallBar(int total, int percent)
        {
            this.total = total;
            Settings.Current.ProgressAccess = new Progress("解压文件", percent, 1);
            InstallBarDelegate installBarDelegate = new InstallBarDelegate(Bar);

            installBars.BeginInvoke(installBarDelegate);
        }
Exemple #2
0
        /// <summary>
        /// Reset进度条
        /// </summary>
        private void ResetBar()
        {
            InstallBarDelegate myDelegateResetBar = new InstallBarDelegate(DelegateResetBar);

            installBars.BeginInvoke(myDelegateResetBar);
        }
Exemple #3
0
        /// <summary>
        /// 开始安装
        /// </summary>
        private void Setup()
        {
            int      stepIndex = 0;
            Settings setting   = Settings.Current;

            setting.RootPath = SiteInfo.Current.WebPath;
            string error = string.Empty;

            try
            {
                //解压文件
                stepIndex++;
                installWaiter.UpZip();

                ResetBar();

                //数据库操作  sql
                stepIndex++;
                SetupManager.InstallDatabase(delegate(int percent, string message)
                {
                    setting.ProgressAccess = new Progress("安装/更新数据库", percent, stepIndex);
                    InstallBarDelegate delegateInstallDb = new InstallBarDelegate(InstallDb);
                    installBars.BeginInvoke(delegateInstallDb);
                });

#if SQLITE
                if (Settings.Current.SetupMode == Max.Installs.SetupMode.New)
                {
                    error = SetupManager.SetDatabase();
                }
#endif

                ResetBar();

                //写入配置文件
                stepIndex++;
                ConfigConnectionString();
                SetupManager.AlterGolbals(SiteInfo.Current.WebPath + "\\");
#if SQLSERVER
                if (Settings.Current.SetupMode == Max.Installs.SetupMode.New)
                {
                    SetupManager.CreateAdministrator();//创建管理员
                }
#endif
                setting.ProgressAccess = new Progress("写入配置文件", 100, stepIndex);
                InstallBarDelegate delegateSetConfig = new InstallBarDelegate(SetConfig);
                installBars.BeginInvoke(delegateSetConfig);

                ResetBar();

                //特殊文件夹权限设置
                SetSpecialPurview();
                setting.ProgressAccess = new Progress("设置文件夹权限", 100, stepIndex);
                InstallBarDelegate delegateSetPurview = new InstallBarDelegate(SetPurview);
                installBars.BeginInvoke(delegateSetPurview);

                //完成
                InstallBarDelegate delegateInstallFinish = new InstallBarDelegate(InstallFinish);
                installBars.BeginInvoke(delegateInstallFinish);
            }
            catch (Exception ex)
            {
                Thread.CurrentThread.Abort();
                SetupManager.CreateLog(ex);
                MessageBox.Show(ex.Message, "bbsMax安装向导", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
Exemple #4
0
 public void InstallBar(int total, int percent)
 {
     this.total = total;
     Settings.Current.ProgressAccess = new Progress("解压文件", percent, 1);
     InstallBarDelegate installBarDelegate = new InstallBarDelegate(Bar);
     installBars.BeginInvoke(installBarDelegate);
 }
Exemple #5
0
 /// <summary>
 /// Reset进度条
 /// </summary>
 private void ResetBar()
 {
     InstallBarDelegate myDelegateResetBar = new InstallBarDelegate(DelegateResetBar);
     installBars.BeginInvoke(myDelegateResetBar);
 }
Exemple #6
0
        /// <summary>
        /// 开始安装
        /// </summary>
        private void Setup()
        {
            int stepIndex = 0;
            Settings setting = Settings.Current;
            setting.RootPath = SiteInfo.Current.WebPath;
            string error = string.Empty;
            try
            {
                //解压文件
                stepIndex++;
                installWaiter.UpZip();

                ResetBar();

                //数据库操作  sql
                stepIndex++;
                SetupManager.InstallDatabase(delegate(int percent, string message)
                {
                    setting.ProgressAccess = new Progress("安装/更新数据库", percent, stepIndex);
                    InstallBarDelegate delegateInstallDb = new InstallBarDelegate(InstallDb);
                    installBars.BeginInvoke(delegateInstallDb);
                });

#if SQLITE
            if (Settings.Current.SetupMode == Max.Installs.SetupMode.New)
                error = SetupManager.SetDatabase();
#endif

                ResetBar();

                //写入配置文件
                stepIndex++;
                ConfigConnectionString();
                SetupManager.AlterGolbals(SiteInfo.Current.WebPath + "\\");
#if SQLSERVER
                if (Settings.Current.SetupMode == Max.Installs.SetupMode.New)
                    SetupManager.CreateAdministrator();//创建管理员
#endif
                setting.ProgressAccess = new Progress("写入配置文件", 100, stepIndex);
                InstallBarDelegate delegateSetConfig = new InstallBarDelegate(SetConfig);
                installBars.BeginInvoke(delegateSetConfig);

                ResetBar();

                //特殊文件夹权限设置
                SetSpecialPurview();
                setting.ProgressAccess = new Progress("设置文件夹权限", 100, stepIndex);
                InstallBarDelegate delegateSetPurview = new InstallBarDelegate(SetPurview);
                installBars.BeginInvoke(delegateSetPurview);

                //完成
                InstallBarDelegate delegateInstallFinish = new InstallBarDelegate(InstallFinish);
                installBars.BeginInvoke(delegateInstallFinish);
            }
            catch (Exception ex)
            {
                Thread.CurrentThread.Abort();
                SetupManager.CreateLog(ex);
                MessageBox.Show(ex.Message, "bbsMax安装向导", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }