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

View File

@@ -5,8 +5,8 @@ namespace GeekDesk.Constant
{ {
public enum CommonEnum public enum CommonEnum
{ {
WINDOW_WIDTH = 666, //默认窗体宽度 WINDOW_WIDTH = 950, //默认窗体宽度
WINDOW_HEIGHT = 500, //默认窗体高度 WINDOW_HEIGHT = 650, //默认窗体高度
MENU_CARD_WIDHT = 165, //默认菜单栏宽度 MENU_CARD_WIDHT = 165, //默认菜单栏宽度
IMAGE_WIDTH = 45, //默认图标宽度 IMAGE_WIDTH = 45, //默认图标宽度
IMAGE_HEIGHT = 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 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"); public static Hashtable SYSTEM_ICONS = (Hashtable)ConfigurationManager.GetSection("SystemIcons");

View File

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

View File

@@ -37,8 +37,7 @@ namespace GeekDesk.Control.Other
if (!StringUtil.IsEmpty(IconUrl.Text) && !StringUtil.IsEmpty(JsonUrl.Text)) if (!StringUtil.IsEmpty(IconUrl.Text) && !StringUtil.IsEmpty(JsonUrl.Text))
{ {
IconfontWindow.vm.IsSettingUrl = "true"; IconfontWindow.vm.IsSettingUrl = "true";
} } else
else
{ {
IconfontWindow.vm.IsSettingUrl = "false"; IconfontWindow.vm.IsSettingUrl = "false";
} }

View File

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

View File

@@ -89,10 +89,10 @@ namespace GeekDesk.Control.Other
info.BitmapImage = ImageUtil.GetBitmapIconByPath(ofd.FileName); info.BitmapImage = ImageUtil.GetBitmapIconByPath(ofd.FileName);
CommonCode.SaveAppData(MainWindow.appData); CommonCode.SaveAppData(MainWindow.appData);
} }
} catch (Exception ex) } catch (Exception e1)
{ {
HandyControl.Controls.Growl.WarningGlobal("修改图标失败,已重置为默认图标!"); 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=".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="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" Command="hc:ControlCommands.OpenLink"
CommandParameter="https://github.com/Demo-Liu/GeekDesk" CommandParameter="https://github.com/Demo-Liu/GeekDesk"
Margin="0,0,10,0" Color="#24292F"/> 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" Command="hc:ControlCommands.OpenLink"
CommandParameter="https://gitee.com/demo_liu/GeekDesk" CommandParameter="https://gitee.com/demo_liu/GeekDesk"
Margin="0,0,10,0" Color="#C71D23"/> Margin="0,0,10,0" Color="#C71D23"/>

View File

@@ -112,8 +112,8 @@
/> />
</hc:UniformSpacingPanel> </hc:UniformSpacingPanel>
<hc:UniformSpacingPanel Spacing="10" Margin="10,5,0,0" Grid.ColumnSpan="4"> <hc:UniformSpacingPanel Spacing="10" Margin="10,5,0,0" Grid.ColumnSpan="4">
<TextBlock Text="新建待办:" Width="55"/> <TextBlock Text="新建待办:" Width="55"/>
<hc:TextBox HorizontalAlignment="Left" <hc:TextBox HorizontalAlignment="Left"
Tag="ToDo" Tag="ToDo"
VerticalAlignment="Top" VerticalAlignment="Top"
IsReadOnly="True" IsReadOnly="True"
@@ -123,7 +123,7 @@
KeyDown="HotKeyDown" KeyDown="HotKeyDown"
KeyUp="HotKeyUp" KeyUp="HotKeyUp"
/> />
</hc:UniformSpacingPanel> </hc:UniformSpacingPanel>
</StackPanel> </StackPanel>
</Grid> </Grid>

View File

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

View File

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

View File

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

View File

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

View File

@@ -104,8 +104,7 @@
hc:Poptip.Content="{Binding Content}" hc:Poptip.Content="{Binding Content}"
hc:Poptip.Placement="BottomLeft" hc:Poptip.Placement="BottomLeft"
Background="#00FFFFFF" Background="#00FFFFFF"
MouseLeftButtonDown="Icon_MouseLeftButtonDown" MouseLeftButtonDown="IconClick"
MouseLeftButtonUp="Icon_MouseLeftButtonUp"
MouseEnter="StackPanel_MouseEnter" MouseEnter="StackPanel_MouseEnter"
MouseLeave="StackPanel_MouseLeave" MouseLeave="StackPanel_MouseLeave"
> >

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>
/// 图标点击事件 /// 图标点击事件
/// </summary> /// </summary>
@@ -95,8 +78,7 @@ namespace GeekDesk.Control.UserControls.PannelCard
{ {
StartIconApp(icon, IconStartType.DEFAULT_STARTUP); 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; IconInfo icon = (IconInfo)((SimpleStackPanel)sender).Tag;
if (icon.AdminStartUp) if (icon.AdminStartUp)
@@ -137,98 +119,97 @@ namespace GeekDesk.Control.UserControls.PannelCard
{ {
try 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; StartSystemApp(startArg, type);
} else
if (startArg != null && Constants.SYSTEM_ICONS.ContainsKey(startArg)) {
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 (!File.Exists(icon.Path) && !Directory.Exists(icon.Path))
if (!StringUtil.IsEmpty(startArg))
{ {
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)) case IconStartType.ADMIN_STARTUP:
{ //p.StartInfo.Arguments = "1";//启动参数
HandyControl.Controls.Growl.WarningGlobal("程序启动失败(文件路径不存在或已删除)!"); p.StartInfo.Verb = "runas";
return; p.StartInfo.CreateNoWindow = false; //设置显示窗口
} p.StartInfo.UseShellExecute = false;//不使用操作系统外壳程序启动进程
p.StartInfo.WorkingDirectory = icon.Path.Substring(0, icon.Path.LastIndexOf("\\")); p.StartInfo.ErrorDialog = false;
switch (type) if (appData.AppConfig.AppHideType == AppHideType.START_EXE)
{
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) //如果开启了贴边隐藏 则窗体不贴边才隐藏窗口
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(); 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(); MainWindow.HideApp();
} }
} }
else
{
MainWindow.HideApp();
}
} }
p.Start();
} }
p.Start();
} }
icon.Count++; icon.Count++;
} }
catch (Exception e) catch (Exception e)
@@ -274,8 +255,7 @@ namespace GeekDesk.Control.UserControls.PannelCard
if (type == IconStartType.ADMIN_STARTUP) if (type == IconStartType.ADMIN_STARTUP)
{ {
Process.Start("mstsc", "-admin"); Process.Start("mstsc", "-admin");
} } else
else
{ {
Process.Start("mstsc"); Process.Start("mstsc");
} }
@@ -286,21 +266,15 @@ namespace GeekDesk.Control.UserControls.PannelCard
case "CMD": case "CMD":
if (type == IconStartType.ADMIN_STARTUP) if (type == IconStartType.ADMIN_STARTUP)
{ {
using (Process process = new Process()) Process process = new Process();
{ process.StartInfo.FileName = "cmd.exe";
process.StartInfo.FileName = "cmd.exe"; process.StartInfo.Verb = "runas";
process.StartInfo.Verb = "runas"; process.Start();
process.Start(); } else
}
}
else
{ {
Process.Start("cmd"); Process.Start("cmd");
} }
break; break;
case "Services":
Process.Start("services.msc");
break;
} }
//如果开启了贴边隐藏 则窗体不贴边才隐藏窗口 //如果开启了贴边隐藏 则窗体不贴边才隐藏窗口
if (appData.AppConfig.MarginHide) if (appData.AppConfig.MarginHide)
@@ -400,7 +374,7 @@ namespace GeekDesk.Control.UserControls.PannelCard
Panel sp = sender as Panel; Panel sp = sender as Panel;
DependencyObject dos = sp.Parent; DependencyObject dos = sp.Parent;
Image img = sp.Children[0] as Image; Image img = sp.Children[0] as Image;
@@ -454,8 +428,7 @@ namespace GeekDesk.Control.UserControls.PannelCard
ThreadStart ts = new ThreadStart(crs.Remove); ThreadStart ts = new ThreadStart(crs.Remove);
System.Threading.Thread t = new System.Threading.Thread(ts); System.Threading.Thread t = new System.Threading.Thread(ts);
t.Start(); t.Start();
} } else
else
{ {
img.BeginAnimation(WidthProperty, null); img.BeginAnimation(WidthProperty, null);
img.BeginAnimation(HeightProperty, null); img.BeginAnimation(HeightProperty, null);
@@ -538,6 +511,5 @@ namespace GeekDesk.Control.UserControls.PannelCard
{ {
SystemItemWindow.Show(); SystemItemWindow.Show();
} }
} }
} }

View File

@@ -9,7 +9,7 @@
Background="Transparent" Background="Transparent"
> >
<hc:SimplePanel Margin="20" Background="Transparent"> <hc:SimplePanel Margin="20" Background="Transparent">
<Grid Background="Transparent"> <Grid Background="Transparent">
<DataGrid x:Name="BacklogList" <DataGrid x:Name="BacklogList"
HeadersVisibility="All" HeadersVisibility="All"

View File

@@ -84,20 +84,5 @@ namespace GeekDesk.Control.UserControls.Backlog
Menu.IsOpen = true; 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) if (e.Key == Key.Escape)
{ {
this.DataContext = null;
this.Close(); this.Close();
} }
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -38,7 +38,7 @@
<DropShadowEffect BlurRadius="30" Direction="-90" Color="Gray" <DropShadowEffect BlurRadius="30" Direction="-90" Color="Gray"
RenderingBias="Quality" ShadowDepth="2"/> RenderingBias="Quality" ShadowDepth="2"/>
</Window.Effect> </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" Background="AliceBlue" LostFocus="App_LostFocus"
Opacity="{Binding AppConfig.PannelOpacity, Mode=TwoWay, Converter={StaticResource OpcityConvert}}" Opacity="{Binding AppConfig.PannelOpacity, Mode=TwoWay, Converter={StaticResource OpcityConvert}}"
VirtualizingPanel.VirtualizationMode="Recycling" VirtualizingPanel.IsVirtualizing="True" VirtualizingPanel.IsContainerVirtualizable="True" VirtualizingPanel.VirtualizationMode="Recycling" VirtualizingPanel.IsVirtualizing="True" VirtualizingPanel.IsContainerVirtualizable="True"

View File

@@ -61,11 +61,10 @@ namespace GeekDesk
/// </summary> /// </summary>
private void LoadData() private void LoadData()
{ {
GC.KeepAlive(appData); // 持活
this.DataContext = appData; this.DataContext = appData;
if (appData.MenuList.Count == 0) 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.Width = appData.AppConfig.WindowWidth;
@@ -84,13 +83,11 @@ namespace GeekDesk
if (appData.AppConfig.AppAnimation) if (appData.AppConfig.AppAnimation)
{ {
this.Opacity = 0; this.Opacity = 0;
} } else
else
{ {
this.Visibility = Visibility.Collapsed; this.Visibility = Visibility.Collapsed;
} }
} } else
else
{ {
ShowApp(); ShowApp();
} }
@@ -162,8 +159,45 @@ 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> /// <summary>
/// 注册新建待办的热键 /// 注册新建待办的热键
/// </summary> /// </summary>
@@ -172,7 +206,7 @@ namespace GeekDesk
try try
{ {
if (appData.AppConfig.ToDoHotkeyModifiers != 0) if (appData.AppConfig.ToDoHotkeyModifiers!=0)
{ {
//加载完毕注册热键 //加载完毕注册热键
toDoHotKeyId = GlobalHotKey.RegisterHotKey(appData.AppConfig.ToDoHotkeyModifiers, appData.AppConfig.ToDoHotkey, () => toDoHotKeyId = GlobalHotKey.RegisterHotKey(appData.AppConfig.ToDoHotkeyModifiers, appData.AppConfig.ToDoHotkey, () =>
@@ -264,8 +298,7 @@ namespace GeekDesk
if (appData.AppConfig.AppAnimation) if (appData.AppConfig.AppAnimation)
{ {
FadeStoryBoard(0, (int)CommonEnum.WINDOW_ANIMATION_TIME, Visibility.Collapsed); FadeStoryBoard(0, (int)CommonEnum.WINDOW_ANIMATION_TIME, Visibility.Collapsed);
} } else
else
{ {
this.Visibility = Visibility.Collapsed; this.Visibility = Visibility.Collapsed;
} }
@@ -316,45 +349,6 @@ namespace GeekDesk
FadeStoryBoard(0, (int)CommonEnum.WINDOW_ANIMATION_TIME, Visibility.Collapsed); 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("1.0.*")]
[assembly: AssemblyVersion("2.4.1.2")] [assembly: AssemblyVersion("2.4.1.0")]
[assembly: AssemblyFileVersion("2.4.1.2")] [assembly: AssemblyFileVersion("2.4.1.0")]

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

View File

@@ -1,4 +1,5 @@
using GeekDesk.Control.UserControls.Config; using GeekDesk.Control.UserControls.Config;
using GeekDesk.Util;
using GeekDesk.ViewModel; using GeekDesk.ViewModel;
using Gma.System.MouseKeyHook; using Gma.System.MouseKeyHook;
using System; using System;
@@ -15,7 +16,7 @@ namespace GeekDesk.Thread
public class MouseHookThread public class MouseHookThread
{ {
private static AppConfig appConfig = MainWindow.appData.AppConfig; private static AppConfig appConfig = MainWindow.appData.AppConfig;
private static IKeyboardMouseEvents m_GlobalHook = Hook.GlobalEvents(); private static IKeyboardMouseEvents m_GlobalHook = null;
private static Dispatcher dispatcher; private static Dispatcher dispatcher;
@@ -23,7 +24,9 @@ namespace GeekDesk.Thread
public static void MiddleHook() public static void MiddleHook()
{ {
//使用dispatcher来单独监听UI线程 防止程序卡顿 //使用dispatcher来单独监听UI线程 防止程序卡顿
if (dispatcher != null) return;
dispatcher = DispatcherBuild.Build(); dispatcher = DispatcherBuild.Build();
m_GlobalHook = Hook.GlobalEvents();
dispatcher.Invoke((Action)(() => dispatcher.Invoke((Action)(() =>
{ {
m_GlobalHook.MouseDownExt += M_GlobalHook_MouseDownExt; m_GlobalHook.MouseDownExt += M_GlobalHook_MouseDownExt;
@@ -32,9 +35,16 @@ namespace GeekDesk.Thread
public static void Dispose() public static void Dispose()
{ {
m_GlobalHook.MouseDownExt -= M_GlobalHook_MouseDownExt; try
m_GlobalHook.Dispose(); {
dispatcher.InvokeShutdown(); m_GlobalHook.MouseDownExt -= M_GlobalHook_MouseDownExt;
m_GlobalHook.Dispose();
m_GlobalHook = null;
dispatcher.InvokeShutdown();
dispatcher = null;
}
catch { }
} }
/// <summary> /// <summary>
@@ -50,7 +60,9 @@ namespace GeekDesk.Thread
{ {
MainWindow.mainWindow.Dispatcher.Invoke((Action)(() => 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(); 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版本更新", "title": "GeekDesk版本更新",
"subTitle": "V2.4.12", "subTitle": "V2.4.10",
"msgTitle": "本次更新内容如下", "msgTitle": "本次更新内容如下",
"msg": "['各位兄弟去给我点个免费Star呗','这是个修复版本,主要修复上个版本的bug','修复图标无法拖动','修复界面遮挡任务栏']", "msg": "['各位兄弟去给我点个免费Star呗','增加添加系统和开始菜单应用功能','增加项目启动参数','优化贴边隐藏动画效果(可能现在并不完美)','增加双击打开功能','其它已知问题修复(如果有人发现)']",
"githubUrl": "https://github.com/Demo-Liu/GeekDesk/releases", "githubUrl": "https://github.com/Demo-Liu/GeekDesk/releases",
"giteeUrl": "https://gitee.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

@@ -36,7 +36,7 @@ namespace GeekDesk.Util
public static BitmapImage GetBitmapImage(string filePath) public static BitmapImage GetBitmapImage(string filePath)
{ {
Icon ico; Icon ico = null;
//选中文件中的图标总数 //选中文件中的图标总数
var iconTotalCount = PrivateExtractIcons(filePath, 0, 0, 0, null, null, 0, 0); var iconTotalCount = PrivateExtractIcons(filePath, 0, 0, 0, null, null, 0, 0);
//用于接收获取到的图标指针 //用于接收获取到的图标指针
@@ -53,18 +53,31 @@ namespace GeekDesk.Util
{ {
ip = hIcons[0]; ip = hIcons[0];
ico = Icon.FromHandle(ip); ico = Icon.FromHandle(ip);
if (IsMinOrTransparent(ico))
{
ico = null;
}
} }
else if (GetBlurExts().Contains(ext)) if (ico == null && GetBlurExts().Contains(ext))
{ {
ico = Icon.ExtractAssociatedIcon(filePath); ico = Icon.ExtractAssociatedIcon(filePath);
if (IsMinOrTransparent(ico))
{
ico = null;
}
} }
else if (ico == null)
{ {
ip = GetJumboIcon(GetIconIndex(filePath)); ip = GetJumboIcon(GetIconIndex(filePath));
ico = Icon.FromHandle(ip); ico = Icon.FromHandle(ip);
} }
Bitmap bmp = ico.ToBitmap(); return IconToBitmapImage(ico, ip);
}
private static BitmapImage IconToBitmapImage(Icon icon, IntPtr iconIP)
{
Bitmap bmp = icon.ToBitmap();
MemoryStream strm = new MemoryStream(); MemoryStream strm = new MemoryStream();
ImageCodecInfo myImageCodecInfo = GetEncoderInfo("image/png"); ImageCodecInfo myImageCodecInfo = GetEncoderInfo("image/png");
@@ -73,19 +86,51 @@ namespace GeekDesk.Util
EncoderParameters myEncoderParameters = new EncoderParameters(1); EncoderParameters myEncoderParameters = new EncoderParameters(1);
myEncoderParameters.Param[0] = myEncoderParameter; myEncoderParameters.Param[0] = myEncoderParameter;
//bmp.Save("d:\\test.png");
bmp.Save(strm, myImageCodecInfo, myEncoderParameters); bmp.Save(strm, myImageCodecInfo, myEncoderParameters);
BitmapImage bmpImage = new BitmapImage(); BitmapImage bmpImage = new BitmapImage();
bmpImage.BeginInit(); bmpImage.BeginInit();
strm.Seek(0, SeekOrigin.Begin); strm.Seek(0, SeekOrigin.Begin);
bmpImage.StreamSource = strm; bmpImage.StreamSource = strm;
bmpImage.EndInit(); bmpImage.EndInit();
if (ip != IntPtr.Zero) if (iconIP != IntPtr.Zero)
{ {
Shell32.DestroyIcon(ip); Shell32.DestroyIcon(iconIP);
} }
return bmpImage.Clone(); 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) private static ImageCodecInfo GetEncoderInfo(String mimeType)
{ {
int j; int j;
@@ -416,7 +461,6 @@ namespace GeekDesk.Util
int iOverlay, int iOverlay,
ref int piIndex); ref int piIndex);
}; };
} }
} }

View File

@@ -27,7 +27,7 @@ namespace GeekDesk.Util
return null; return null;
} }
string path = shortcut.TargetPath; string path = shortcut.TargetPath;
if (path == null || Regex.IsMatch(path, NO_PATH)) if (path==null || Regex.IsMatch(path, NO_PATH))
{ {
path = ParseShortcut(filePath); path = ParseShortcut(filePath);
} }
@@ -79,8 +79,7 @@ namespace GeekDesk.Util
|| !Regex.IsMatch(iconPath, HAVE_ICO)) || !Regex.IsMatch(iconPath, HAVE_ICO))
{ {
return null; return null;
} } else
else
{ {
return iconPath.Split(',')[0]; return iconPath.Split(',')[0];
} }

View File

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

View File

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

View File

@@ -122,9 +122,8 @@ namespace GeekDesk.Util
HideAnimation(windowLeft, screenWidth - Math.Abs(screenLeft) - showMarginWidth, Window.LeftProperty, HideType.RIGHT_HIDE); HideAnimation(windowLeft, screenWidth - Math.Abs(screenLeft) - showMarginWidth, Window.LeftProperty, HideType.RIGHT_HIDE);
return; return;
} }
} } else if (mouseX >= windowLeft && mouseX <= windowLeft + windowWidth
else if (mouseX >= windowLeft && mouseX <= windowLeft + windowWidth && mouseY >= windowTop && mouseY <= windowTop + windowHeight && IS_HIDE)
&& mouseY >= windowTop && mouseY <= windowTop + windowHeight && IS_HIDE)
{ {
//上方显示 //上方显示
if (windowTop <= screenTop - showMarginWidth) if (windowTop <= screenTop - showMarginWidth)
@@ -262,8 +261,7 @@ namespace GeekDesk.Util
if (to == 0D) if (to == 0D)
{ {
time = fadeHideTime; time = fadeHideTime;
} } else
else
{ {
time = fadeShowTime; time = fadeShowTime;
} }

View File

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

View File

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

View File

@@ -21,14 +21,17 @@ namespace GeekDesk.Util
string svgPath = "/GeekDesk;component/Resource/Iconfont/iconfont.js"; string svgPath = "/GeekDesk;component/Resource/Iconfont/iconfont.js";
string jsonPath = "/GeekDesk;component/Resource/Iconfont/iconfont.json"; 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); using (Stream svgStream = Application.GetResourceStream(new Uri(svgPath, UriKind.Relative)).Stream,
string svgJsStr = streamReader.ReadToEnd(); jsonStream = Application.GetResourceStream(new Uri(jsonPath, UriKind.Relative)).Stream)
JObject jo = ReadJson(jsonStream); {
using (StreamReader streamReader = new StreamReader(svgStream))
return GetIconfonts(svgJsStr, jo); {
string svgJsStr = streamReader.ReadToEnd();
JObject jo = ReadJson(jsonStream);
return GetIconfonts(svgJsStr, jo);
}
}
} }
public static List<IconfontInfo> GetIconfonts(string svgJsStr, string jsonStr) 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,8 +121,7 @@ namespace GeekDesk.ViewModel
if (imageWidth == 0) if (imageWidth == 0)
{ {
return (int)CommonEnum.IMAGE_WIDTH; return (int)CommonEnum.IMAGE_WIDTH;
} } else
else
{ {
return imageWidth; return imageWidth;
} }
@@ -397,8 +396,7 @@ namespace GeekDesk.ViewModel
if (blurEffect) if (blurEffect)
{ {
BlurValue = 100; BlurValue = 100;
} } else
else
{ {
BlurValue = 0; BlurValue = 0;
} }
@@ -570,8 +568,7 @@ namespace GeekDesk.ViewModel
bacImgName = "系统默认"; bacImgName = "系统默认";
//Image image = ImageUtil.ByteArrayToImage(Convert.FromBase64String(Constants.DEFAULT_BAC_IMAGE_BASE64)); //Image image = ImageUtil.ByteArrayToImage(Convert.FromBase64String(Constants.DEFAULT_BAC_IMAGE_BASE64));
return ImageUtil.ByteArrToImage(Convert.FromBase64String(Constants.DEFAULT_BAC_IMAGE_BASE64)); return ImageUtil.ByteArrToImage(Convert.FromBase64String(Constants.DEFAULT_BAC_IMAGE_BASE64));
} } else
else
{ {
return ImageUtil.ByteArrToImage(ImageByteArr); return ImageUtil.ByteArrToImage(ImageByteArr);
} }

View File

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

View File

@@ -143,8 +143,7 @@ namespace GeekDesk.ViewModel
if (StringUtil.IsEmpty(Path)) if (StringUtil.IsEmpty(Path))
{ {
Content = Name + "\n使用次数: " + Count; Content = Name + "\n使用次数: " + Count;
} } else
else
{ {
Content = Path + "\n" + Name + "\n使用次数: " + Count; 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.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
@@ -36,5 +37,11 @@ namespace GeekDesk.ViewModel
name = value; name = value;
} }
} }
public override String ToString()
{
return JsonConvert.SerializeObject(this);
}
} }
} }

View File

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

View File

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