Пример #1
0
		private void OverlayMenu_Click(object sender, RoutedEventArgs e)
		{
			overlay = new Overlay();
			overlay.SetCurrentClient(MyClient);
			overlay.Show();
			IEnumerable<Monitor> monitors = Monitor.AllMonitors;
			foreach (Monitor mymonitor in monitors)
			{
				if (mymonitor.IsPrimary == true)
				{
					overlay.Left = mymonitor.Bounds.Right - overlay.Width;
					overlay.Top = mymonitor.Bounds.Top;
				}
			}
			overlay.Topmost = true;
			HotKeyHost hotKeyHost = new HotKeyHost((HwndSource) PresentationSource.FromVisual(Application.Current.MainWindow));
			hotKeyHost.AddHotKey(new CustomHotKey("ToggleOverlay", Key.O, ModifierKeys.Control | ModifierKeys.Alt, true));
			hotKeyHost.HotKeyPressed += handleHotkeyPress;
		}
Пример #2
0
		private void OverlayMenu_Click(object sender, RoutedEventArgs e)
		{
			if (_overlay == null)
			{
				_overlay = new Overlay();
				_overlay.SetCurrentClient(MyClient);
				_overlay.Show();
				IEnumerable<Monitor> monitors = Monitor.AllMonitors;
				if (Settings.Default.OverlayMonitor != "")
				{
					Logger.Debug("Overlaymonitor is" + Settings.Default.OverlayMonitor);
					foreach (Monitor mymonitor in monitors)
					{
						if (mymonitor.Name == Settings.Default.OverlayMonitor)
						{
							_overlay.Left = mymonitor.Bounds.Right - _overlay.Width;
							_overlay.Top = mymonitor.Bounds.Top;
							_overlay.Topmost = true;
							Logger.Debug("Overlay coordinates set to " + _overlay.Left + " x " + _overlay.Top);
							HotKeyHost hotKeyHost = new HotKeyHost((HwndSource)PresentationSource.FromVisual(Application.Current.MainWindow));
							//hotKeyHost.AddHotKey(new CustomHotKey("ToggleOverlay", Key.O, ModifierKeys.Control | ModifierKeys.Alt , true));
							//hotKeyHost.AddHotKey(new CustomHotKey("CopyClientSystemname", Key.C, ModifierKeys.Control | ModifierKeys.Alt , true));
							//hotKeyHost.HotKeyPressed += HandleHotkeyPress;
                            // Broken all of a sudden? May require recode.
						}
					}
				}
				else
				{
					foreach (Monitor mymonitor in monitors)
					{
						Logger.Debug("Monitor ID: " + mymonitor.Name);
						if (mymonitor.IsPrimary)
						{
							_overlay.Left = mymonitor.Bounds.Right - _overlay.Width;
							_overlay.Top = mymonitor.Bounds.Top;
						}
					}
					_overlay.Topmost = true;
					HotKeyHost hotKeyHost = new HotKeyHost((HwndSource)PresentationSource.FromVisual(Application.Current.MainWindow));
					hotKeyHost.AddHotKey(new CustomHotKey("ToggleOverlay", Key.O, ModifierKeys.Control | ModifierKeys.Alt, true));
					hotKeyHost.AddHotKey(new CustomHotKey("CopyClientSystemname", Key.C, ModifierKeys.Control | ModifierKeys.Alt, true));
					hotKeyHost.HotKeyPressed += HandleHotkeyPress;
				}
			}
			else {
				_overlay.Close();
			}
		}