public static void Init() { // Set Google API keys, used for Geolocation requests sans GPS. See http://www.chromium.org/developers/how-tos/api-keys // Environment.SetEnvironmentVariable("GOOGLE_API_KEY", ""); // Environment.SetEnvironmentVariable("GOOGLE_DEFAULT_CLIENT_ID", ""); // Environment.SetEnvironmentVariable("GOOGLE_DEFAULT_CLIENT_SECRET", ""); //Chromium Command Line args //http://peter.sh/experiments/chromium-command-line-switches/ //NOTE: Not all relevant in relation to `CefSharp`, use for reference purposes only. var settings = new CefSettings(); settings.RemoteDebuggingPort = 8088; //settings.UserAgent = "CefSharp Browser" + Cef.CefSharpVersion; // Example User Agent //settings.CefCommandLineArgs.Add("renderer-process-limit", "1"); //settings.CefCommandLineArgs.Add("renderer-startup-dialog", "renderer-startup-dialog"); //settings.CefCommandLineArgs.Add("disable-gpu", "1"); //settings.CefCommandLineArgs.Add("disable-gpu-vsync", "1"); //settings.CefCommandLineArgs.Add("enable-media-stream", "1"); //Enable WebRTC //settings.CefCommandLineArgs.Add("no-proxy-server", "1"); //Don't use a proxy server, always make direct connections. Overrides any other proxy server flags that are passed. //Disables the DirectWrite font rendering system on windows. //Possibly useful when experiencing blury fonts. //settings.CefCommandLineArgs.Add("disable-direct-write", "1"); settings.LogSeverity = LogSeverity.Verbose; if (DebuggingSubProcess) { var architecture = Environment.Is64BitProcess ? "x64" : "x86"; settings.BrowserSubprocessPath = "..\\..\\..\\..\\CefSharp.BrowserSubprocess\\bin\\" + architecture + "\\Debug\\CefSharp.BrowserSubprocess.exe"; } settings.RegisterScheme(new CefCustomScheme { SchemeName = CefSharpSchemeHandlerFactory.SchemeName, SchemeHandlerFactory = new CefSharpSchemeHandlerFactory() }); Cef.OnContextInitialized = delegate { Cef.SetCookiePath("cookies", true); }; //Cef will check if all dependencies are present //For special case when Checking Windows Xp Dependencies //DependencyChecker.IsWindowsXp = true; if (!Cef.Initialize(settings, shutdownOnProcessExit: true, performDependencyCheck: true)) { throw new Exception("Unable to Initialize Cef"); } }
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()); }
static void Main(string[] args) { CefSettings settings = new CefSettings(); settings.RemoteDebuggingPort = 8088; settings.LogSeverity = LogSeverity.Verbose; settings.CachePath = "cache"; Cef.OnContextInitialized = delegate { Cef.SetCookiePath("cookies", true); }; if (!Cef.Initialize(settings, shutdownOnProcessExit: true, performDependencyCheck: !DebuggingSubProcess)) { throw new Exception("Unable to Initialize Cef"); } Cef.Shutdown(); }
private void w_main_Loaded(object sender, RoutedEventArgs e) { if (Properties.Settings.Default.theme == "Blue") { ts_theme.IsChecked = true; } var theme = ThemeManager.DetectAppStyle(Application.Current); ThemeManager.ChangeAppStyle(Application.Current, ThemeManager.GetAccent(Properties.Settings.Default.theme), ThemeManager.GetAppTheme("BaseLight")); if (Properties.Settings.Default.fs == true) { this.WindowState = WindowState.Maximized; ts_fully.IsChecked = true; } else { this.WindowState = WindowState.Normal; ts_fully.IsChecked = false; } s_timer.Value = Convert.ToDouble(Properties.Settings.Default.timer); l_timer.Content = "every " + Properties.Settings.Default.timer + " sec(s)"; string passovr = Properties.Settings.Default.timer + "000"; notitime = Convert.ToInt32(passovr); notifenable = Properties.Settings.Default.noti; if (notifenable == 1) { ts_desknotif.IsChecked = true; DelayAction(notitime, new Action(() => { notifcheck(); })); } else { b_snotray.IsEnabled = false; b_snotray.Fill = Brushes.LightSlateGray; b_clearnoti.IsEnabled = false; ts_snozee.IsEnabled = false; ts_desknotifsnooze.IsEnabled = false; mNotiIcon.Icon = new System.Drawing.Icon(AppDomain.CurrentDomain.BaseDirectory + @"Resources\logo_snozed.ico"); } beta = Properties.Settings.Default.beta; if (beta == 1) { ts_ibeta.IsChecked = true; string sourcebeta = "https://beta.icloud.com/"; c_web.Load(sourcebeta); } else { ts_ibeta.IsChecked = false; string sourcebeta = "https://www.icloud.com/"; c_web.Load(sourcebeta); } minimi = Properties.Settings.Default.minimi; if (minimi == 1) { ts_minitray.IsChecked = true; } else { ts_minitray.IsChecked = false; } if (Properties.Settings.Default.shasno == 1) { ts_desknotifsnooze.IsChecked = true; snoozeed(); } if (Properties.Settings.Default.user == "" || Properties.Settings.Default.pass == "") { l_user.Content = "Username"; tb_user.IsEnabled = true; l_pass.Content = "Password"; tb_pass.IsEnabled = true; b_save.Content = "Save Credential"; } else { l_user.Content = "Username - Encrypted"; tb_user.IsEnabled = false; tb_user.Text = Properties.Settings.Default.user; l_pass.Content = "Password - Encrypted"; tb_pass.IsEnabled = false; tb_pass.Password = Properties.Settings.Default.pass; b_save.Content = "Reset Credential"; b_save.IsTabStop = false; } int skipfirst = 0; int breakloop = 0; string line; System.IO.StreamReader file = new System.IO.StreamReader(AppDomain.CurrentDomain.BaseDirectory + @"changelog.txt"); while ((line = file.ReadLine()) != null && breakloop == 0) { switch (skipfirst) { case 0: versioncontrol.Content = line; skipfirst++; break; case 1: versioncontrol.Content += " " + line; skipfirst++; break; case 2: skipfirst++; break; default: if (line != "-----") { changelogtext.Content += line; changelogtext.Content += System.Environment.NewLine; } else { breakloop = 1; } break; } } file.Close(); var settings = new CefSettings(); settings.CachePath = AppDomain.CurrentDomain.BaseDirectory + @"cache"; Cef.Initialize(settings); Cef.SetCookiePath(AppDomain.CurrentDomain.BaseDirectory + @"cache", true); startingup = 0; }
public static void Init() { // Set Google API keys, used for Geolocation requests sans GPS. See http://www.chromium.org/developers/how-tos/api-keys // Environment.SetEnvironmentVariable("GOOGLE_API_KEY", ""); // Environment.SetEnvironmentVariable("GOOGLE_DEFAULT_CLIENT_ID", ""); // Environment.SetEnvironmentVariable("GOOGLE_DEFAULT_CLIENT_SECRET", ""); //Chromium Command Line args //http://peter.sh/experiments/chromium-command-line-switches/ //NOTE: Not all relevant in relation to `CefSharp`, use for reference purposes only. var settings = new CefSettings(); settings.RemoteDebuggingPort = 8088; //The location where cache data will be stored on disk. If empty an in-memory cache will be used for some features and a temporary disk cache for others. //HTML5 databases such as localStorage will only persist across sessions if a cache path is specified. settings.CachePath = "cache"; //settings.UserAgent = "CefSharp Browser" + Cef.CefSharpVersion; // Example User Agent //settings.CefCommandLineArgs.Add("renderer-process-limit", "1"); //settings.CefCommandLineArgs.Add("renderer-startup-dialog", "renderer-startup-dialog"); //settings.CefCommandLineArgs.Add("disable-gpu", "1"); //settings.CefCommandLineArgs.Add("disable-gpu-vsync", "1"); //settings.CefCommandLineArgs.Add("enable-media-stream", "1"); //Enable WebRTC //settings.CefCommandLineArgs.Add("no-proxy-server", "1"); //Don't use a proxy server, always make direct connections. Overrides any other proxy server flags that are passed. //settings.CefCommandLineArgs.Add("debug-plugin-loading", "1"); //Dumps extra logging about plugin loading to the log file. //settings.CefCommandLineArgs.Add("disable-plugins-discovery", "1"); //Disable discovering third-party plugins. Effectively loading only ones shipped with the browser plus third-party ones as specified by --extra-plugin-dir and --load-plugin switches //Disables the DirectWrite font rendering system on windows. //Possibly useful when experiencing blury fonts. //settings.CefCommandLineArgs.Add("disable-direct-write", "1"); var proxy = ProxyConfig.GetProxyInformation(); switch (proxy.AccessType) { case InternetOpenType.Direct: { //Don't use a proxy server, always make direct connections. settings.CefCommandLineArgs.Add("no-proxy-server", "1"); break; } case InternetOpenType.Proxy: { settings.CefCommandLineArgs.Add("proxy-server", proxy.ProxyAddress); break; } case InternetOpenType.PreConfig: { settings.CefCommandLineArgs.Add("proxy-auto-detect", "1"); break; } } settings.LogSeverity = LogSeverity.Verbose; if (DebuggingSubProcess) { var architecture = Environment.Is64BitProcess ? "x64" : "x86"; settings.BrowserSubprocessPath = "..\\..\\..\\..\\CefSharp.BrowserSubprocess\\bin\\" + architecture + "\\Debug\\CefSharp.BrowserSubprocess.exe"; } settings.RegisterScheme(new CefCustomScheme { SchemeName = CefSharpSchemeHandlerFactory.SchemeName, SchemeHandlerFactory = new CefSharpSchemeHandlerFactory() }); Cef.OnContextInitialized = delegate { Cef.SetCookiePath("cookies", true); }; if (!Cef.Initialize(settings, shutdownOnProcessExit: true, performDependencyCheck: !DebuggingSubProcess)) { throw new Exception("Unable to Initialize Cef"); } }
static void Main(string[] args) { // subscribe to our wonderful exception handler AppDomain currentDomain = AppDomain.CurrentDomain; currentDomain.UnhandledException += new UnhandledExceptionEventHandler(MyHandler); // perform the directory check Surf.app.app_directory_checker.directoryCheck(); // load the user settings app.user_settings.loadUserSettings(); // enable Windows visual styles Application.EnableVisualStyles(); // This is used for pre .Net 1.x controls, none of which we use. // If enabled, it forces the app to draw using GDI+. // GDI+ is the old way, GDI is the new way. // PERMANENT: False Application.SetCompatibleTextRenderingDefault(false); // prepare the new CefSharp settings var settings = new CefSettings { UserAgent = app.product.userAgent, CachePath = app.product.dirCache, BrowserSubprocessPath = "surf.exe", }; // Not really sure if we need this, it seems // that CefSettings.CachePath also sets for // the cookies path. Cef.SetCookiePath(app.product.dirCache, true); // initialize CEF Cef.Initialize(settings); // prepare the new browser window Surf.browser.browser_main browserwindow = new Surf.browser.browser_main(); // add a new tab to the browser window browserwindow.Tabs.Add( new TitleBarTab(browserwindow) { Content = new Surf.browser.tab_frame { Text = "New Tab" } }); browserwindow.SelectedTabIndex = 0; // get the size from our settings. browserwindow.Size = new System.Drawing.Size(app.user_settings.window_width, app.user_settings.window_height); browserwindow.Location = new System.Drawing.Point(user_settings.window_left, user_settings.window_top); // Checks if we should maximize the window or not. // How was it set in the settings? if (app.user_settings.window_maximized == true) { browserwindow.WindowState = FormWindowState.Maximized; } else { browserwindow.WindowState = FormWindowState.Normal; } // prepare the TabRenderer TitleBarTabsApplicationContext applicationContext = new TitleBarTabsApplicationContext(); applicationContext.Start(browserwindow); // start the browser! Application.Run(applicationContext); } //void Main