mirror of
https://github.com/nomi-san/parsec-vdd.git
synced 2026-08-07 05:20:44 +00:00
app: add key Shift+Left/Right to move window between screens
This commit is contained in:
@@ -6,8 +6,8 @@
|
||||
<system:String x:Key="lang_name">Tiếng Việt</system:String>
|
||||
|
||||
<!--Interface-->
|
||||
<system:String x:Key="t_add_display">Cắm màn hình</system:String>
|
||||
<system:String x:Key="t_hint_add_display_first">Hãy cắm màn hình ảo!</system:String>
|
||||
<system:String x:Key="t_add_display">Thêm màn hình</system:String>
|
||||
<system:String x:Key="t_hint_add_display_first">Hãy thêm màn hình ảo!</system:String>
|
||||
<system:String x:Key="t_custom">Tùy chỉnh...</system:String>
|
||||
<system:String x:Key="t_apply">Áp dụng</system:String>
|
||||
<system:String x:Key="t_parent_gpu">GPU nguồn</system:String>
|
||||
@@ -42,7 +42,7 @@
|
||||
<system:String x:Key="t_msg_custom_access_denied">Không thể áp dụng độ phân giải tùy chỉnh, quyền truy cập bị từ chối!</system:String>
|
||||
<system:String x:Key="t_msg_custom_invalid_slot">Giá trị không hợp lệ ở slot #{0}.</system:String>
|
||||
|
||||
<system:String x:Key="t_msg_exceeded_display_limit">Không thể cắm thêm màn hình ảo, bạn đã đạt đến con số giới hạn ({0}).</system:String>
|
||||
<system:String x:Key="t_msg_exceeded_display_limit">Không thể thêm thêm màn hình ảo, bạn đã đạt đến con số giới hạn ({0}).</system:String>
|
||||
<system:String x:Key="t_msg_prompt_leave_all">Tất cả màn hình ảo sẽ bị tháo bỏ.\nBạn có muốn thoát không?.</system:String>
|
||||
|
||||
<system:String x:Key="t_msg_driver_status">Trạng thái driver</system:String>
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
WindowStartupLocation="CenterScreen"
|
||||
Loaded="Window_Loaded"
|
||||
Unloaded="Window_Unloaded"
|
||||
KeyDown="Window_KeyDown"
|
||||
>
|
||||
<Grid MouseDown="Grid_MouseDown">
|
||||
<Grid.Background>
|
||||
|
||||
@@ -169,5 +169,42 @@ namespace ParsecVDisplay
|
||||
if (e.LeftButton == MouseButtonState.Released)
|
||||
(sender as TextBlock).ContextMenu.IsOpen = true;
|
||||
}
|
||||
|
||||
private void Window_KeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (!e.IsRepeat &&
|
||||
(Keyboard.IsKeyDown(Key.LeftShift) || Keyboard.IsKeyDown(Key.RightShift)))
|
||||
{
|
||||
var screen = System.Windows.Forms.Screen.FromHandle(Handle);
|
||||
if (screen != null)
|
||||
{
|
||||
var screens = System.Windows.Forms.Screen.AllScreens;
|
||||
|
||||
int index = -1, nextIndex;
|
||||
for (int i = 0; i < screens.Length; i++)
|
||||
if (screens[i].Bounds.Contains(screen.Bounds))
|
||||
index = i;
|
||||
|
||||
if (index != -1)
|
||||
{
|
||||
if (e.Key == Key.Left)
|
||||
nextIndex = index - 1;
|
||||
else if (e.Key == Key.Right)
|
||||
nextIndex = index + 1;
|
||||
else return;
|
||||
|
||||
if (nextIndex >= screens.Length) nextIndex = 0;
|
||||
else if (nextIndex < 0) nextIndex = screens.Length - 1;
|
||||
|
||||
if (index != nextIndex)
|
||||
{
|
||||
var wa = screens[nextIndex].WorkingArea;
|
||||
Left = wa.Location.X + (wa.Width - RenderSize.Width) / 2;
|
||||
Top = wa.Location.Y + (wa.Height - RenderSize.Height) / 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user