/// <summary> /// Main constructor. /// </summary> /// <param name="detector">detector to show info from</param> /// <param name="screenInfos">screen infos that will be shown in a table</param> public DebugInfoWindow(MouseShakeDetector detector, List <ScreenInfo> screenInfos) { InitializeComponent(); detector.MouseShake += OnMouseShake; _mouseEvents = StaticHook.GlobalEvents(); _mouseEvents.MouseMoveExt += OnMouseMove; ScreenInfos = new ObservableCollection <ScreenInfo>(screenInfos); ScreensTable.ItemsSource = ScreenInfos; VirtualScreen.Content = SystemParameters.VirtualScreenWidth + "x" + SystemParameters.VirtualScreenHeight; VirtualScreenTopLeft.Content = SystemParameters.VirtualScreenLeft + "x" + SystemParameters.VirtualScreenTop; }
protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); ParserResult <Options> parserResult = Parser.Default.ParseArguments <Options>(e.Args); parserResult.WithParsed((options) => { _debug = options.Debug; }); _notifyIcon = new NotifyIcon { Visible = true, Icon = AngryMouse.Properties.Resources.icon, Text = "AngryMouse" }; CreateContextMenu(); _detector = new MouseShakeDetector(); _detector.MouseShake += OnMouseShake; _screenInfos = GetScreenInfos(); if (_debug) { // Debug window. Only shown when the -d option is used. var debugInfoWindow = new DebugInfoWindow(_detector, _screenInfos); debugInfoWindow.Show(); } // Create and load windows on the secondary screens. foreach (var screen in _screenInfos) { var window = new OverlayWindow(screen, _debug); window.Show(); _overlayWindows.Add(window); } }