Example #1
0
        static void Main()
        {
            try
            {
                #region 初始化全局变量
                LogEntry.Instance.WriteInfo("Application Started.");
                DocSetting.XMLSettingFullPath = Application.StartupPath + "\\YDTSetting.xml";
                DocSetting.Load();
                #endregion

                #region 全局捕获异常
                Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);
                Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException);
                AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
                #endregion

                #region 应用程序的主入口点
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                Application.Run(new UCWindow.FrmMain());
                Application.ApplicationExit += (sender, e) => LogEntry.Instance.WriteInfo("Application Closed.");
                #endregion
            }
            catch (Exception ex)
            {
                LogEntry.Instance.WriteError("Exception", ex);
                MessageBox.Show(ex.Message, "System Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Application.Exit();
            }
        }
Example #2
0
        private void FrmConfig_Load(object sender, EventArgs e)
        {
            DocSetting.Load();

            this.Txb_ReportTitle.Text  = DocSetting.Instance.ReportTitle;
            this.Txb_ReportHeader.Text = DocSetting.Instance.ReportHeader;
            this.Txb_ReportFooter.Text = DocSetting.Instance.ReportFooter;
            this.Txb_ReportPrefix.Text = DocSetting.Instance.ReportNamePrefix;
        }