Use new MonitorInfo class class

This commit is contained in:
Jack251970 2025-07-23 13:51:35 +08:00
parent 4f423c47cd
commit 3cfe122c7b
6 changed files with 8 additions and 2 deletions

View file

@ -13,6 +13,7 @@ using System.Windows.Interop;
using System.Windows.Markup; using System.Windows.Markup;
using System.Windows.Media; using System.Windows.Media;
using Flow.Launcher.Infrastructure.UserSettings; using Flow.Launcher.Infrastructure.UserSettings;
using Flow.Launcher.Plugin.SharedModels;
using Microsoft.Win32; using Microsoft.Win32;
using Microsoft.Win32.SafeHandles; using Microsoft.Win32.SafeHandles;
using Windows.Win32; using Windows.Win32;

View file

@ -23,6 +23,7 @@ using Flow.Launcher.Infrastructure.DialogJump;
using Flow.Launcher.Infrastructure.UserSettings; using Flow.Launcher.Infrastructure.UserSettings;
using Flow.Launcher.Plugin; using Flow.Launcher.Plugin;
using Flow.Launcher.Plugin.SharedCommands; using Flow.Launcher.Plugin.SharedCommands;
using Flow.Launcher.Plugin.SharedModels;
using Flow.Launcher.ViewModel; using Flow.Launcher.ViewModel;
using Microsoft.Win32; using Microsoft.Win32;
using ModernWpf.Controls; using ModernWpf.Controls;

View file

@ -4,6 +4,7 @@ using System.Windows;
using System.Windows.Input; using System.Windows.Input;
using System.Windows.Media.Animation; using System.Windows.Media.Animation;
using Flow.Launcher.Infrastructure; using Flow.Launcher.Infrastructure;
using Flow.Launcher.Plugin.SharedModels;
namespace Flow.Launcher namespace Flow.Launcher
{ {

View file

@ -4,6 +4,7 @@ using System.Windows;
using System.Windows.Input; using System.Windows.Input;
using System.Windows.Media.Animation; using System.Windows.Media.Animation;
using Flow.Launcher.Infrastructure; using Flow.Launcher.Infrastructure;
using Flow.Launcher.Plugin.SharedModels;
namespace Flow.Launcher namespace Flow.Launcher
{ {

View file

@ -7,6 +7,7 @@ using System.Windows.Interop;
using CommunityToolkit.Mvvm.DependencyInjection; using CommunityToolkit.Mvvm.DependencyInjection;
using Flow.Launcher.Infrastructure; using Flow.Launcher.Infrastructure;
using Flow.Launcher.Infrastructure.UserSettings; using Flow.Launcher.Infrastructure.UserSettings;
using Flow.Launcher.Plugin.SharedModels;
using Flow.Launcher.SettingPages.Views; using Flow.Launcher.SettingPages.Views;
using Flow.Launcher.ViewModel; using Flow.Launcher.ViewModel;
using ModernWpf.Controls; using ModernWpf.Controls;

View file

@ -7,6 +7,7 @@ using System.Windows.Input;
using Flow.Launcher.Plugin.Explorer.Search.Everything; using Flow.Launcher.Plugin.Explorer.Search.Everything;
using Flow.Launcher.Plugin.Explorer.Views; using Flow.Launcher.Plugin.Explorer.Views;
using Flow.Launcher.Plugin.SharedCommands; using Flow.Launcher.Plugin.SharedCommands;
using Flow.Launcher.Plugin.SharedModels;
using Peter; using Peter;
using Path = System.IO.Path; using Path = System.IO.Path;
@ -72,10 +73,10 @@ namespace Flow.Launcher.Plugin.Explorer.Search
internal static void ShowNativeContextMenu(string path, ResultType type) internal static void ShowNativeContextMenu(string path, ResultType type)
{ {
var screenWithMouseCursor = System.Windows.Forms.Screen.FromPoint(System.Windows.Forms.Cursor.Position); var screenWithMouseCursor = MonitorInfo.GetCursorDisplayMonitor();
var xOfScreenCenter = screenWithMouseCursor.WorkingArea.Left + screenWithMouseCursor.WorkingArea.Width / 2; var xOfScreenCenter = screenWithMouseCursor.WorkingArea.Left + screenWithMouseCursor.WorkingArea.Width / 2;
var yOfScreenCenter = screenWithMouseCursor.WorkingArea.Top + screenWithMouseCursor.WorkingArea.Height / 2; var yOfScreenCenter = screenWithMouseCursor.WorkingArea.Top + screenWithMouseCursor.WorkingArea.Height / 2;
var showPosition = new System.Drawing.Point(xOfScreenCenter, yOfScreenCenter); var showPosition = new System.Drawing.Point((int)xOfScreenCenter, (int)yOfScreenCenter);
switch (type) switch (type)
{ {