private void ShowOptions() { _HeartsCanvas.HideHelp(); OptionsWindow optionsWindow = new OptionsWindow { ShowInTaskbar = false, Topmost = Topmost }; optionsWindow.ShowDialog(); _MousePosition = Mouse.GetPosition(this); foreach (ScreenSaverWindow screenSaverWindow in OwnedWindows.OfType <ScreenSaverWindow>()) { screenSaverWindow._MousePosition = Mouse.GetPosition(screenSaverWindow); } }
protected override void OnStartup(StartupEventArgs e) { //base.OnStartup(e); #if DEBUG Settings.IsDebug = true; #endif Settings.Tier = (RenderCapability.Tier >> 16); ArgumentParser argumentParser = new ArgumentParser(new[] { "/", "-" }, true, new[] { new Argument("c", ArgumentValue.Optional, true), new Argument("d", ArgumentValue.Optional, true), new Argument("p", ArgumentValue.Required, true), new Argument("s", ArgumentValue.None, true) }); argumentParser.Parse(e.Args); ArgumentDictionary validArguments = argumentParser.ParsedArguments.GetValidArguments(); if (validArguments.Contains("d")) { if (validArguments["d"].Value.Equals("true", StringComparison.InvariantCultureIgnoreCase)) { Debugger.Launch(); } Settings.IsDebug = true; } if (validArguments.Contains("c")) { OptionsWindow windowOptions = new OptionsWindow(); windowOptions.Show(); } else { Settings.PreviewHandle = IntPtr.Zero; if (validArguments.Contains("p")) { long tempLong; if (long.TryParse(validArguments["p"].Value, out tempLong)) { Settings.PreviewHandle = new IntPtr(tempLong); } } _ScreenSaverWindow = new ScreenSaverWindow(true); if (Settings.IsPreview) { RECT parentRectangle = new RECT(); User32.GetClientRect(Settings.PreviewHandle, parentRectangle); HwndSourceParameters hwndSourceParameters = new HwndSourceParameters { Height = parentRectangle.bottom - parentRectangle.top, Width = parentRectangle.right - parentRectangle.left, ParentWindow = Settings.PreviewHandle, PositionX = 0, PositionY = 0, WindowStyle = (int)(WS.VISIBLE | WS.CHILD | WS.CLIPCHILDREN) }; _ScreenSaverWindow.Height = hwndSourceParameters.Height; _ScreenSaverWindow.Width = hwndSourceParameters.Width; _ScreenSaverWindow.Visibility = Visibility.Hidden; _HwndSource = new HwndSource(hwndSourceParameters) { RootVisual = _ScreenSaverWindow.LayoutRoot }; _HwndSource.Disposed += _HwndSource_Disposed; } else { _ScreenSaverWindow.Show(); } } }