void Check (Settings settings) { Assert.IsFalse (settings.EnableFrameRateCounter, "Host.Settings.EnableFrameRateCounter"); Assert.IsTrue (settings.EnableHTMLAccess, "Host.Settings.EnableHTMLAccess"); Assert.IsFalse (settings.EnableRedrawRegions, "Host.Settings.EnableRedrawRegions"); Assert.AreEqual (60, settings.MaxFrameRate, "Host.Settings.MaxFrameRate"); Assert.IsFalse (settings.Windowless, "Host.Settings.Windowless"); }
void Check (Settings settings) { Assert.IsFalse (settings.EnableFrameRateCounter, "Host.Settings.EnableFrameRateCounter"); Assert.IsTrue (settings.EnableHTMLAccess, "Host.Settings.EnableHTMLAccess"); Assert.IsFalse (settings.EnableRedrawRegions, "Host.Settings.EnableRedrawRegions"); if (Environment.OSVersion.Platform == PlatformID.MacOSX) Assert.AreEqual (400, settings.MaxFrameRate, "Host.Settings.MaxFrameRate"); else Assert.AreEqual (60, settings.MaxFrameRate, "Host.Settings.MaxFrameRate"); Assert.IsFalse (settings.Windowless, "Host.Settings.Windowless"); }
public void Updates () { Settings settings = new Settings (); Assert.IsFalse (Application.Current.Host.Settings.EnableFrameRateCounter, "Host.Settings.EnableFrameRateCounter==false"); try { settings.EnableFrameRateCounter = true; Assert.IsTrue (settings.EnableFrameRateCounter, "EnableFrameRateCounter==true"); // any instance will change the same (plugin) data Assert.IsTrue (Application.Current.Host.Settings.EnableFrameRateCounter, "Host.Settings.EnableFrameRateCounter==true"); } finally { settings.EnableFrameRateCounter = false; } }
public void MaxFrameRate () { Settings settings = new Settings (); int max = settings.MaxFrameRate; try { settings.MaxFrameRate = 0; Assert.AreEqual (1, settings.MaxFrameRate, "Zero"); settings.MaxFrameRate = Int32.MaxValue; Assert.AreEqual (Int32.MaxValue, settings.MaxFrameRate, "Max"); settings.MaxFrameRate = Int32.MinValue; Assert.AreEqual (Int32.MinValue, settings.MaxFrameRate, "Min"); Assert.AreEqual(new Settings().MaxFrameRate, settings.MaxFrameRate, "inherit settings"); } finally { settings.MaxFrameRate = max; } // no validation }
private void Window_SourceInitialized(object sender, EventArgs e) { Settings settings = new Settings(); if (!CEF.Initialize(settings)) { return; } var source = PresentationSource.FromVisual(sender as Visual) as HwndSource; browser = new WebBrowser(source, "https://github.com/ataranto/CefSharp"); browser.PropertyChanged += HandleBrowserPropertyChanged; this.frame.Content = browser; }
public void New () { Settings settings = new Settings (); Check (settings); }
protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); string[] args = e.Args; if (args.Length > 0) { // Get the 2 character command line argument string arg = args[0].ToLower(CultureInfo.InvariantCulture).Trim().Substring(0, 2); switch (arg) { case "/o": //Show the screensaver picking dialog System.Diagnostics.Process.Start("control.exe", "desk.cpl,screensaver,@screensaver"); this.Shutdown(); break; case "/c": // Show the options dialog Settings settings = new Settings(); settings.Show(); break; case "/p": //Show a preview winPreview = new Main(1); //A handle to the preview window is passed in Int32 previewHandle = Convert.ToInt32(args[1]); IntPtr pPreviewHnd = new IntPtr(previewHandle); //Use the RECT struct & user32 dll to learn the size of the preview window RECT lpRect = new RECT(); bool bGetRect = GetClientRect(pPreviewHnd, ref lpRect); //Make our window fit in it HwndSourceParameters sourceParams = new HwndSourceParameters("sourceParams"); sourceParams.PositionX = 0; sourceParams.PositionY = 0; sourceParams.Height = lpRect.Bottom - lpRect.Top; sourceParams.Width = lpRect.Right - lpRect.Left; sourceParams.ParentWindow = pPreviewHnd; //WindowStyles.WS_VISIBLE | WindowStyles.WS_CHILD | WindowStyles.WS_CLIPCHILDREN sourceParams.WindowStyle = (int)(0x52000000); //Start to bind them together winWPFContent = new HwndSource(sourceParams); winWPFContent.Disposed += new EventHandler(winWPFContent_Disposed); //Makes sure the preview window exits!!! //For now, we hide elements that don't scale correctly //Later, the mainGrid will be able to handle all this for us winPreview.lblAuthor.Height = 0; winPreview.lblFeed.Height = 0; winPreview.lblTitle.Height = 0; winPreview.imgCore.Margin = new Thickness(1); //Go! winWPFContent.RootVisual = winPreview.mainGrid; break; case "/s": // Show screensaver form ShowScreensaver(); break; default: System.Windows.Application.Current.Shutdown(); break; } } else { // If no arguments were passed in, show the screensaver ShowScreensaver(); } }
public static void SaveSettings(Settings.Settings set) { set.Save(SettingsFilename); }
void SaveSettings() { try { var settings = new Settings { MovieOutputPath = MovieEncodeInfo.OutputPath, TVShowOutputPath = TVShowEncodeInfo.OutputPath }; string rootPath = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData); string settingsPath = Path.Combine(rootPath, "EncoderUI"); if (!Directory.Exists(settingsPath)) { Directory.CreateDirectory(settingsPath); } string fileName = Path.Combine(settingsPath, "settings.json"); File.WriteAllText(fileName, JsonConvert.SerializeObject(settings)); } catch { // Oh well! Best effort. } }