コード例 #1
0
ファイル: Frm_main.cs プロジェクト: anrk0451/Olive
        /// <summary>
        /// 主窗体关闭
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Frm_main_FormClosed(object sender, FormClosedEventArgs e)
        {
            //销毁业务对象表
            dt_bo01.Dispose();

            //断开数据库
            SqlAssist.DisConnect();

            //关闭关联的打印进程
            if (!printprocess.HasExited)
            {
                printprocess.Kill();
            }
        }
コード例 #2
0
ファイル: RibbonForm.cs プロジェクト: radtek/JEast
        /// <summary>
        /// 主窗口关闭
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void RibbonForm_FormClosed(object sender, FormClosedEventArgs e)
        {
            SqlAssist.DisConnect();

            //关闭关联的打印进程
            if (!printprocess.HasExited)
            {
                printprocess.Kill();
            }

            //关闭金税卡
            if (Envior.TAX_READY)
            {
                goldTax.CloseCard();
            }
        }
コード例 #3
0
ファイル: Frm_main.cs プロジェクト: anrk0451/green
        /// <summary>
        /// 主窗体关闭
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Frm_main_FormClosed(object sender, FormClosedEventArgs e)
        {
            //销毁业务对象表
            dt_bo01.Dispose();

            //断开数据库
            SqlAssist.DisConnect();

            //关闭关联的打印进程
            if (!printprocess.HasExited)
            {
                printprocess.Kill();
            }

            //保存皮肤
            //Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
            //if (string.IsNullOrEmpty(skinRibbonGalleryBarItem1.Gallery.GetCheckedItems()[0].Caption))
            //    config.AppSettings.Settings["skinname"].Value = "LiLian";
            //else
            //    config.AppSettings.Settings["skinname"].Value = skinRibbonGalleryBarItem1.Gallery.GetCheckedItems()[0].Caption;

            //config.Save(ConfigurationSaveMode.Modified);
        }
コード例 #4
0
        static void Main()
        {
            try
            {
                //设置应用程序处理异常方式:ThreadException处理
                Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);
                //处理UI线程异常
                Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException);
                //处理非UI线程异常
                AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);

                #region 应用程序的主入口点
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);

                BonusSkins.Register();
                SkinManager.EnableFormSkins();
                UserLookAndFeel.Default.SetSkinStyle("DevExpress Style");

                ///// 连接数据库 //////
                SqlAssist.ConnectDb();

                ///// 检查版本  ///////
                //MessageBox.Show(AppInfo.AppVersion,"当前版本");
                string curNewestVersion = Tools.getNewVersion();
                //MessageBox.Show(curNewestVersion, "服务器版本");
                if (string.Compare(curNewestVersion, AppInfo.AppVersion) > 0)
                {
                    MessageBox.Show("服务器发现更新的版本!系统需要升级", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    Tools.DownloadNew(curNewestVersion);
                    SqlAssist.DisConnect();

                    //启动升级拷贝 //////

                    try
                    {
                        //myProcess.StartInfo.UseShellExecute = false;
                        //myProcess.StartInfo.FileName = pname;
                        //myProcess.StartInfo.CreateNoWindow = true;

                        Process.Start("Upgrade.exe", curNewestVersion);
                    }
                    catch (Exception e)
                    {
                        Console.WriteLine(e.Message);
                    }


                    Application.Exit();
                    return;
                }


                Application.Run(new RibbonForm());
                #endregion
            }
            catch (Exception ex)
            {
                string str = GetExceptionMsg(ex, string.Empty);
                MessageBox.Show(str, "系统错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }