Exemple #1
0
        private static void Main()
        {
            // Enable visual styles and better text rendering
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(true);

            // Get the default local application data path
            AppDataPath = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
            AppDataPath = Path.Combine(AppDataPath, Application.ProductName);

            #region --------------------[ DEBUG MODE BLOCK ]--------------------

#if DEBUG
            // Use a proper application data folder for debug mode
            AppDataPath = Path.Combine(AppDataPath, "[DEBUG]");
#endif

            #endregion

            // Create the application data folder if it doesn't exist
            if (!Directory.Exists(AppDataPath))
            {
                Directory.CreateDirectory(AppDataPath);
            }

            // Initializes CefSharp with the default settings
            Cef.Initialize(new CefSettings {
                BrowserSubprocessPath = BrowserSubprocessFileName,
                CachePath             = Path.Combine(AppDataPath, CacheFolderName),
                LogFile = Path.Combine(AppDataPath, LogFileName)
            });

            // Separate cookies storage location from the cache
            Cef.SetCookiePath(Path.Combine(AppDataPath, CookiesFolderName), false);

            // Initialize a new instance of the wrapper form
            WrapperForm = new WrapperForm();

            // Initialize a new instance of the Easy Settings class
            Settings = new EasySettings <ApplicationSettings>(Path.Combine(AppDataPath, SettingsFileName), "Settings");

            // Run the application with a notification context
            Application.Run(new NotificationContext());
        }
Exemple #2
0
        private static void Main() {
            // Enable visual styles and better text rendering
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(true);

            // Get the default local application data path
            AppDataPath = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
            AppDataPath = Path.Combine(AppDataPath, Application.ProductName);

            #region --------------------[ DEBUG MODE BLOCK ]--------------------

#if DEBUG
            // Use a proper application data folder for debug mode
            AppDataPath = Path.Combine(AppDataPath, "[DEBUG]");
#endif

            #endregion

            // Create the application data folder if it doesn't exist
            if(!Directory.Exists(AppDataPath)) {
                Directory.CreateDirectory(AppDataPath);
            }

            // Initializes CefSharp with the default settings
            Cef.Initialize(new CefSettings {
                BrowserSubprocessPath = BrowserSubprocessFileName,
                CachePath = Path.Combine(AppDataPath, CacheFolderName),
                LogFile = Path.Combine(AppDataPath, LogFileName)
            });

            // Separate cookies storage location from the cache
            Cef.SetCookiePath(Path.Combine(AppDataPath, CookiesFolderName), false);

            // Initialize a new instance of the wrapper form
            WrapperForm = new WrapperForm();

            // Initialize a new instance of the Easy Settings class
            Settings = new EasySettings<ApplicationSettings>(Path.Combine(AppDataPath, SettingsFileName), "Settings");

            // Run the application with a notification context
            Application.Run(new NotificationContext());
        }