Esempio n. 1
0
        static void Main()
        {
            MainAppUtils.AjustVideoSetting();
            try
            {
                Form form = null;
                try
                {
                    Application.EnableVisualStyles();
                    Application.SetCompatibleTextRenderingDefault(false);
                    if (!MainAppUtils.CheckForSingleInstance())
                    {
                        return;
                    }

                    //for testing, remove this lines in real app
                    var culture = new CultureInfo("en-US");
                    CultureInfo.DefaultThreadCurrentCulture   = culture;
                    CultureInfo.DefaultThreadCurrentUICulture = culture;

                    log = Log.GetLogger();
                    AppManager.Instance = new DemoAppManager();
                    MainAppUtils.InitAppPaths();
                    AppManager.Instance.MainAppFormType = typeof(FrwMainAppForm);
                    form              = AppManager.Instance.LoadDocPanelContainersState(true);
                    form.FormClosing += Form_FormClosing;
                    form.FormClosed  += Form_FormClosed;

                    Console.WriteLine("FrwConfig.Instance.GlobalDir: " + FrwConfig.Instance.GlobalDir);
                    Console.WriteLine("FrwConfig.Instance.ProfileDir: " + FrwConfig.Instance.ProfileDir);
                    Console.WriteLine("FrwConfig.Instance.ComputerUserDir: " + FrwConfig.Instance.ComputerUserDir);
                    Console.WriteLine("FrwConfig.Instance.UserTempDir: " + FrwConfig.Instance.UserTempDir);
                }
                catch (Exception ex)
                {
                    Log.ShowError("Error start app", ex);
                    Application.Exit();
                }
                if (form != null && !form.IsDisposed)
                {
                    Application.ThreadException += Application_ThreadException;
                    Application.Run(form);
                }
            }
            catch (Exception ex)
            {
                Log.ShowError("Error running main app form", ex);
                MessageBox.Show("Unexpected error: " + ex);
                Application.Exit();
            }
        }
Esempio n. 2
0
        /// <summary>
        /// We recommend that you use our project templates (FrwSimpleWinCRUDTemplate) to build your own application.
        /// But if you prefer not to use our templates, then you need to call the following minimum sequence of methods
        /// when starting the application
        /// </summary>
        static public void StartupExample()
        {
            if (!MainAppUtils.CheckForSingleInstance())
            {
                return;
            }
            //Initializes all required objects. If you need to initialize objects individually or perform a
            //special initialization, copy the code from the body of this method and modify it.
            MainAppUtils.InitAppPaths();
            //set type of your main application form
            AppManager.Instance.MainAppFormType = typeof(MyMainForm);
            MyMainForm form = (MyMainForm)AppManager.Instance.LoadDocPanelContainersState(true);

            Application.Run(form);
        }