增加双击打开 修复重复进程导致不能关闭程序

This commit is contained in:
liufei
2022-01-09 15:38:18 +08:00
parent ab13cff769
commit edacf3249c
3 changed files with 72 additions and 34 deletions

View File

@@ -41,7 +41,7 @@
</hc:UniformSpacingPanel> </hc:UniformSpacingPanel>
<hc:UniformSpacingPanel Spacing="10" Margin="10,5,0,0" Grid.ColumnSpan="4"> <hc:UniformSpacingPanel Spacing="10" Margin="10,5,0,0" Grid.ColumnSpan="4">
<CheckBox Content="鼠标中间呼出" Checked="MouseMiddle_Changed" Unchecked="MouseMiddle_Changed" IsChecked="{Binding MouseMiddleShow}"> <CheckBox Content="鼠标中间呼出" Click="MouseMiddle_Changed" IsChecked="{Binding MouseMiddleShow}">
<CheckBox.Background> <CheckBox.Background>
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0"> <LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
<GradientStop Color="#FF9EA3A6"/> <GradientStop Color="#FF9EA3A6"/>
@@ -51,7 +51,7 @@
</hc:UniformSpacingPanel> </hc:UniformSpacingPanel>
<hc:UniformSpacingPanel Spacing="10" Margin="10,5,0,0" Grid.ColumnSpan="4"> <hc:UniformSpacingPanel Spacing="10" Margin="10,5,0,0" Grid.ColumnSpan="4">
<CheckBox Content="贴边隐藏" IsChecked="{Binding MarginHide}" Checked="MarginHide_Changed" Unchecked="MarginHide_Changed"> <CheckBox Content="双击启动" IsChecked="{Binding DoubleOpen}">
<CheckBox.Background> <CheckBox.Background>
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0"> <LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
<GradientStop Color="#FF9EA3A6"/> <GradientStop Color="#FF9EA3A6"/>
@@ -61,7 +61,17 @@
</hc:UniformSpacingPanel> </hc:UniformSpacingPanel>
<hc:UniformSpacingPanel Spacing="10" Margin="10,5,0,0" Grid.ColumnSpan="4"> <hc:UniformSpacingPanel Spacing="10" Margin="10,5,0,0" Grid.ColumnSpan="4">
<CheckBox Content="主窗口动画效果" IsChecked="{Binding AppAnimation}" Checked="Animation_Checked"> <CheckBox Content="贴边隐藏" IsChecked="{Binding MarginHide}" Click="MarginHide_Changed">
<CheckBox.Background>
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
<GradientStop Color="#FF9EA3A6"/>
</LinearGradientBrush>
</CheckBox.Background>
</CheckBox>
</hc:UniformSpacingPanel>
<hc:UniformSpacingPanel Spacing="10" Margin="10,5,0,0" Grid.ColumnSpan="4">
<CheckBox Content="主窗口动画效果" IsChecked="{Binding AppAnimation}" Click="Animation_Checked">
<CheckBox.Background> <CheckBox.Background>
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0"> <LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
<GradientStop Color="#FF9EA3A6"/> <GradientStop Color="#FF9EA3A6"/>

View File

@@ -62,7 +62,7 @@ namespace GeekDesk.Control.UserControls.Config
main = true; main = true;
} }
if (prevKeyTemp == Key.None || prevKeyTemp!=downKey) if (prevKeyTemp == Key.None || prevKeyTemp != downKey)
{ {
if (hotkeyFinished) if (hotkeyFinished)
{ {
@@ -71,7 +71,8 @@ namespace GeekDesk.Control.UserControls.Config
appConfig.Hotkey = 0; appConfig.Hotkey = 0;
appConfig.HotkeyStr = ""; appConfig.HotkeyStr = "";
appConfig.HotkeyModifiers = 0; appConfig.HotkeyModifiers = 0;
} else }
else
{ {
appConfig.ToDoHotkey = 0; appConfig.ToDoHotkey = 0;
appConfig.ToDoHotkeyStr = ""; appConfig.ToDoHotkeyStr = "";
@@ -90,7 +91,8 @@ namespace GeekDesk.Control.UserControls.Config
{ {
appConfig.HotkeyStr = GetKeyName(downKey); appConfig.HotkeyStr = GetKeyName(downKey);
appConfig.HotkeyModifiers = GetModifierKeys(downKey); appConfig.HotkeyModifiers = GetModifierKeys(downKey);
} else }
else
{ {
appConfig.ToDoHotkeyStr = GetKeyName(downKey); appConfig.ToDoHotkeyStr = GetKeyName(downKey);
appConfig.ToDoHotkeyModifiers = GetModifierKeys(downKey); appConfig.ToDoHotkeyModifiers = GetModifierKeys(downKey);
@@ -111,7 +113,8 @@ namespace GeekDesk.Control.UserControls.Config
{ {
appConfig.Hotkey = downKey; appConfig.Hotkey = downKey;
appConfig.HotkeyStr += downKey.ToString(); appConfig.HotkeyStr += downKey.ToString();
} else }
else
{ {
appConfig.ToDoHotkey = downKey; appConfig.ToDoHotkey = downKey;
appConfig.ToDoHotkeyStr += downKey.ToString(); appConfig.ToDoHotkeyStr += downKey.ToString();
@@ -125,7 +128,8 @@ namespace GeekDesk.Control.UserControls.Config
{ {
appConfig.HotkeyStr += GetKeyName(downKey); appConfig.HotkeyStr += GetKeyName(downKey);
appConfig.HotkeyModifiers |= GetModifierKeys(downKey); appConfig.HotkeyModifiers |= GetModifierKeys(downKey);
} else }
else
{ {
appConfig.ToDoHotkeyStr += GetKeyName(downKey); appConfig.ToDoHotkeyStr += GetKeyName(downKey);
appConfig.ToDoHotkeyModifiers |= GetModifierKeys(downKey); appConfig.ToDoHotkeyModifiers |= GetModifierKeys(downKey);
@@ -143,7 +147,8 @@ namespace GeekDesk.Control.UserControls.Config
if (key == Key.LeftCtrl || key == Key.RightCtrl) if (key == Key.LeftCtrl || key == Key.RightCtrl)
{ {
return "Ctrl + "; return "Ctrl + ";
} else if (key == Key.LWin || key == Key.RWin) }
else if (key == Key.LWin || key == Key.RWin)
{ {
return "Win + "; return "Win + ";
} }
@@ -195,7 +200,7 @@ namespace GeekDesk.Control.UserControls.Config
{ {
main = true; main = true;
} }
lock(this) lock (this)
{ {
bool allKeyUp = true; bool allKeyUp = true;
//判断所有键是否都松开 //判断所有键是否都松开
@@ -221,7 +226,8 @@ namespace GeekDesk.Control.UserControls.Config
GlobalHotKey.Dispose(MainWindow.hotKeyId); GlobalHotKey.Dispose(MainWindow.hotKeyId);
} }
MainWindow.RegisterHotKey(false); MainWindow.RegisterHotKey(false);
} else }
else
{ {
if (MainWindow.toDoHotKeyId != -1) if (MainWindow.toDoHotKeyId != -1)
{ {
@@ -253,13 +259,11 @@ namespace GeekDesk.Control.UserControls.Config
{ {
if (appConfig.MarginHide) if (appConfig.MarginHide)
{ {
MainWindow.hide.TimerSet(); MarginHide.StartHide();
} else
{
if (MainWindow.hide.timer != null)
{
MainWindow.hide.TimerStop();
} }
else
{
MarginHide.StopHide();
} }
} }
@@ -284,7 +288,8 @@ namespace GeekDesk.Control.UserControls.Config
if (appConfig.MouseMiddleShow) if (appConfig.MouseMiddleShow)
{ {
MouseHookThread.MiddleHook(); MouseHookThread.MiddleHook();
} else }
else
{ {
MouseHookThread.Dispose(); MouseHookThread.Dispose();
} }

View File

@@ -1,6 +1,7 @@
 
using GeekDesk.Constant; using GeekDesk.Constant;
using GeekDesk.Util; using GeekDesk.Util;
using Newtonsoft.Json;
using System; using System;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using System.ComponentModel; using System.ComponentModel;
@@ -70,7 +71,22 @@ namespace GeekDesk.ViewModel
private bool showBarIcon = true; //显示托盘图标 默认显示 private bool showBarIcon = true; //显示托盘图标 默认显示
private bool doubleOpen = false; //双击打开项目 默认关闭
#region GetSet #region GetSet
public bool DoubleOpen
{
get
{
return doubleOpen;
}
set
{
doubleOpen = value;
OnPropertyChanged("DoubleOpen");
}
}
public bool ShowBarIcon public bool ShowBarIcon
{ {
get get
@@ -105,7 +121,8 @@ namespace GeekDesk.ViewModel
if (imageWidth == 0) if (imageWidth == 0)
{ {
return (int)CommonEnum.IMAGE_WIDTH; return (int)CommonEnum.IMAGE_WIDTH;
} else }
else
{ {
return imageWidth; return imageWidth;
} }
@@ -380,7 +397,8 @@ namespace GeekDesk.ViewModel
if (blurEffect) if (blurEffect)
{ {
BlurValue = 100; BlurValue = 100;
} else }
else
{ {
BlurValue = 0; BlurValue = 0;
} }
@@ -552,7 +570,8 @@ namespace GeekDesk.ViewModel
bacImgName = "系统默认"; bacImgName = "系统默认";
//Image image = ImageUtil.ByteArrayToImage(Convert.FromBase64String(Constants.DEFAULT_BAC_IMAGE_BASE64)); //Image image = ImageUtil.ByteArrayToImage(Convert.FromBase64String(Constants.DEFAULT_BAC_IMAGE_BASE64));
return ImageUtil.ByteArrToImage(Convert.FromBase64String(Constants.DEFAULT_BAC_IMAGE_BASE64)); return ImageUtil.ByteArrToImage(Convert.FromBase64String(Constants.DEFAULT_BAC_IMAGE_BASE64));
} else }
else
{ {
return ImageUtil.ByteArrToImage(ImageByteArr); return ImageUtil.ByteArrToImage(ImageByteArr);
} }
@@ -707,5 +726,9 @@ namespace GeekDesk.ViewModel
#endregion #endregion
public override String ToString()
{
return JsonConvert.SerializeObject(this);
}
} }
} }