23 Commits

Author SHA1 Message Date
liufei
28ebb48983 修改样式 2022-01-07 20:21:06 +08:00
liufei
74e36cc68a 贴边隐藏优化 2022-01-07 20:01:39 +08:00
liufei
9f60f1be63 修复重复设置中间监听 2022-01-07 20:01:11 +08:00
liufei
e9dbc3e5b9 修复过大的遮罩层 2022-01-07 20:00:00 +08:00
liufei
e9a3726bb4 释放资源 2022-01-06 20:12:21 +08:00
liufei
58c67a0497 释放资源 2022-01-06 20:05:40 +08:00
liufei
5ff3f04da6 增加判空处理, 兼容旧版本数据 2022-01-06 19:12:05 +08:00
liufei
14aa73f504 捕获异常 防止退出失败 2022-01-06 18:59:51 +08:00
liufei
5c10b5f59e 修复打开系统项目隐藏窗口无效 2022-01-06 17:55:43 +08:00
liufei
d092db8b5c 增加添加系统应用功能 2022-01-06 17:45:25 +08:00
liufei
1125432c41 修改按钮样式 2022-01-06 17:41:05 +08:00
liufei
e99eee08ff 优化贴边隐藏动画 2022-01-06 17:39:04 +08:00
liufei
fb26834938 显示时不遮挡任务栏 2022-01-06 15:41:57 +08:00
liufei
e9063a176e 未捕获异常不再提示 2022-01-05 17:21:35 +08:00
liufei
6038eee680 捕获未处理异常 2022-01-05 17:11:24 +08:00
liufei
19c8ff9d8d 释放文件流 2022-01-05 11:56:56 +08:00
liufei
e3a85e42fa 系统图标-测试 2021-12-23 17:58:06 +08:00
liufei
09d3a520b4 修复cron表达式待办 无限提醒的bug 2021-12-23 13:09:46 +08:00
liufei
7f585dd095 修改获取磁盘图标 及 快捷名称获取 2021-12-22 18:01:29 +08:00
liufei
353acec75e 增加日志写入 2021-12-22 13:14:54 +08:00
liufei
8d4201f5ba 样式微调, 修复重新打开中间呼出功能失效 2021-12-22 09:34:04 +08:00
liufei
0453cdad66 优化修改菜单名样式 2021-12-21 17:34:16 +08:00
liufei
88af8324b9 双击启动 文件小图标修复 2021-12-21 16:52:31 +08:00
53 changed files with 476 additions and 412 deletions

View File

@@ -1,20 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="SystemIcons" type="System.Configuration.DictionarySectionHandler" />
<section
name="SystemIcons"
type="System.Configuration.DictionarySectionHandler" />
</configSections>
<SystemIcons>
<add key="Calculator" value="计算器" />
<add key="Computer" value="此电脑" />
<add key="GroupPolicy" value="组策略" />
<add key="Network" value="网络连接" />
<add key="RecycleBin" value="回收站" />
<add key="Registry" value="注册表编辑器" />
<add key="Notepad" value="记事本" />
<add key="Mstsc" value="远程桌面连接" />
<add key="Control" value="控制面板" />
<add key="CMD" value="命令行" />
<add key="Services" value="服务" />
<add key="Calculator" value="计算器"/>
<add key="Computer" value="此电脑"/>
<add key="GroupPolicy" value="组策略"/>
<add key="Network" value="网络连接"/>
<add key="RecycleBin" value="回收站"/>
<add key="Registry" value="注册表编辑器"/>
<add key="Notepad" value="记事本"/>
<add key="Mstsc" value="远程桌面连接"/>
<add key="Control" value="控制面板"/>
<add key="CMD" value="命令行"/>
</SystemIcons>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
@@ -44,14 +45,15 @@
</assemblyBinding>
</runtime>
<appSettings>
<add key="Version" value="2.4.12" />
<add key="Version" value="2.4.10" />
<add key="GitHubUrl" value="https://github.com/Demo-Liu/GeekDesk" />
<add key="GiteeUrl" value="https://gitee.com/demo_liu/GeekDesk/tree/master" />
<add key="GitHubUpdateUrl" value="https://demo-liu.github.io/GeekDesk/Update.json" />
<add key="GiteeUpdateUrl" value="https://demo-liu.github.io/GeekDesk/Update.json" />
<add key="ClientSettingsProvider.ServiceUri" value="" />
<add key="CustomIconTeachUrl" value="https://mp.weixin.qq.com/s/LxoHAekho9HBVl4FRw_Law" />
<add key="CustomIconTeachUrl" value="https://mp.weixin.qq.com/s/LxoHAekho9HBVl4FRw_Law"/>
</appSettings>
<system.web>
<membership defaultProvider="ClientAuthenticationMembershipProvider">
<providers>

View File

@@ -58,5 +58,5 @@ namespace GeekDesk
}
}

View File

@@ -5,8 +5,8 @@ namespace GeekDesk.Constant
{
public enum CommonEnum
{
WINDOW_WIDTH = 666, //默认窗体宽度
WINDOW_HEIGHT = 500, //默认窗体高度
WINDOW_WIDTH = 950, //默认窗体宽度
WINDOW_HEIGHT = 650, //默认窗体高度
MENU_CARD_WIDHT = 165, //默认菜单栏宽度
IMAGE_WIDTH = 45, //默认图标宽度
IMAGE_HEIGHT = 45, //默认图标高度

View File

@@ -26,6 +26,8 @@ namespace GeekDesk.Constant
public static string ERROR_FILE_PATH = APP_DIR + "Error.log";
//系统图标路径
public static string SYSTEM_ICON_PATH = "GeekDesk.Resource.Image.SystemIcon.*";
//系统图标
public static Hashtable SYSTEM_ICONS = (Hashtable)ConfigurationManager.GetSection("SystemIcons");

View File

@@ -15,7 +15,7 @@
<Image Source="/Resource/Image/BacklogImg.png" Margin="22,35,22,361" />
<hc:Card MaxWidth="250" Height="200" BorderThickness="0" Effect="{DynamicResource EffectShadow2}" Margin="8">
<!--Card 的内容部分-->
<Border CornerRadius="4,4,0,0" Width="160" Height="160">

View File

@@ -64,8 +64,7 @@ namespace GeekDesk.Control.Other
{
Growl.SuccessGlobal("下次任务将在 " + minutes + " 分钟后提醒您!");
}
}
else
} else
{
appData.ToDoList.Remove(info); //执行任务删除
appData.HiToDoList.Add(info); //添加历史任务
@@ -123,7 +122,7 @@ namespace GeekDesk.Control.Other
ToDoInfo info = this.DataContext as ToDoInfo;
int time = int.Parse(DelayTime.Text);
string type = DelayType.Text;
switch (type)
switch(type)
{
case "分":
info.ExeTime = DateTime.Now.AddMinutes(time).ToString("yyyy-MM-dd HH:mm:ss");

View File

@@ -17,7 +17,7 @@
</Border.Resources>
<StackPanel Margin="10">
<Grid Margin="8,20,8,20">
<hc:UniformSpacingPanel Spacing="10" Margin="0,10,0,-10">
<WrapPanel HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock Text="SVG 图标地址:" Style="{StaticResource LeftTB}"/>

View File

@@ -34,11 +34,10 @@ namespace GeekDesk.Control.Other
AppConfig appConfig = this.DataContext as AppConfig;
appConfig.CustomIconJsonUrl = JsonUrl.Text.Trim();
appConfig.CustomIconUrl = IconUrl.Text.Trim();
if (!StringUtil.IsEmpty(IconUrl.Text) && !StringUtil.IsEmpty(JsonUrl.Text))
if (!StringUtil.IsEmpty(IconUrl.Text) && !StringUtil.IsEmpty(JsonUrl.Text))
{
IconfontWindow.vm.IsSettingUrl = "true";
}
else
} else
{
IconfontWindow.vm.IsSettingUrl = "false";
}

View File

@@ -75,13 +75,12 @@ namespace GeekDesk.Control.Other
info.BitmapImage = ImageUtil.GetBitmapIconByPath(ofd.FileName);
CommonCode.SaveAppData(MainWindow.appData);
}
}
catch (Exception e1)
} catch (Exception e1)
{
HandyControl.Controls.Growl.WarningGlobal("修改图标失败,已重置为默认图标!");
LogUtil.WriteErrorLog(e1, "修改图标失败!");
}
}
}
}

View File

@@ -89,10 +89,10 @@ namespace GeekDesk.Control.Other
info.BitmapImage = ImageUtil.GetBitmapIconByPath(ofd.FileName);
CommonCode.SaveAppData(MainWindow.appData);
}
} catch (Exception ex)
} catch (Exception e1)
{
HandyControl.Controls.Growl.WarningGlobal("修改图标失败,已重置为默认图标!");
LogUtil.WriteErrorLog(ex, "修改图标失败!");
LogUtil.WriteErrorLog(e1, "修改图标失败!");
}
}

View File

@@ -22,11 +22,11 @@
<hc:Shield Subject=".net" Status=">=4.72" Margin="0,0,10,0" Color="#1182c3"/>
<hc:Shield Subject="IDE" Status="VS2019" Margin="0,0,10,0" Color="#1182c3"/>
<hc:Shield Subject="GitHub" Visibility="Visible" Status="Demo-liu"
<hc:Shield Subject="GitHub" Visibility="Visible" Status="Star"
Command="hc:ControlCommands.OpenLink"
CommandParameter="https://github.com/Demo-Liu/GeekDesk"
Margin="0,0,10,0" Color="#24292F"/>
<hc:Shield Subject="Gitee" Visibility="Visible" Status="Demo-liu"
<hc:Shield Subject="Gitee" Visibility="Visible" Status="Star"
Command="hc:ControlCommands.OpenLink"
CommandParameter="https://gitee.com/demo_liu/GeekDesk"
Margin="0,0,10,0" Color="#C71D23"/>

View File

@@ -79,7 +79,7 @@
</CheckBox.Background>
</CheckBox>
</hc:UniformSpacingPanel>
<hc:UniformSpacingPanel Spacing="10" Margin="0,10,0,0" Grid.ColumnSpan="4">
<TextBlock Text="面板关闭方式" VerticalAlignment="Center"/>
</hc:UniformSpacingPanel>
@@ -112,8 +112,8 @@
/>
</hc:UniformSpacingPanel>
<hc:UniformSpacingPanel Spacing="10" Margin="10,5,0,0" Grid.ColumnSpan="4">
<TextBlock Text="新建待办:" Width="55"/>
<hc:TextBox HorizontalAlignment="Left"
<TextBlock Text="新建待办:" Width="55"/>
<hc:TextBox HorizontalAlignment="Left"
Tag="ToDo"
VerticalAlignment="Top"
IsReadOnly="True"
@@ -123,9 +123,9 @@
KeyDown="HotKeyDown"
KeyUp="HotKeyUp"
/>
</hc:UniformSpacingPanel>
</hc:UniformSpacingPanel>
</StackPanel>
</Grid>
</UserControl>

View File

@@ -62,7 +62,7 @@ namespace GeekDesk.Control.UserControls.Config
main = true;
}
if (prevKeyTemp == Key.None || prevKeyTemp != downKey)
if (prevKeyTemp == Key.None || prevKeyTemp!=downKey)
{
if (hotkeyFinished)
{
@@ -71,8 +71,7 @@ namespace GeekDesk.Control.UserControls.Config
appConfig.Hotkey = 0;
appConfig.HotkeyStr = "";
appConfig.HotkeyModifiers = 0;
}
else
} else
{
appConfig.ToDoHotkey = 0;
appConfig.ToDoHotkeyStr = "";
@@ -81,7 +80,7 @@ namespace GeekDesk.Control.UserControls.Config
hotkeyFinished = false;
}
//首次按下按键
if ((main && (appConfig.HotkeyStr == null || appConfig.HotkeyStr.Length == 0))
if ((main && (appConfig.HotkeyStr == null || appConfig.HotkeyStr.Length == 0))
|| (!main && (appConfig.ToDoHotkeyStr == null || appConfig.ToDoHotkeyStr.Length == 0)))
{
if (CheckModifierKeys(downKey))
@@ -91,8 +90,7 @@ namespace GeekDesk.Control.UserControls.Config
{
appConfig.HotkeyStr = GetKeyName(downKey);
appConfig.HotkeyModifiers = GetModifierKeys(downKey);
}
else
} else
{
appConfig.ToDoHotkeyStr = GetKeyName(downKey);
appConfig.ToDoHotkeyModifiers = GetModifierKeys(downKey);
@@ -113,8 +111,7 @@ namespace GeekDesk.Control.UserControls.Config
{
appConfig.Hotkey = downKey;
appConfig.HotkeyStr += downKey.ToString();
}
else
} else
{
appConfig.ToDoHotkey = downKey;
appConfig.ToDoHotkeyStr += downKey.ToString();
@@ -128,13 +125,12 @@ namespace GeekDesk.Control.UserControls.Config
{
appConfig.HotkeyStr += GetKeyName(downKey);
appConfig.HotkeyModifiers |= GetModifierKeys(downKey);
}
else
} else
{
appConfig.ToDoHotkeyStr += GetKeyName(downKey);
appConfig.ToDoHotkeyModifiers |= GetModifierKeys(downKey);
}
prevKeyTemp = downKey;
keysTemp.Add(e);
}
@@ -147,8 +143,7 @@ namespace GeekDesk.Control.UserControls.Config
if (key == Key.LeftCtrl || key == Key.RightCtrl)
{
return "Ctrl + ";
}
else if (key == Key.LWin || key == Key.RWin)
} else if (key == Key.LWin || key == Key.RWin)
{
return "Win + ";
}
@@ -192,7 +187,7 @@ namespace GeekDesk.Control.UserControls.Config
[MethodImpl(MethodImplOptions.Synchronized)]
private void HotKeyUp(object sender, KeyEventArgs e)
private void HotKeyUp(object sender, KeyEventArgs e)
{
string tag = (sender as TextBox).Tag.ToString();
bool main = false;
@@ -200,7 +195,7 @@ namespace GeekDesk.Control.UserControls.Config
{
main = true;
}
lock (this)
lock(this)
{
bool allKeyUp = true;
//判断所有键是否都松开
@@ -226,8 +221,7 @@ namespace GeekDesk.Control.UserControls.Config
GlobalHotKey.Dispose(MainWindow.hotKeyId);
}
MainWindow.RegisterHotKey(false);
}
else
} else
{
if (MainWindow.toDoHotKeyId != -1)
{
@@ -237,7 +231,7 @@ namespace GeekDesk.Control.UserControls.Config
MainWindow.RegisterCreateToDoHotKey(false);
}
}
}
}
@@ -260,8 +254,7 @@ namespace GeekDesk.Control.UserControls.Config
if (appConfig.MarginHide)
{
MarginHide.StartHide();
}
else
} else
{
MarginHide.StopHide();
}
@@ -288,8 +281,7 @@ namespace GeekDesk.Control.UserControls.Config
if (appConfig.MouseMiddleShow)
{
MouseHookThread.MiddleHook();
}
else
} else
{
MouseHookThread.Dispose();
}

View File

@@ -53,10 +53,10 @@ namespace GeekDesk.Control.UserControls.Config
appConfig.BacImgName = ofd.FileName;
}
}
catch (Exception ex)
catch (Exception e1)
{
LogUtil.WriteErrorLog(ex, "修改背景失败,已重置为默认背景!");
HandyControl.Controls.Growl.WarningGlobal("修改背景失败,已重置为默认背景!");
LogUtil.WriteErrorLog(e1, "修改背景失败!");
}
}
@@ -70,10 +70,10 @@ namespace GeekDesk.Control.UserControls.Config
appConfig.BitmapImage = ImageUtil.Base64ToBitmapImage(Constants.DEFAULT_BAC_IMAGE_BASE64);
appConfig.BacImgName = "系统默认";
}
catch (Exception ex)
catch (Exception e1)
{
LogUtil.WriteErrorLog(ex, "修改背景失败2,已重置为默认背景!");
HandyControl.Controls.Growl.WarningGlobal("修改背景失败,已重置为默认背景!");
LogUtil.WriteErrorLog(e1, "修改默认背景失败!");
}
}

View File

@@ -44,13 +44,24 @@
</BeginStoryboard>
</MultiTrigger.ExitActions>
</MultiTrigger>
<!--<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="#FFE4DBDB"/>
</Trigger>-->
<Trigger Property="IsSelected" Value="true">
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="#FFECECEC"/>
</Trigger>
<Trigger Property="IsSelected" Value="True">
<Setter Property="Background" Value="#FFECECEC"/>
<Setter Property="Foreground" Value="Black"/>
</Trigger>
<MultiDataTrigger>
<MultiDataTrigger.Conditions>
<Condition Binding="{Binding IsEdit}" Value="True"/>
</MultiDataTrigger.Conditions>
<MultiDataTrigger.Setters>
<Setter Property="Background" Value="Transparent"/>
</MultiDataTrigger.Setters>
</MultiDataTrigger>
</Style.Triggers>
</Style>
<cvt:MenuWidthConvert x:Key="MenuWidthConvert"/>
@@ -58,7 +69,7 @@
</UserControl.Resources>
<!--左侧栏-->
<hc:Card x:Name="MyCard"
BorderThickness="1"
BorderThickness="1"
Effect="{DynamicResource EffectShadow2}"
Margin="5,0,0,5"
>
@@ -77,6 +88,7 @@
</hc:Card.ContextMenu>
<WrapPanel Orientation="Horizontal">
<ListBox x:Name="MenuListBox"
Padding="2,3,0,2"
ItemsSource="{Binding MenuList}"
Tag="{Binding AppConfig.MenuCardWidth}"
BorderThickness="0" Foreground="{x:Null}"
@@ -90,7 +102,7 @@
<MenuItem Header="重命名" Click="RenameMenu" Tag="{Binding}"/>
<MenuItem Header="修改图标" Click="EditMenuGeometry" Tag="{Binding}"/>
<MenuItem Header="删除" Click="DeleteMenu" Tag="{Binding}"/>
</ContextMenu>
</ContextMenu>
</ListBox.Resources>
<ListBox.ItemContainerStyle>
@@ -104,27 +116,28 @@
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<DraggAnimatedPanel:DraggAnimatedPanel ItemsHeight="33" ItemsWidth="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type ListBox},AncestorLevel=1},Path=Tag, Mode=TwoWay, Converter={StaticResource MenuWidthConvert}, ConverterParameter=10}" HorizontalAlignment="Center" VerticalAlignment="Top" SwapCommand="{Binding SwapCommand, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}"/>
<DraggAnimatedPanel:DraggAnimatedPanel ItemsHeight="33" ItemsWidth="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type ListBox},AncestorLevel=1},Path=Tag, Mode=TwoWay, Converter={StaticResource MenuWidthConvert}, ConverterParameter=10}" HorizontalAlignment="Center" VerticalAlignment="Top" SwapCommand="{Binding SwapCommand, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}"/>
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel MouseLeftButtonDown="MenuClick" MouseRightButtonDown="MenuClick" Tag="{Binding}">
<hc:TextBox Text="{Binding Path=MenuName, Mode=TwoWay}"
<StackPanel MouseLeftButtonDown="MenuClick" MouseRightButtonDown="MenuClick" Tag="{Binding}">
<TextBox Text="{Binding Path=MenuName, Mode=TwoWay}"
HorizontalAlignment="Left"
Width="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type ListBox},AncestorLevel=1},Path=Tag, Mode=TwoWay, Converter={StaticResource MenuWidthConvert}, ConverterParameter=35}"
FontSize="16"
Height="25"
Height="28"
VerticalAlignment="Center"
TextAlignment="Left"
LostFocus="LostFocusOrEnterDown"
KeyDown="LostFocusOrEnterDown"
Tag="{Binding}"
Margin="2"
Padding="2"
BorderThickness="0"
IsVisibleChanged="MenuEditWhenVisibilityChanged"
Visibility="{Binding MenuEdit}"/>
<StackPanel Orientation="Horizontal">
<StackPanel Orientation="Horizontal">
<Button Background="Transparent"
BorderThickness="0"
hc:IconElement.Geometry="{Binding MenuGeometry}"

View File

@@ -204,6 +204,7 @@ namespace GeekDesk.Control.UserControls.PannelCard
private void menus_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
appData.AppConfig.SelectedMenuIcons = null;
//设置对应菜单的图标列表
if (MenuListBox.SelectedIndex == -1)
{

View File

@@ -104,8 +104,7 @@
hc:Poptip.Content="{Binding Content}"
hc:Poptip.Placement="BottomLeft"
Background="#00FFFFFF"
MouseLeftButtonDown="Icon_MouseLeftButtonDown"
MouseLeftButtonUp="Icon_MouseLeftButtonUp"
MouseLeftButtonDown="IconClick"
MouseEnter="StackPanel_MouseEnter"
MouseLeave="StackPanel_MouseLeave"
>
@@ -124,7 +123,7 @@
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</WrapPanel>
</hc:Card>
</UserControl>

View File

@@ -60,23 +60,6 @@ namespace GeekDesk.Control.UserControls.PannelCard
private void Icon_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
if (appData.AppConfig.DoubleOpen)
{
IconClick(sender, e);
}
}
private void Icon_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
{
if (!appData.AppConfig.DoubleOpen)
{
IconClick(sender, e);
}
}
/// <summary>
/// 图标点击事件
/// </summary>
@@ -95,8 +78,7 @@ namespace GeekDesk.Control.UserControls.PannelCard
{
StartIconApp(icon, IconStartType.DEFAULT_STARTUP);
}
}
else if (!appData.AppConfig.DoubleOpen && e.ClickCount == 1)
} else if (!appData.AppConfig.DoubleOpen && e.ClickCount == 1)
{
IconInfo icon = (IconInfo)((SimpleStackPanel)sender).Tag;
if (icon.AdminStartUp)
@@ -108,7 +90,7 @@ namespace GeekDesk.Control.UserControls.PannelCard
StartIconApp(icon, IconStartType.DEFAULT_STARTUP);
}
}
}
/// <summary>
@@ -137,98 +119,97 @@ namespace GeekDesk.Control.UserControls.PannelCard
{
try
{
using (Process p = new Process())
Process p = new Process();
string startArg = icon.StartArg;
if (startArg!=null && Constants.SYSTEM_ICONS.ContainsKey(startArg))
{
string startArg = icon.StartArg;
if (startArg != null && Constants.SYSTEM_ICONS.ContainsKey(startArg))
StartSystemApp(startArg, type);
} else
{
p.StartInfo.FileName = icon.Path;
if (!StringUtil.IsEmpty(startArg))
{
StartSystemApp(startArg, type);
p.StartInfo.Arguments = startArg;
}
else
if (icon.IconType == IconType.OTHER)
{
p.StartInfo.FileName = icon.Path;
if (!StringUtil.IsEmpty(startArg))
if (!File.Exists(icon.Path) && !Directory.Exists(icon.Path))
{
p.StartInfo.Arguments = startArg;
HandyControl.Controls.Growl.WarningGlobal("程序启动失败(文件路径不存在或已删除)!");
return;
}
if (icon.IconType == IconType.OTHER)
p.StartInfo.WorkingDirectory = icon.Path.Substring(0, icon.Path.LastIndexOf("\\"));
switch (type)
{
if (!File.Exists(icon.Path) && !Directory.Exists(icon.Path))
{
HandyControl.Controls.Growl.WarningGlobal("程序启动失败(文件路径不存在或已删除)!");
return;
}
p.StartInfo.WorkingDirectory = icon.Path.Substring(0, icon.Path.LastIndexOf("\\"));
switch (type)
{
case IconStartType.ADMIN_STARTUP:
//p.StartInfo.Arguments = "1";//启动参数
p.StartInfo.Verb = "runas";
p.StartInfo.CreateNoWindow = false; //设置显示窗口
p.StartInfo.UseShellExecute = false;//不使用操作系统外壳程序启动进程
p.StartInfo.ErrorDialog = false;
if (appData.AppConfig.AppHideType == AppHideType.START_EXE)
{
//如果开启了贴边隐藏 则窗体不贴边才隐藏窗口
if (appData.AppConfig.MarginHide)
{
if (!MarginHide.IS_HIDE)
{
MainWindow.HideApp();
}
}
else
{
MainWindow.HideApp();
}
}
break;// c#好像不能case穿透
case IconStartType.DEFAULT_STARTUP:
if (appData.AppConfig.AppHideType == AppHideType.START_EXE)
{
//如果开启了贴边隐藏 则窗体不贴边才隐藏窗口
if (appData.AppConfig.MarginHide)
{
if (!MarginHide.IS_HIDE)
{
MainWindow.HideApp();
}
}
else
{
MainWindow.HideApp();
}
}
break;
case IconStartType.SHOW_IN_EXPLORE:
p.StartInfo.FileName = "Explorer.exe";
p.StartInfo.Arguments = "/e,/select," + icon.Path;
break;
}
}
else
{
if (appData.AppConfig.AppHideType == AppHideType.START_EXE)
{
//如果开启了贴边隐藏 则窗体不贴边才隐藏窗口
if (appData.AppConfig.MarginHide)
case IconStartType.ADMIN_STARTUP:
//p.StartInfo.Arguments = "1";//启动参数
p.StartInfo.Verb = "runas";
p.StartInfo.CreateNoWindow = false; //设置显示窗口
p.StartInfo.UseShellExecute = false;//不使用操作系统外壳程序启动进程
p.StartInfo.ErrorDialog = false;
if (appData.AppConfig.AppHideType == AppHideType.START_EXE)
{
if (!MarginHide.IS_HIDE)
//如果开启了贴边隐藏 则窗体不贴边才隐藏窗口
if (appData.AppConfig.MarginHide)
{
if (!MarginHide.IS_HIDE)
{
MainWindow.HideApp();
}
}
else
{
MainWindow.HideApp();
}
}
break;// c#好像不能case穿透
case IconStartType.DEFAULT_STARTUP:
if (appData.AppConfig.AppHideType == AppHideType.START_EXE)
{
//如果开启了贴边隐藏 则窗体不贴边才隐藏窗口
if (appData.AppConfig.MarginHide)
{
if (!MarginHide.IS_HIDE)
{
MainWindow.HideApp();
}
}
else
{
MainWindow.HideApp();
}
}
else
break;
case IconStartType.SHOW_IN_EXPLORE:
p.StartInfo.FileName = "Explorer.exe";
p.StartInfo.Arguments = "/e,/select," + icon.Path;
break;
}
}
else
{
if (appData.AppConfig.AppHideType == AppHideType.START_EXE)
{
//如果开启了贴边隐藏 则窗体不贴边才隐藏窗口
if (appData.AppConfig.MarginHide)
{
if (!MarginHide.IS_HIDE)
{
MainWindow.HideApp();
}
}
else
{
MainWindow.HideApp();
}
}
p.Start();
}
p.Start();
}
icon.Count++;
}
catch (Exception e)
@@ -274,8 +255,7 @@ namespace GeekDesk.Control.UserControls.PannelCard
if (type == IconStartType.ADMIN_STARTUP)
{
Process.Start("mstsc", "-admin");
}
else
} else
{
Process.Start("mstsc");
}
@@ -286,21 +266,15 @@ namespace GeekDesk.Control.UserControls.PannelCard
case "CMD":
if (type == IconStartType.ADMIN_STARTUP)
{
using (Process process = new Process())
{
process.StartInfo.FileName = "cmd.exe";
process.StartInfo.Verb = "runas";
process.Start();
}
}
else
Process process = new Process();
process.StartInfo.FileName = "cmd.exe";
process.StartInfo.Verb = "runas";
process.Start();
} else
{
Process.Start("cmd");
}
break;
case "Services":
Process.Start("services.msc");
break;
}
//如果开启了贴边隐藏 则窗体不贴边才隐藏窗口
if (appData.AppConfig.MarginHide)
@@ -400,7 +374,7 @@ namespace GeekDesk.Control.UserControls.PannelCard
Panel sp = sender as Panel;
DependencyObject dos = sp.Parent;
DependencyObject dos = sp.Parent;
Image img = sp.Children[0] as Image;
@@ -409,16 +383,16 @@ namespace GeekDesk.Control.UserControls.PannelCard
//动画定义
Storyboard myStoryboard = new Storyboard();
DoubleAnimation heightAnimation = new DoubleAnimation
DoubleAnimation heightAnimation = new DoubleAnimation
{
From = afterHeight,
To = height,
Duration = new Duration(TimeSpan.FromMilliseconds(milliseconds))
};
DoubleAnimation widthAnimation = new DoubleAnimation
DoubleAnimation widthAnimation = new DoubleAnimation
{
From = afterWidth,
To = width,
@@ -454,8 +428,7 @@ namespace GeekDesk.Control.UserControls.PannelCard
ThreadStart ts = new ThreadStart(crs.Remove);
System.Threading.Thread t = new System.Threading.Thread(ts);
t.Start();
}
else
} else
{
img.BeginAnimation(WidthProperty, null);
img.BeginAnimation(HeightProperty, null);
@@ -538,6 +511,5 @@ namespace GeekDesk.Control.UserControls.PannelCard
{
SystemItemWindow.Show();
}
}
}

View File

@@ -8,8 +8,8 @@
mc:Ignorable="d"
Background="Transparent"
>
<hc:SimplePanel Margin="20" Background="Transparent">
<hc:SimplePanel Margin="20" Background="Transparent">
<Grid Background="Transparent">
<DataGrid x:Name="BacklogList"
HeadersVisibility="All"

View File

@@ -84,20 +84,5 @@ namespace GeekDesk.Control.UserControls.Backlog
Menu.IsOpen = true;
}
/// <summary>
/// 选中时颜色变化
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void DataGridRow_Selected(object sender, RoutedEventArgs e)
{
Color c = Color.FromRgb(91, 192, 222);
SolidColorBrush b = new SolidColorBrush
{
Color = c,
Opacity = 0.9
};
((DataGridRow)sender).Background = b;
}
}
}

View File

@@ -95,7 +95,6 @@ namespace GeekDesk.Control.Windows
{
if (e.Key == Key.Escape)
{
this.DataContext = null;
this.Close();
}
}

View File

@@ -27,7 +27,7 @@ namespace GeekDesk.Control.Windows
public static IconfontViewModel vm;
private IconfontWindow(List<IconfontInfo> icons, MenuInfo menuInfo)
{
InitializeComponent();
systemIcons = icons;
@@ -57,7 +57,6 @@ namespace GeekDesk.Control.Windows
private void Close_Click(object sender, RoutedEventArgs e)
{
this.DataContext = null;
this.Close();
}
@@ -74,15 +73,13 @@ namespace GeekDesk.Control.Windows
LoadingEle.Visibility = Visibility.Visible;
CustomIcon.Visibility = Visibility.Collapsed;
HandyControl.Controls.Dialog.Show(new CustomIconUrlDialog(appConfig), "IconUrlDialog");
}
else
} else
{
if (customIcons == null)
{
vm.Iconfonts = null;
LoadingOnlineIcon();
}
else
} else
{
vm.Iconfonts = customIcons;
LoadingEle.Visibility = Visibility.Collapsed;
@@ -124,7 +121,6 @@ namespace GeekDesk.Control.Windows
}
break;
}
this.DataContext = null;
this.Close();
}
@@ -152,8 +148,7 @@ namespace GeekDesk.Control.Windows
if (CheckSettingUrl.Text == "true")
{
LoadingOnlineIcon();
}
else
} else
{
LoadingEle.IsRunning = true;
CustomIcon.Visibility = Visibility.Collapsed;
@@ -184,7 +179,6 @@ namespace GeekDesk.Control.Windows
{
if (e.Key == Key.Escape)
{
this.DataContext = null;
this.Close();
}
}

View File

@@ -29,9 +29,9 @@ namespace GeekDesk.Control.Windows
{
private static AppConfig appConfig = MainWindow.appData.AppConfig;
private static SystemItemViewModel vm;
private List<IconInfo> systemIcons;
private List<IconInfo> startMenuIcons;
private List<IconInfo> storeIcons;
private static List<IconInfo> systemIcons;
private static List<IconInfo> startMenuIcons;
private static List<IconInfo> storeIcons;
private SystemItemWindow()
{
@@ -56,7 +56,6 @@ namespace GeekDesk.Control.Windows
private void Close_Click(object sender, RoutedEventArgs e)
{
this.DataContext = null;
this.Close();
}
@@ -150,24 +149,13 @@ namespace GeekDesk.Control.Windows
/// </summary>
/// <param name="path"></param>
/// <param name="listInfos"></param>
private void GetInfos(string filePath, List<IconInfo> listInfos)
private void GetInfos(string path, List<IconInfo> listInfos)
{
DirectoryInfo di = new DirectoryInfo(filePath);
string[] filePaths = Directory.GetFiles(filePath);
string[] dirPaths = Directory.GetDirectories(filePath);
string[] paths = new string[filePaths.Length + dirPaths.Length];
filePaths.CopyTo(paths, 0);
if (filePaths == null || filePaths.Length == 0)
{
dirPaths.CopyTo(paths, 0);
} else
{
dirPaths.CopyTo(paths, filePaths.Length - 1);
}
foreach (string path in paths)
DirectoryInfo di = new DirectoryInfo(path);
FileSystemInfo[] fileInfoArr = di.GetFileSystemInfos();
foreach(FileSystemInfo fi in fileInfoArr)
{
path = fi.FullName;
if (File.Exists(path))
{
string ext = Path.GetExtension(path).ToLower();
@@ -190,13 +178,6 @@ namespace GeekDesk.Control.Windows
GetInfos(path, listInfos);
}
}
//FileSystemInfo[] fileInfoArr = di.GetFileSystemInfos();
//foreach(FileSystemInfo fi in fileInfoArr)
//{
// string path = fi.FullName;
//}
}
/// <summary>
@@ -289,7 +270,6 @@ namespace GeekDesk.Control.Windows
{
if (e.Key == Key.Escape)
{
this.DataContext = null;
this.Close();
}
}

View File

@@ -30,7 +30,6 @@
<Border.Resources>
<Style x:Key="LeftTB" TargetType="TextBlock" BasedOn="{StaticResource TextBlockBaseStyle}">
<Setter Property="Width" Value="67"/>
<Setter Property="Margin" Value="0,5,0,0"/>
<Setter Property="HorizontalAlignment" Value="Left"/>
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="TextAlignment" Value="Center"/>
@@ -68,15 +67,13 @@
IsChecked="{Binding ExecType, Mode=OneWay, Converter={StaticResource TodoTaskExecConvert}, ConverterParameter=2}"/>
</hc:UniformSpacingPanel>
<hc:UniformSpacingPanel x:Name="SetTimePanel" Height="30" Visibility="Visible" Spacing="10" Grid.ColumnSpan="4" Margin="0,10,0,0">
<WrapPanel VerticalAlignment="Center">
<TextBlock Text="指定时间:" Style="{StaticResource LeftTB}"/>
<TextBlock Text="*" Foreground="Red"/>
</WrapPanel>
<hc:DateTimePicker x:Name="ExeTime" Text="{Binding ExeTime, Mode=OneWay}" ErrorStr="Error!" Width="200" Margin="1.6,0,0,0"/>
<hc:UniformSpacingPanel x:Name="SetTimePanel" Visibility="Visible" Spacing="10" Grid.ColumnSpan="4" Margin="0,10,0,0">
<TextBlock Text="指定时间:" Style="{StaticResource LeftTB}"/>
<TextBlock Text="*" Foreground="Red" Margin="-10,0,0,0"/>
<hc:DateTimePicker x:Name="ExeTime" Text="{Binding ExeTime, Mode=OneWay}" ErrorStr="Error!" Width="200" Margin="-5.2,0,0,0"/>
</hc:UniformSpacingPanel>
<hc:UniformSpacingPanel x:Name="CronPanel" Height="30" Visibility="Collapsed" Spacing="10" Grid.ColumnSpan="4" Margin="0,10,0,0">
<hc:UniformSpacingPanel x:Name="CronPanel" Visibility="Collapsed" Spacing="10" Grid.ColumnSpan="4" Margin="0,10,0,0">
<WrapPanel VerticalAlignment="Center">
<TextBlock Text="CRON:" Style="{StaticResource LeftTB}"/>
<TextBlock Text="*" Foreground="Red" />
@@ -87,10 +84,8 @@
<hc:UniformSpacingPanel Spacing="10" Grid.ColumnSpan="4" Margin="0,10,0,0">
<WrapPanel VerticalAlignment="Center">
<TextBlock Text="完成时间:" Style="{StaticResource LeftTB}"/>
</WrapPanel>
<TextBlock x:Name="DoneTime" VerticalAlignment="Center" Margin="5,6,0,0" Text="{Binding DoneTime, Mode=OneWay}" Width="200"/>
<TextBlock Text="完成时间:" Style="{StaticResource LeftTB}"/>
<TextBlock x:Name="DoneTime" Text="{Binding DoneTime, Mode=OneWay}" Width="200"/>
</hc:UniformSpacingPanel>

View File

@@ -151,15 +151,8 @@ namespace GeekDesk.Control.Windows
};
if (windowType != NEW_TODO)
{
ToDoInfo tdi = this.DataContext as ToDoInfo;
if (appData.HiToDoList.Contains(tdi))
{
appData.HiToDoList.Remove(tdi);
} else if (appData.ToDoList.Contains(tdi))
{
appData.ToDoList.Remove(tdi);
}
}
appData.HiToDoList.Remove(this.DataContext as ToDoInfo);
}
appData.ToDoList.Add(info);
DateTime dtNow = DateTime.Now;
@@ -254,7 +247,6 @@ namespace GeekDesk.Control.Windows
{
if (e.Key == Key.Escape)
{
this.DataContext = null;
this.Close();
}
}

View File

@@ -102,7 +102,6 @@ namespace GeekDesk.Control.Windows
{
if (e.Key == Key.Escape)
{
this.DataContext = null;
this.Close();
}
}

View File

@@ -38,9 +38,9 @@ namespace GeekDesk.Control.Windows
InitializeComponent();
DataHandle(jo);
}
catch (Exception)
catch (Exception e)
{
LogUtil.WriteErrorLog(e, "更新信息格式化失败!");
}
}
@@ -111,7 +111,6 @@ namespace GeekDesk.Control.Windows
{
if (e.Key == Key.Escape)
{
this.DataContext = null;
this.Close();
}
}

View File

@@ -27,6 +27,7 @@
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<Prefer32Bit>false</Prefer32Bit>
<GenerateSerializationAssemblies>Auto</GenerateSerializationAssemblies>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
@@ -221,6 +222,7 @@
<Compile Include="Util\ShowWindowFollowMouse.cs" />
<Compile Include="Util\StringUtil.cs" />
<Compile Include="Util\SvgToGeometry.cs" />
<Compile Include="Util\SystemIcon.cs" />
<Compile Include="ViewModel\AppConfig.cs" />
<Compile Include="ViewModel\AppData.cs" />
<Compile Include="ViewModel\ToDoInfo.cs" />
@@ -383,21 +385,35 @@
<Isolated>False</Isolated>
<EmbedInteropTypes>True</EmbedInteropTypes>
</COMReference>
</ItemGroup>
<ItemGroup>
<Resource Include="Resource\Image\SystemIcon\Services.png" />
<COMReference Include="Shell32">
<Guid>{50A7E9B0-70EF-11D1-B75A-00A0C90564FE}</Guid>
<VersionMajor>1</VersionMajor>
<VersionMinor>0</VersionMinor>
<Lcid>0</Lcid>
<WrapperTool>tlbimp</WrapperTool>
<Isolated>False</Isolated>
<EmbedInteropTypes>True</EmbedInteropTypes>
</COMReference>
</ItemGroup>
<ItemGroup>
<Resource Include="Resource\Image\SystemIcon\Calculator.png" />
<Resource Include="Resource\Image\SystemIcon\CMD.png" />
<Resource Include="Resource\Image\SystemIcon\Computer.png" />
<Resource Include="Resource\Image\SystemIcon\Control.png" />
<Resource Include="Resource\Image\SystemIcon\GroupPolicy.png" />
<Resource Include="Resource\Image\SystemIcon\Mstsc.png" />
<Resource Include="Resource\Image\SystemIcon\Network.png" />
<Resource Include="Resource\Image\SystemIcon\Notepad.png" />
<Resource Include="Resource\Image\SystemIcon\RecycleBin.png" />
<Resource Include="Resource\Image\SystemIcon\Registry.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Resource\Image\SystemIcon\Notepad.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Resource\Image\SystemIcon\Mstsc.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Resource\Image\SystemIcon\Control.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Resource\Image\SystemIcon\CMD.png" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View File

@@ -27,7 +27,7 @@
<WindowChrome CaptionHeight="0" ResizeBorderThickness="15"/>
</WindowChrome.WindowChrome>
<Window.Resources>
<cvt:MenuWidthConvert x:Key="MenuWidthConvert"/>
<cvt:OpcityConvert x:Key="OpcityConvert"/>
<cvt:IntToCornerRadius x:Key="IntToCornerRadius"/>
@@ -38,7 +38,7 @@
<DropShadowEffect BlurRadius="30" Direction="-90" Color="Gray"
RenderingBias="Quality" ShadowDepth="2"/>
</Window.Effect>
<Border Margin="20" CornerRadius="{Binding AppConfig.PannelCornerRadius, Mode=TwoWay, Converter={StaticResource IntToCornerRadius}}" BorderThickness="0"
<Border Margin="20" CornerRadius="{Binding AppConfig.PannelCornerRadius, Mode=TwoWay, Converter={StaticResource IntToCornerRadius}}" BorderThickness="0"
Background="AliceBlue" LostFocus="App_LostFocus"
Opacity="{Binding AppConfig.PannelOpacity, Mode=TwoWay, Converter={StaticResource OpcityConvert}}"
VirtualizingPanel.VirtualizationMode="Recycling" VirtualizingPanel.IsVirtualizing="True" VirtualizingPanel.IsContainerVirtualizable="True"
@@ -119,7 +119,7 @@
<uc:LeftCardControl Grid.Row="1" Grid.Column="0"/>
<!--分割线-->
<GridSplitter Opacity="0" Grid.Row="1" Grid.Column="0" Width="1" VerticalAlignment="Stretch" HorizontalAlignment="Right"/>

View File

@@ -61,15 +61,14 @@ namespace GeekDesk
/// </summary>
private void LoadData()
{
GC.KeepAlive(appData); // 持活
this.DataContext = appData;
if (appData.MenuList.Count == 0)
{
appData.MenuList.Add(new MenuInfo() { MenuName = "NewMenu", MenuId = System.Guid.NewGuid().ToString(), MenuEdit = Visibility.Collapsed });
appData.MenuList.Add(new MenuInfo() { MenuName = "NewMenu", MenuId = System.Guid.NewGuid().ToString(), MenuEdit = Visibility.Collapsed});
}
this.Width = appData.AppConfig.WindowWidth;
this.Height = appData.AppConfig.WindowHeight;
this.Height = appData.AppConfig.WindowHeight;
}
/// <summary>
@@ -84,13 +83,11 @@ namespace GeekDesk
if (appData.AppConfig.AppAnimation)
{
this.Opacity = 0;
}
else
} else
{
this.Visibility = Visibility.Collapsed;
}
}
else
} else
{
ShowApp();
}
@@ -162,7 +159,44 @@ namespace GeekDesk
}
}
/// <summary>
/// 淡入淡出效果
/// </summary>
/// <param name="opacity"></param>
/// <param name="milliseconds"></param>
/// <param name="visibility"></param>
public static void FadeStoryBoard(int opacity, int milliseconds, Visibility visibility)
{
if (appData.AppConfig.AppAnimation)
{
DoubleAnimation opacityAnimation = new DoubleAnimation
{
From = mainWindow.Opacity,
To = opacity,
Duration = new Duration(TimeSpan.FromMilliseconds(milliseconds))
};
opacityAnimation.Completed += (s, e) =>
{
mainWindow.BeginAnimation(OpacityProperty, null);
if (visibility == Visibility.Visible)
{
mainWindow.Opacity = 1;
} else
{
mainWindow.Opacity = 0;
}
};
Timeline.SetDesiredFrameRate(opacityAnimation, 60);
mainWindow.BeginAnimation(OpacityProperty, opacityAnimation);
} else
{
//防止关闭动画后 窗体仍是0透明度
mainWindow.Opacity = 1;
mainWindow.Visibility = visibility;
}
}
/// <summary>
/// 注册新建待办的热键
@@ -172,7 +206,7 @@ namespace GeekDesk
try
{
if (appData.AppConfig.ToDoHotkeyModifiers != 0)
if (appData.AppConfig.ToDoHotkeyModifiers!=0)
{
//加载完毕注册热键
toDoHotKeyId = GlobalHotKey.RegisterHotKey(appData.AppConfig.ToDoHotkeyModifiers, appData.AppConfig.ToDoHotkey, () =>
@@ -218,7 +252,7 @@ namespace GeekDesk
}
/// <summary>
/// 程序窗体拖动
/// </summary>
@@ -264,14 +298,13 @@ namespace GeekDesk
if (appData.AppConfig.AppAnimation)
{
FadeStoryBoard(0, (int)CommonEnum.WINDOW_ANIMATION_TIME, Visibility.Collapsed);
}
else
} else
{
this.Visibility = Visibility.Collapsed;
}
}
///// <summary>
///// 左侧栏宽度改变 持久化
@@ -283,7 +316,7 @@ namespace GeekDesk
// appData.AppConfig.MenuCardWidth = LeftColumn.Width.Value;
//}
/// <summary>
/// 右键任务栏图标 显示主面板
@@ -316,45 +349,6 @@ namespace GeekDesk
FadeStoryBoard(0, (int)CommonEnum.WINDOW_ANIMATION_TIME, Visibility.Collapsed);
}
/// <summary>
/// 淡入淡出效果
/// </summary>
/// <param name="opacity"></param>
/// <param name="milliseconds"></param>
/// <param name="visibility"></param>
public static void FadeStoryBoard(int opacity, int milliseconds, Visibility visibility)
{
if (appData.AppConfig.AppAnimation)
{
DoubleAnimation opacityAnimation = new DoubleAnimation
{
From = mainWindow.Opacity,
To = opacity,
Duration = new Duration(TimeSpan.FromMilliseconds(milliseconds))
};
opacityAnimation.Completed += (s, e) =>
{
mainWindow.BeginAnimation(OpacityProperty, null);
if (visibility == Visibility.Visible)
{
mainWindow.Opacity = 1;
}
else
{
mainWindow.Opacity = 0;
}
};
Timeline.SetDesiredFrameRate(opacityAnimation, 60);
mainWindow.BeginAnimation(OpacityProperty, opacityAnimation);
}
else
{
//防止关闭动画后 窗体仍是0透明度
mainWindow.Opacity = 1;
mainWindow.Visibility = visibility;
}
}

View File

@@ -49,5 +49,5 @@ using System.Windows;
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.4.1.2")]
[assembly: AssemblyFileVersion("2.4.1.2")]
[assembly: AssemblyVersion("2.4.1.0")]
[assembly: AssemblyFileVersion("2.4.1.0")]

View File

@@ -55,6 +55,6 @@
</Trigger>
</Style.Triggers>
</Style>
</ResourceDictionary>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

View File

@@ -1,4 +1,5 @@
using GeekDesk.Control.UserControls.Config;
using GeekDesk.Util;
using GeekDesk.ViewModel;
using Gma.System.MouseKeyHook;
using System;
@@ -15,7 +16,7 @@ namespace GeekDesk.Thread
public class MouseHookThread
{
private static AppConfig appConfig = MainWindow.appData.AppConfig;
private static IKeyboardMouseEvents m_GlobalHook = Hook.GlobalEvents();
private static IKeyboardMouseEvents m_GlobalHook = null;
private static Dispatcher dispatcher;
@@ -23,7 +24,9 @@ namespace GeekDesk.Thread
public static void MiddleHook()
{
//使用dispatcher来单独监听UI线程 防止程序卡顿
if (dispatcher != null) return;
dispatcher = DispatcherBuild.Build();
m_GlobalHook = Hook.GlobalEvents();
dispatcher.Invoke((Action)(() =>
{
m_GlobalHook.MouseDownExt += M_GlobalHook_MouseDownExt;
@@ -32,9 +35,16 @@ namespace GeekDesk.Thread
public static void Dispose()
{
m_GlobalHook.MouseDownExt -= M_GlobalHook_MouseDownExt;
m_GlobalHook.Dispose();
dispatcher.InvokeShutdown();
try
{
m_GlobalHook.MouseDownExt -= M_GlobalHook_MouseDownExt;
m_GlobalHook.Dispose();
m_GlobalHook = null;
dispatcher.InvokeShutdown();
dispatcher = null;
}
catch { }
}
/// <summary>
@@ -50,7 +60,9 @@ namespace GeekDesk.Thread
{
MainWindow.mainWindow.Dispatcher.Invoke((Action)(() =>
{
if (MainWindow.mainWindow.Visibility == Visibility.Collapsed || MainWindow.mainWindow.Opacity == 0)
if (MainWindow.mainWindow.Visibility == Visibility.Collapsed
|| MainWindow.mainWindow.Opacity == 0
|| MarginHide.IS_HIDE)
{
MainWindow.ShowApp();
}

View File

@@ -59,9 +59,9 @@ namespace GeekDesk.Thread
}));
}
}
} catch (Exception ex)
} catch (Exception e)
{
LogUtil.WriteErrorLog(ex, "获取更新失败!");
LogUtil.WriteErrorLog(e, "检测更新失败!");
}
}
}

View File

@@ -1,9 +1,9 @@
{
"title": "GeekDesk版本更新",
"subTitle": "V2.4.12",
"subTitle": "V2.4.10",
"msgTitle": "本次更新内容如下",
"msg": "['各位兄弟去给我点个免费Star呗','这是个修复版本,主要修复上个版本的bug','修复图标无法拖动','修复界面遮挡任务栏']",
"msg": "['各位兄弟去给我点个免费Star呗','增加添加系统和开始菜单应用功能','增加项目启动参数','优化贴边隐藏动画效果(可能现在并不完美)','增加双击打开功能','其它已知问题修复(如果有人发现)']",
"githubUrl": "https://github.com/Demo-Liu/GeekDesk/releases",
"giteeUrl": "https://gitee.com/demo_liu/GeekDesk/releases",
"version": "2.4.12"
"version": "2.4.10"
}

9
Update.json.bak Normal file
View File

@@ -0,0 +1,9 @@
{
"title": "GeekDesk<73><EFBFBD><E6B1BE><EFBFBD><EFBFBD>",
"subTitle": "V2.3.21",
"msgTitle": "<22><><EFBFBD>θ<EFBFBD><CEB8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>",
"msg": "['<27><><EFBFBD>д<EFBFBD><D0B4>ڿ<EFBFBD>Esc<73>˳<EFBFBD>','<27>޸<EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>BUG,<2C><><EFBFBD><EFBFBD>û<EFBFBD><C3BB>D<EFBFBD>̵<EFBFBD><CCB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>޷<EFBFBD><DEB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ','<27>޸<EFBFBD><DEB8><EFBFBD>֪<EFBFBD><D6AA><EFBFBD><EFBFBD>']",
"githubUrl": "https://github.com/Demo-Liu/GeekDesk/releases",
"giteeUrl": "https://gitee.com/demo_liu/GeekDesk/releases",
"version": "2.3.21"
}

View File

@@ -93,7 +93,7 @@ namespace GeekDesk.Util
string iconPath = null;
//if (".lnk".Equals(ext))
//{
string targetPath = FileUtil.GetTargetPathByLnk(path);
iconPath = FileUtil.GetIconPathByLnk(path);
if (targetPath != null)

View File

@@ -32,11 +32,11 @@ namespace GeekDesk.Util
int nIcons, //指定获取的图标数量,仅当文件类型为.exe 和 .dll时候可用
int flags //标志默认0就可以具体可以看LoadImage函数
);
public static BitmapImage GetBitmapImage(string filePath)
{
Icon ico;
Icon ico = null;
//选中文件中的图标总数
var iconTotalCount = PrivateExtractIcons(filePath, 0, 0, 0, null, null, 0, 0);
//用于接收获取到的图标指针
@@ -53,18 +53,31 @@ namespace GeekDesk.Util
{
ip = hIcons[0];
ico = Icon.FromHandle(ip);
if (IsMinOrTransparent(ico))
{
ico = null;
}
}
else if (GetBlurExts().Contains(ext))
if (ico == null && GetBlurExts().Contains(ext))
{
ico = Icon.ExtractAssociatedIcon(filePath);
if (IsMinOrTransparent(ico))
{
ico = null;
}
}
else
if (ico == null)
{
ip = GetJumboIcon(GetIconIndex(filePath));
ico = Icon.FromHandle(ip);
}
return IconToBitmapImage(ico, ip);
}
Bitmap bmp = ico.ToBitmap();
private static BitmapImage IconToBitmapImage(Icon icon, IntPtr iconIP)
{
Bitmap bmp = icon.ToBitmap();
MemoryStream strm = new MemoryStream();
ImageCodecInfo myImageCodecInfo = GetEncoderInfo("image/png");
@@ -73,19 +86,51 @@ namespace GeekDesk.Util
EncoderParameters myEncoderParameters = new EncoderParameters(1);
myEncoderParameters.Param[0] = myEncoderParameter;
//bmp.Save("d:\\test.png");
bmp.Save(strm, myImageCodecInfo, myEncoderParameters);
BitmapImage bmpImage = new BitmapImage();
bmpImage.BeginInit();
strm.Seek(0, SeekOrigin.Begin);
bmpImage.StreamSource = strm;
bmpImage.EndInit();
if (ip != IntPtr.Zero)
if (iconIP != IntPtr.Zero)
{
Shell32.DestroyIcon(ip);
Shell32.DestroyIcon(iconIP);
}
return bmpImage.Clone();
}
private static bool IsMinOrTransparent(Icon ico)
{
Bitmap bm = ico.ToBitmap();
double w = bm.Width;
double h = bm.Height;
Color middleColor = bm.GetPixel((int)(w * 0.50), (int)(h * 0.50));
Color transparent = Color.FromArgb(0, 0, 0, 0);
//如果中间像素不为空 直接判断此icon不为空
if (middleColor != Color.Transparent && middleColor != transparent)
{
return false;
}
//判断中间一条横线像素 有不透明元素即判断 icon不为空
Color c;
int h2 = (int)h / 2;
for (int i=0; i<(int)w; i++)
{
c = bm.GetPixel(i, h2);
if (c!= Color.Transparent && c != transparent)
{
return false;
}
}
return true;
}
private static ImageCodecInfo GetEncoderInfo(String mimeType)
{
int j;
@@ -416,7 +461,6 @@ namespace GeekDesk.Util
int iOverlay,
ref int piIndex);
};
}
}

View File

@@ -27,7 +27,7 @@ namespace GeekDesk.Util
return null;
}
string path = shortcut.TargetPath;
if (path == null || Regex.IsMatch(path, NO_PATH))
if (path==null || Regex.IsMatch(path, NO_PATH))
{
path = ParseShortcut(filePath);
}
@@ -73,14 +73,13 @@ namespace GeekDesk.Util
IWshRuntimeLibrary.IWshShortcut shortcut = (IWshRuntimeLibrary.IWshShortcut)shell.CreateShortcut(filePath);
var iconPath = shortcut.IconLocation;
if (StringUtil.IsEmpty(iconPath)
|| Regex.IsMatch(iconPath, NO_ICO)
|| Regex.IsMatch(iconPath, NO_PATH)
if (StringUtil.IsEmpty(iconPath)
|| Regex.IsMatch(iconPath, NO_ICO)
|| Regex.IsMatch(iconPath, NO_PATH)
|| !Regex.IsMatch(iconPath, HAVE_ICO))
{
return null;
}
else
} else
{
return iconPath.Split(',')[0];
}

View File

@@ -53,9 +53,10 @@ namespace GeekDesk.Util
UnregisterHotKey(handleTemp[id].Handle, id);
GlobalHotKey.handleTemp[id].Dispose();
GlobalHotKey.handleTemp.Remove(id);
} catch
} catch (Exception e)
{
//nothing
LogUtil.WriteErrorLog(e, "取消注册热键异常!");
}

View File

@@ -93,30 +93,25 @@ namespace GeekDesk.Util
if (File.Exists(filePath) || IsSystemItem(filePath))
{
if (IsImage(filePath))
{
if (IsImage(filePath)) {
//图片
return GetThumbnailByFile(filePath, 256, 256);
}
else
} else
{ //其它文件
return FileIcon.GetBitmapImage(filePath);
}
}
else if (Directory.Exists(filePath))
{
} else if(Directory.Exists(filePath)) {
if ((filePath.IndexOf("\\") == filePath.LastIndexOf("\\")) && filePath.IndexOf("\\") == filePath.Length - 1)
{
//磁盘
return ImageUtil.Base64ToBitmapImage(Constants.DEFAULT_DISK_IMAGE_BASE64);
}
else
} else
{
//文件夹
return ImageUtil.Base64ToBitmapImage(Constants.DEFAULT_DIR_IMAGE_BASE64);
}
}
return null;
}
@@ -223,10 +218,10 @@ namespace GeekDesk.Util
}
catch (Exception e)
{
LogUtil.WriteErrorLog(e, "获取文件缩略图失败!filePath=" + filePath);
LogUtil.WriteErrorLog(e, "获取文件缩略图失败!filePath="+filePath);
return Base64ToBitmapImage(Constants.DEFAULT_IMG_IMAGE_BASE64);
}
}
@@ -324,7 +319,7 @@ namespace GeekDesk.Util
}
catch (Exception e)
{
LogUtil.WriteErrorLog(e, "图片文件转base64失败!Imagefilename=" + Imagefilename + ",ImageFormat=" + format);
LogUtil.WriteErrorLog(e, "图片文件转base64失败!Imagefilename=" + Imagefilename + ",ImageFormat="+format);
return null;
}
}

View File

@@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Drawing;
using System.Drawing;
using System.Windows.Forms;
using MouseEventArgs = System.Windows.Input.MouseEventArgs;
using System.Windows;
@@ -72,7 +72,7 @@ namespace GeekDesk.Util
|| windowLeft + windowWidth + Math.Abs(screenLeft) >= screenWidth);
}
#region
private static void HideWindow(object o, EventArgs e)
@@ -122,9 +122,8 @@ namespace GeekDesk.Util
HideAnimation(windowLeft, screenWidth - Math.Abs(screenLeft) - showMarginWidth, Window.LeftProperty, HideType.RIGHT_HIDE);
return;
}
}
else if (mouseX >= windowLeft && mouseX <= windowLeft + windowWidth
&& mouseY >= windowTop && mouseY <= windowTop + windowHeight && IS_HIDE)
} else if (mouseX >= windowLeft && mouseX <= windowLeft + windowWidth
&& mouseY >= windowTop && mouseY <= windowTop + windowHeight && IS_HIDE)
{
//上方显示
if (windowTop <= screenTop - showMarginWidth)
@@ -262,8 +261,7 @@ namespace GeekDesk.Util
if (to == 0D)
{
time = fadeHideTime;
}
else
} else
{
time = fadeShowTime;
}

View File

@@ -48,9 +48,11 @@ namespace GeekDesk.Util
key.Close();
}
#pragma warning disable CS0168 // 声明了变量“ex”但从未使用过
catch (Exception ex)
#pragma warning restore CS0168 // 声明了变量“ex”但从未使用过
{
LogUtil.WriteErrorLog(ex, "设置开机/取消失败!started=" + started);
LogUtil.WriteErrorLog(ex, "注册启动Error1!");
return false;
}
}
@@ -61,21 +63,25 @@ namespace GeekDesk.Util
key.DeleteValue(exeName);//取消开机启动
key.Close();
}
#pragma warning disable CS0168 // 声明了变量“ex”但从未使用过
catch (Exception ex)
#pragma warning restore CS0168 // 声明了变量“ex”但从未使用过
{
LogUtil.WriteErrorLog(ex, "取消开机启动失败!started=" + started);
LogUtil.WriteErrorLog(ex, "注册启动Error2!");
return false;
}
}
return true;
}
#pragma warning disable CS0168 // 声明了变量“ex”但从未使用过
catch (Exception ex)
#pragma warning restore CS0168 // 声明了变量“ex”但从未使用过
{
LogUtil.WriteErrorLog(ex, "取消/开机/失败!started=" + started);
if (key != null)
{
key.Close();
}
LogUtil.WriteErrorLog(ex, "注册启动Error3!");
return false;
}
}

View File

@@ -27,7 +27,7 @@ namespace GeekDesk.Util
double left = SystemParameters.VirtualScreenLeft;
double top = SystemParameters.VirtualScreenTop;
double width = SystemParameters.VirtualScreenWidth;
double height = SystemParameters.WorkArea.Height + 20;
double height = SystemParameters.WorkArea.Height + 20; // 不遮挡任务栏
double right = width - Math.Abs(left);
double bottom = height - Math.Abs(top);
@@ -36,7 +36,6 @@ namespace GeekDesk.Util
switch (position)
{
case MousePosition.LEFT_BOTTOM:
afterWidth = 0;
afterHeight = window.Height;

View File

@@ -21,14 +21,17 @@ namespace GeekDesk.Util
string svgPath = "/GeekDesk;component/Resource/Iconfont/iconfont.js";
string jsonPath = "/GeekDesk;component/Resource/Iconfont/iconfont.json";
Stream svgStream = Application.GetResourceStream(new Uri(svgPath, UriKind.Relative)).Stream;
Stream jsonStream = Application.GetResourceStream(new Uri(jsonPath, UriKind.Relative)).Stream;
StreamReader streamReader = new StreamReader(svgStream);
string svgJsStr = streamReader.ReadToEnd();
JObject jo = ReadJson(jsonStream);
return GetIconfonts(svgJsStr, jo);
using (Stream svgStream = Application.GetResourceStream(new Uri(svgPath, UriKind.Relative)).Stream,
jsonStream = Application.GetResourceStream(new Uri(jsonPath, UriKind.Relative)).Stream)
{
using (StreamReader streamReader = new StreamReader(svgStream))
{
string svgJsStr = streamReader.ReadToEnd();
JObject jo = ReadJson(jsonStream);
return GetIconfonts(svgJsStr, jo);
}
}
}
public static List<IconfontInfo> GetIconfonts(string svgJsStr, string jsonStr)

34
Util/SystemIcon.cs Normal file
View File

@@ -0,0 +1,34 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
namespace GeekDesk.Util
{
public class SystemIcon
{
[DllImport("Shell32.dll")]
public static extern int ExtractIcon(IntPtr h, string strx, int ii);
public static Icon MyExtractIcon(string FileName, int iIndex, IntPtr h)
{
try
{
IntPtr hIcon = (IntPtr)ExtractIcon(h, FileName, iIndex);
if (!hIcon.Equals(null))
{
Icon icon = Icon.FromHandle(hIcon);
return icon;
}
}
catch (Exception ex)
{
}
return null;
}
}
}

View File

@@ -121,19 +121,18 @@ namespace GeekDesk.ViewModel
if (imageWidth == 0)
{
return (int)CommonEnum.IMAGE_WIDTH;
}
else
} else
{
return imageWidth;
}
}
set
{
imageWidth = value;
//同时设置高度
ImageHeight = value;
//计算 容器宽度因子
double i = ((double)imageWidth - (double)CommonEnum.IMAGE_WIDTH) / 5d;
@@ -143,7 +142,7 @@ namespace GeekDesk.ViewModel
{
i /= 10d;
}
if (i > 0d)
{
s -= i;
@@ -397,8 +396,7 @@ namespace GeekDesk.ViewModel
if (blurEffect)
{
BlurValue = 100;
}
else
} else
{
BlurValue = 0;
}
@@ -570,8 +568,7 @@ namespace GeekDesk.ViewModel
bacImgName = "系统默认";
//Image image = ImageUtil.ByteArrayToImage(Convert.FromBase64String(Constants.DEFAULT_BAC_IMAGE_BASE64));
return ImageUtil.ByteArrToImage(Convert.FromBase64String(Constants.DEFAULT_BAC_IMAGE_BASE64));
}
else
} else
{
return ImageUtil.ByteArrToImage(ImageByteArr);
}

View File

@@ -1,4 +1,5 @@
using GeekDesk.Util;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
@@ -84,6 +85,11 @@ namespace GeekDesk.ViewModel
}
}
public override String ToString()
{
return JsonConvert.SerializeObject(this);
}
[field: NonSerializedAttribute()]
public event PropertyChangedEventHandler PropertyChanged;
private void OnPropertyChanged(string propertyName)

View File

@@ -143,8 +143,7 @@ namespace GeekDesk.ViewModel
if (StringUtil.IsEmpty(Path))
{
Content = Name + "\n使用次数: " + Count;
}
else
} else
{
Content = Path + "\n" + Name + "\n使用次数: " + Count;
}

View File

@@ -1,4 +1,5 @@
using System;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -36,5 +37,11 @@ namespace GeekDesk.ViewModel
name = value;
}
}
public override String ToString()
{
return JsonConvert.SerializeObject(this);
}
}
}

View File

@@ -1,5 +1,6 @@
using GeekDesk.Constant;
using GeekDesk.Util;
using Newtonsoft.Json;
using System;
using System.Collections.ObjectModel;
using System.ComponentModel;
@@ -17,11 +18,23 @@ namespace GeekDesk.ViewModel
private string menuId;
private Visibility menuEdit = Visibility.Collapsed;
private Visibility notMenuEdit = Visibility.Visible;
private bool isEdit = false;
private string menuGeometry; //菜单几何图标
private string geometryColor; //几何图标颜色
private ObservableCollection<IconInfo> iconList = new ObservableCollection<IconInfo>();
public bool IsEdit
{
get
{
return isEdit;
}
set
{
isEdit = value;
OnPropertyChanged("IsEdit");
}
}
public string MenuGeometry
{
get
@@ -93,9 +106,11 @@ namespace GeekDesk.ViewModel
menuEdit = value;
if (menuEdit == Visibility.Visible)
{
IsEdit = true;
NotMenuEdit = Visibility.Collapsed;
} else
{
IsEdit = false;
NotMenuEdit = Visibility.Visible;
}
OnPropertyChanged("MenuEdit");
@@ -128,6 +143,11 @@ namespace GeekDesk.ViewModel
}
}
public override String ToString()
{
return JsonConvert.SerializeObject(this);
}
[field: NonSerializedAttribute()]
public event PropertyChangedEventHandler PropertyChanged;
private void OnPropertyChanged(string propertyName)

View File

@@ -1,5 +1,6 @@
using GeekDesk.Constant;
using GeekDesk.Util;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.ComponentModel;
@@ -129,7 +130,10 @@ namespace GeekDesk.ViewModel
// }
//}
public override String ToString()
{
return JsonConvert.SerializeObject(this);
}
[field: NonSerializedAttribute()]