31 Commits

Author SHA1 Message Date
liufei
a03fb713e4 修改样式和待办中保存无法删除原有任务的bug 2022-01-10 17:56:52 +08:00
liufei
489a27a0ef 2.4.11 2022-01-10 17:29:16 +08:00
liufei
e112dfebea windir 转义 2022-01-10 17:27:29 +08:00
liufei
9ca443acf6 优化代码 2022-01-10 17:27:12 +08:00
liufei
dd17bbc2b3 增加 服务 选项 2022-01-10 16:23:42 +08:00
liufei
c9bb1c2fad 优化样式细节 2022-01-10 11:50:21 +08:00
liufei
8decd923ff 关闭窗口时 将数据设置为null 2022-01-09 17:44:25 +08:00
liufei
65d57b69b6 释放启动进程 2022-01-09 17:42:44 +08:00
liufei
28a523fb04 增加数据持活 2022-01-09 17:37:25 +08:00
liufei
a38ecab5fa 捕获异常, 写出日志 2022-01-09 17:36:15 +08:00
liufei
145564bfc5 捕获异常, 写出日志 2022-01-09 17:33:49 +08:00
liufei
fdd8c8bb10 更新日志 2022-01-09 17:11:05 +08:00
liufei
fce6f47fbe 修改为非开发模式 2022-01-09 17:06:50 +08:00
liufei
c9bc4282c0 增加启动参数 2022-01-09 16:19:27 +08:00
liufei
54200c8254 修复cron任务重复执行bug 2022-01-09 16:17:58 +08:00
liufei
72bcbee888 修改样式 2022-01-09 16:17:43 +08:00
liufei
de02248e75 增加启动参数 2022-01-09 16:17:13 +08:00
liufei
78b5b52c2a 增加启动参数 2022-01-09 16:12:15 +08:00
liufei
b66c9cd082 更新日志说明 2022-01-09 16:12:07 +08:00
liufei
83cdaa4491 修改程序集信息 2022-01-09 16:08:35 +08:00
liufei
9e3c6f67c8 修改错误样式 2022-01-09 16:08:29 +08:00
liufei
1a24222f3f 优化版本 2022-01-09 16:02:43 +08:00
liufei
1b9e4fc79d 优化贴边隐藏动画 2022-01-09 16:00:47 +08:00
liufei
9eaca05012 增加 教程链接 2022-01-09 16:00:02 +08:00
liufei
d82ce80374 修复遮罩层过大 2022-01-09 15:42:19 +08:00
liufei
4444e6000c 提取方法 2022-01-09 15:39:14 +08:00
liufei
46f6de321c 增加日志写入 2022-01-09 15:39:00 +08:00
liufei
c3e46bc751 优化贴边隐藏动画 2022-01-09 15:38:46 +08:00
liufei
b23a1d91c5 修改公共样式 2022-01-09 15:38:30 +08:00
liufei
edacf3249c 增加双击打开 修复重复进程导致不能关闭程序 2022-01-09 15:38:18 +08:00
liufei
ab13cff769 增加 添加系统和开始菜单项目功能 2022-01-09 15:37:37 +08:00
53 changed files with 397 additions and 480 deletions

View File

@@ -1,21 +1,20 @@
<?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="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="服务" />
</SystemIcons>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
@@ -45,15 +44,14 @@
</assemblyBinding>
</runtime>
<appSettings>
<add key="Version" value="2.4.10" />
<add key="Version" value="2.4.11" />
<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 = 950, //默认窗体宽度
WINDOW_HEIGHT = 650, //默认窗体高度
WINDOW_WIDTH = 666, //默认窗体宽度
WINDOW_HEIGHT = 500, //默认窗体高度
MENU_CARD_WIDHT = 165, //默认菜单栏宽度
IMAGE_WIDTH = 45, //默认图标宽度
IMAGE_HEIGHT = 45, //默认图标高度

View File

@@ -26,8 +26,6 @@ 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,7 +64,8 @@ namespace GeekDesk.Control.Other
{
Growl.SuccessGlobal("下次任务将在 " + minutes + " 分钟后提醒您!");
}
} else
}
else
{
appData.ToDoList.Remove(info); //执行任务删除
appData.HiToDoList.Add(info); //添加历史任务
@@ -122,7 +123,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,10 +34,11 @@ 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,12 +75,13 @@ 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 e1)
} catch (Exception ex)
{
HandyControl.Controls.Growl.WarningGlobal("修改图标失败,已重置为默认图标!");
LogUtil.WriteErrorLog(e1, "修改图标失败!");
LogUtil.WriteErrorLog(ex, "修改图标失败!");
}
}

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="Star"
<hc:Shield Subject="GitHub" Visibility="Visible" Status="Demo-liu"
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="Star"
<hc:Shield Subject="Gitee" Visibility="Visible" Status="Demo-liu"
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,7 +71,8 @@ namespace GeekDesk.Control.UserControls.Config
appConfig.Hotkey = 0;
appConfig.HotkeyStr = "";
appConfig.HotkeyModifiers = 0;
} else
}
else
{
appConfig.ToDoHotkey = 0;
appConfig.ToDoHotkeyStr = "";
@@ -80,7 +81,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))
@@ -90,7 +91,8 @@ namespace GeekDesk.Control.UserControls.Config
{
appConfig.HotkeyStr = GetKeyName(downKey);
appConfig.HotkeyModifiers = GetModifierKeys(downKey);
} else
}
else
{
appConfig.ToDoHotkeyStr = GetKeyName(downKey);
appConfig.ToDoHotkeyModifiers = GetModifierKeys(downKey);
@@ -111,7 +113,8 @@ namespace GeekDesk.Control.UserControls.Config
{
appConfig.Hotkey = downKey;
appConfig.HotkeyStr += downKey.ToString();
} else
}
else
{
appConfig.ToDoHotkey = downKey;
appConfig.ToDoHotkeyStr += downKey.ToString();
@@ -125,12 +128,13 @@ 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);
}
@@ -143,7 +147,8 @@ 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 + ";
}
@@ -187,7 +192,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;
@@ -195,7 +200,7 @@ namespace GeekDesk.Control.UserControls.Config
{
main = true;
}
lock(this)
lock (this)
{
bool allKeyUp = true;
//判断所有键是否都松开
@@ -221,7 +226,8 @@ namespace GeekDesk.Control.UserControls.Config
GlobalHotKey.Dispose(MainWindow.hotKeyId);
}
MainWindow.RegisterHotKey(false);
} else
}
else
{
if (MainWindow.toDoHotKeyId != -1)
{
@@ -231,7 +237,7 @@ namespace GeekDesk.Control.UserControls.Config
MainWindow.RegisterCreateToDoHotKey(false);
}
}
}
}
@@ -254,7 +260,8 @@ namespace GeekDesk.Control.UserControls.Config
if (appConfig.MarginHide)
{
MarginHide.StartHide();
} else
}
else
{
MarginHide.StopHide();
}
@@ -281,7 +288,8 @@ 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 e1)
catch (Exception ex)
{
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 e1)
catch (Exception ex)
{
LogUtil.WriteErrorLog(ex, "修改背景失败2,已重置为默认背景!");
HandyControl.Controls.Growl.WarningGlobal("修改背景失败,已重置为默认背景!");
LogUtil.WriteErrorLog(e1, "修改默认背景失败!");
}
}

View File

@@ -44,24 +44,13 @@
</BeginStoryboard>
</MultiTrigger.ExitActions>
</MultiTrigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="#FFECECEC"/>
</Trigger>
<Trigger Property="IsSelected" Value="True">
<!--<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="#FFE4DBDB"/>
</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"/>
@@ -69,7 +58,7 @@
</UserControl.Resources>
<!--左侧栏-->
<hc:Card x:Name="MyCard"
BorderThickness="1"
BorderThickness="1"
Effect="{DynamicResource EffectShadow2}"
Margin="5,0,0,5"
>
@@ -88,7 +77,6 @@
</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}"
@@ -102,7 +90,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>
@@ -116,28 +104,27 @@
<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}">
<TextBox Text="{Binding Path=MenuName, Mode=TwoWay}"
<StackPanel MouseLeftButtonDown="MenuClick" MouseRightButtonDown="MenuClick" Tag="{Binding}">
<hc: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="28"
Height="25"
VerticalAlignment="Center"
TextAlignment="Left"
LostFocus="LostFocusOrEnterDown"
KeyDown="LostFocusOrEnterDown"
Tag="{Binding}"
Padding="2"
BorderThickness="0"
Margin="2"
IsVisibleChanged="MenuEditWhenVisibilityChanged"
Visibility="{Binding MenuEdit}"/>
<StackPanel Orientation="Horizontal">
<StackPanel Orientation="Horizontal">
<Button Background="Transparent"
BorderThickness="0"
hc:IconElement.Geometry="{Binding MenuGeometry}"

View File

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

View File

@@ -123,7 +123,7 @@
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</WrapPanel>
</hc:Card>
</UserControl>

View File

@@ -78,7 +78,8 @@ 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)
@@ -90,7 +91,7 @@ namespace GeekDesk.Control.UserControls.PannelCard
StartIconApp(icon, IconStartType.DEFAULT_STARTUP);
}
}
}
/// <summary>
@@ -119,97 +120,98 @@ namespace GeekDesk.Control.UserControls.PannelCard
{
try
{
Process p = new Process();
string startArg = icon.StartArg;
if (startArg!=null && Constants.SYSTEM_ICONS.ContainsKey(startArg))
using (Process p = new Process())
{
StartSystemApp(startArg, type);
} else
{
p.StartInfo.FileName = icon.Path;
if (!StringUtil.IsEmpty(startArg))
{
p.StartInfo.Arguments = startArg;
}
if (icon.IconType == IconType.OTHER)
{
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();
}
string startArg = icon.StartArg;
}
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;
}
if (startArg != null && Constants.SYSTEM_ICONS.ContainsKey(startArg))
{
StartSystemApp(startArg, type);
}
else
{
if (appData.AppConfig.AppHideType == AppHideType.START_EXE)
p.StartInfo.FileName = icon.Path;
if (!StringUtil.IsEmpty(startArg))
{
//如果开启了贴边隐藏 则窗体不贴边才隐藏窗口
if (appData.AppConfig.MarginHide)
p.StartInfo.Arguments = startArg;
}
if (icon.IconType == IconType.OTHER)
{
if (!File.Exists(icon.Path) && !Directory.Exists(icon.Path))
{
if (!MarginHide.IS_HIDE)
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)
{
if (!MarginHide.IS_HIDE)
{
MainWindow.HideApp();
}
}
else
{
MainWindow.HideApp();
}
}
else
{
MainWindow.HideApp();
}
}
p.Start();
}
p.Start();
}
icon.Count++;
}
catch (Exception e)
@@ -255,7 +257,8 @@ namespace GeekDesk.Control.UserControls.PannelCard
if (type == IconStartType.ADMIN_STARTUP)
{
Process.Start("mstsc", "-admin");
} else
}
else
{
Process.Start("mstsc");
}
@@ -266,15 +269,21 @@ namespace GeekDesk.Control.UserControls.PannelCard
case "CMD":
if (type == IconStartType.ADMIN_STARTUP)
{
Process process = new Process();
process.StartInfo.FileName = "cmd.exe";
process.StartInfo.Verb = "runas";
process.Start();
} else
using (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)
@@ -374,7 +383,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;
@@ -383,16 +392,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,
@@ -428,7 +437,8 @@ 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);

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,5 +84,20 @@ 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,6 +95,7 @@ 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,6 +57,7 @@ namespace GeekDesk.Control.Windows
private void Close_Click(object sender, RoutedEventArgs e)
{
this.DataContext = null;
this.Close();
}
@@ -73,13 +74,15 @@ 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;
@@ -121,6 +124,7 @@ namespace GeekDesk.Control.Windows
}
break;
}
this.DataContext = null;
this.Close();
}
@@ -148,7 +152,8 @@ namespace GeekDesk.Control.Windows
if (CheckSettingUrl.Text == "true")
{
LoadingOnlineIcon();
} else
}
else
{
LoadingEle.IsRunning = true;
CustomIcon.Visibility = Visibility.Collapsed;
@@ -179,6 +184,7 @@ 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 static List<IconInfo> systemIcons;
private static List<IconInfo> startMenuIcons;
private static List<IconInfo> storeIcons;
private List<IconInfo> systemIcons;
private List<IconInfo> startMenuIcons;
private List<IconInfo> storeIcons;
private SystemItemWindow()
{
@@ -56,6 +56,7 @@ namespace GeekDesk.Control.Windows
private void Close_Click(object sender, RoutedEventArgs e)
{
this.DataContext = null;
this.Close();
}
@@ -149,13 +150,24 @@ namespace GeekDesk.Control.Windows
/// </summary>
/// <param name="path"></param>
/// <param name="listInfos"></param>
private void GetInfos(string path, List<IconInfo> listInfos)
private void GetInfos(string filePath, List<IconInfo> listInfos)
{
DirectoryInfo di = new DirectoryInfo(path);
FileSystemInfo[] fileInfoArr = di.GetFileSystemInfos();
foreach(FileSystemInfo fi in fileInfoArr)
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)
{
path = fi.FullName;
if (File.Exists(path))
{
string ext = Path.GetExtension(path).ToLower();
@@ -178,6 +190,13 @@ namespace GeekDesk.Control.Windows
GetInfos(path, listInfos);
}
}
//FileSystemInfo[] fileInfoArr = di.GetFileSystemInfos();
//foreach(FileSystemInfo fi in fileInfoArr)
//{
// string path = fi.FullName;
//}
}
/// <summary>
@@ -270,6 +289,7 @@ namespace GeekDesk.Control.Windows
{
if (e.Key == Key.Escape)
{
this.DataContext = null;
this.Close();
}
}

View File

@@ -30,6 +30,7 @@
<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"/>
@@ -67,13 +68,15 @@
IsChecked="{Binding ExecType, Mode=OneWay, Converter={StaticResource TodoTaskExecConvert}, ConverterParameter=2}"/>
</hc:UniformSpacingPanel>
<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 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>
<hc:UniformSpacingPanel x:Name="CronPanel" Visibility="Collapsed" Spacing="10" Grid.ColumnSpan="4" Margin="0,10,0,0">
<hc:UniformSpacingPanel x:Name="CronPanel" Height="30" 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" />
@@ -84,8 +87,10 @@
<hc:UniformSpacingPanel Spacing="10" Grid.ColumnSpan="4" Margin="0,10,0,0">
<TextBlock Text="完成时间:" Style="{StaticResource LeftTB}"/>
<TextBlock x:Name="DoneTime" Text="{Binding DoneTime, Mode=OneWay}" Width="200"/>
<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"/>
</hc:UniformSpacingPanel>

View File

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

View File

@@ -102,6 +102,7 @@ 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 e)
catch (Exception)
{
LogUtil.WriteErrorLog(e, "更新信息格式化失败!");
}
}
@@ -111,6 +111,7 @@ namespace GeekDesk.Control.Windows
{
if (e.Key == Key.Escape)
{
this.DataContext = null;
this.Close();
}
}

View File

@@ -27,7 +27,6 @@
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<Prefer32Bit>false</Prefer32Bit>
<GenerateSerializationAssemblies>Auto</GenerateSerializationAssemblies>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
@@ -222,7 +221,6 @@
<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" />
@@ -385,35 +383,21 @@
<Isolated>False</Isolated>
<EmbedInteropTypes>True</EmbedInteropTypes>
</COMReference>
<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\Services.png" />
</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,14 +61,15 @@ 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>
@@ -83,11 +84,13 @@ namespace GeekDesk
if (appData.AppConfig.AppAnimation)
{
this.Opacity = 0;
} else
}
else
{
this.Visibility = Visibility.Collapsed;
}
} else
}
else
{
ShowApp();
}
@@ -159,44 +162,7 @@ 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>
/// 注册新建待办的热键
@@ -206,7 +172,7 @@ namespace GeekDesk
try
{
if (appData.AppConfig.ToDoHotkeyModifiers!=0)
if (appData.AppConfig.ToDoHotkeyModifiers != 0)
{
//加载完毕注册热键
toDoHotKeyId = GlobalHotKey.RegisterHotKey(appData.AppConfig.ToDoHotkeyModifiers, appData.AppConfig.ToDoHotkey, () =>
@@ -252,7 +218,7 @@ namespace GeekDesk
}
/// <summary>
/// 程序窗体拖动
/// </summary>
@@ -298,13 +264,14 @@ namespace GeekDesk
if (appData.AppConfig.AppAnimation)
{
FadeStoryBoard(0, (int)CommonEnum.WINDOW_ANIMATION_TIME, Visibility.Collapsed);
} else
}
else
{
this.Visibility = Visibility.Collapsed;
}
}
///// <summary>
///// 左侧栏宽度改变 持久化
@@ -316,7 +283,7 @@ namespace GeekDesk
// appData.AppConfig.MenuCardWidth = LeftColumn.Width.Value;
//}
/// <summary>
/// 右键任务栏图标 显示主面板
@@ -349,6 +316,45 @@ 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.0")]
[assembly: AssemblyFileVersion("2.4.1.0")]
[assembly: AssemblyVersion("2.4.1.1")]
[assembly: AssemblyFileVersion("2.4.1.1")]

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

View File

@@ -1,5 +1,4 @@
using GeekDesk.Control.UserControls.Config;
using GeekDesk.Util;
using GeekDesk.ViewModel;
using Gma.System.MouseKeyHook;
using System;
@@ -16,7 +15,7 @@ namespace GeekDesk.Thread
public class MouseHookThread
{
private static AppConfig appConfig = MainWindow.appData.AppConfig;
private static IKeyboardMouseEvents m_GlobalHook = null;
private static IKeyboardMouseEvents m_GlobalHook = Hook.GlobalEvents();
private static Dispatcher dispatcher;
@@ -24,9 +23,7 @@ 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;
@@ -35,16 +32,9 @@ namespace GeekDesk.Thread
public static void Dispose()
{
try
{
m_GlobalHook.MouseDownExt -= M_GlobalHook_MouseDownExt;
m_GlobalHook.Dispose();
m_GlobalHook = null;
dispatcher.InvokeShutdown();
dispatcher = null;
}
catch { }
m_GlobalHook.MouseDownExt -= M_GlobalHook_MouseDownExt;
m_GlobalHook.Dispose();
dispatcher.InvokeShutdown();
}
/// <summary>
@@ -60,9 +50,7 @@ namespace GeekDesk.Thread
{
MainWindow.mainWindow.Dispatcher.Invoke((Action)(() =>
{
if (MainWindow.mainWindow.Visibility == Visibility.Collapsed
|| MainWindow.mainWindow.Opacity == 0
|| MarginHide.IS_HIDE)
if (MainWindow.mainWindow.Visibility == Visibility.Collapsed || MainWindow.mainWindow.Opacity == 0)
{
MainWindow.ShowApp();
}

View File

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

View File

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

View File

@@ -1,9 +0,0 @@
{
"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 = null;
Icon ico;
//选中文件中的图标总数
var iconTotalCount = PrivateExtractIcons(filePath, 0, 0, 0, null, null, 0, 0);
//用于接收获取到的图标指针
@@ -53,31 +53,18 @@ namespace GeekDesk.Util
{
ip = hIcons[0];
ico = Icon.FromHandle(ip);
if (IsMinOrTransparent(ico))
{
ico = null;
}
}
if (ico == null && GetBlurExts().Contains(ext))
else if (GetBlurExts().Contains(ext))
{
ico = Icon.ExtractAssociatedIcon(filePath);
if (IsMinOrTransparent(ico))
{
ico = null;
}
}
if (ico == null)
else
{
ip = GetJumboIcon(GetIconIndex(filePath));
ico = Icon.FromHandle(ip);
}
return IconToBitmapImage(ico, ip);
}
private static BitmapImage IconToBitmapImage(Icon icon, IntPtr iconIP)
{
Bitmap bmp = icon.ToBitmap();
Bitmap bmp = ico.ToBitmap();
MemoryStream strm = new MemoryStream();
ImageCodecInfo myImageCodecInfo = GetEncoderInfo("image/png");
@@ -86,51 +73,19 @@ 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 (iconIP != IntPtr.Zero)
if (ip != IntPtr.Zero)
{
Shell32.DestroyIcon(iconIP);
Shell32.DestroyIcon(ip);
}
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;
@@ -461,6 +416,7 @@ 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,13 +73,14 @@ 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,10 +53,9 @@ namespace GeekDesk.Util
UnregisterHotKey(handleTemp[id].Handle, id);
GlobalHotKey.handleTemp[id].Dispose();
GlobalHotKey.handleTemp.Remove(id);
} catch (Exception e)
} catch
{
//nothing
LogUtil.WriteErrorLog(e, "取消注册热键异常!");
}

View File

@@ -93,25 +93,30 @@ 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;
}
@@ -218,10 +223,10 @@ namespace GeekDesk.Util
}
catch (Exception e)
{
LogUtil.WriteErrorLog(e, "获取文件缩略图失败!filePath="+filePath);
LogUtil.WriteErrorLog(e, "获取文件缩略图失败!filePath=" + filePath);
return Base64ToBitmapImage(Constants.DEFAULT_IMG_IMAGE_BASE64);
}
}
@@ -319,7 +324,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,8 +122,9 @@ 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)
@@ -261,7 +262,8 @@ namespace GeekDesk.Util
if (to == 0D)
{
time = fadeHideTime;
} else
}
else
{
time = fadeShowTime;
}

View File

@@ -48,11 +48,9 @@ namespace GeekDesk.Util
key.Close();
}
#pragma warning disable CS0168 // 声明了变量“ex”但从未使用过
catch (Exception ex)
#pragma warning restore CS0168 // 声明了变量“ex”但从未使用过
{
LogUtil.WriteErrorLog(ex, "注册启动Error1!");
LogUtil.WriteErrorLog(ex, "设置开机/取消失败!started=" + started);
return false;
}
}
@@ -63,25 +61,21 @@ namespace GeekDesk.Util
key.DeleteValue(exeName);//取消开机启动
key.Close();
}
#pragma warning disable CS0168 // 声明了变量“ex”但从未使用过
catch (Exception ex)
#pragma warning restore CS0168 // 声明了变量“ex”但从未使用过
{
LogUtil.WriteErrorLog(ex, "注册启动Error2!");
LogUtil.WriteErrorLog(ex, "取消开机启动失败!started=" + started);
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.VirtualScreenHeight;
double right = width - Math.Abs(left);
double bottom = height - Math.Abs(top);
@@ -36,6 +36,7 @@ namespace GeekDesk.Util
switch (position)
{
case MousePosition.LEFT_BOTTOM:
afterWidth = 0;
afterHeight = window.Height;

View File

@@ -21,17 +21,14 @@ 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;
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);
}
}
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)

View File

@@ -1,34 +0,0 @@
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,18 +121,19 @@ 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;
@@ -142,7 +143,7 @@ namespace GeekDesk.ViewModel
{
i /= 10d;
}
if (i > 0d)
{
s -= i;
@@ -396,7 +397,8 @@ namespace GeekDesk.ViewModel
if (blurEffect)
{
BlurValue = 100;
} else
}
else
{
BlurValue = 0;
}
@@ -568,7 +570,8 @@ 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,5 +1,4 @@
using GeekDesk.Util;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
@@ -85,11 +84,6 @@ 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,7 +143,8 @@ namespace GeekDesk.ViewModel
if (StringUtil.IsEmpty(Path))
{
Content = Name + "\n使用次数: " + Count;
} else
}
else
{
Content = Path + "\n" + Name + "\n使用次数: " + Count;
}

View File

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

View File

@@ -1,6 +1,5 @@
using GeekDesk.Constant;
using GeekDesk.Util;
using Newtonsoft.Json;
using System;
using System.Collections.ObjectModel;
using System.ComponentModel;
@@ -18,23 +17,11 @@ 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
@@ -106,11 +93,9 @@ namespace GeekDesk.ViewModel
menuEdit = value;
if (menuEdit == Visibility.Visible)
{
IsEdit = true;
NotMenuEdit = Visibility.Collapsed;
} else
{
IsEdit = false;
NotMenuEdit = Visibility.Visible;
}
OnPropertyChanged("MenuEdit");
@@ -143,11 +128,6 @@ 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,6 +1,5 @@
using GeekDesk.Constant;
using GeekDesk.Util;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.ComponentModel;
@@ -130,10 +129,7 @@ namespace GeekDesk.ViewModel
// }
//}
public override String ToString()
{
return JsonConvert.SerializeObject(this);
}
[field: NonSerializedAttribute()]