Compare commits
23 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
28ebb48983 | ||
|
|
74e36cc68a | ||
|
|
9f60f1be63 | ||
|
|
e9dbc3e5b9 | ||
|
|
e9a3726bb4 | ||
|
|
58c67a0497 | ||
|
|
5ff3f04da6 | ||
|
|
14aa73f504 | ||
|
|
5c10b5f59e | ||
|
|
d092db8b5c | ||
|
|
1125432c41 | ||
|
|
e99eee08ff | ||
|
|
fb26834938 | ||
|
|
e9063a176e | ||
|
|
6038eee680 | ||
|
|
19c8ff9d8d | ||
|
|
e3a85e42fa | ||
|
|
09d3a520b4 | ||
|
|
7f585dd095 | ||
|
|
353acec75e | ||
|
|
8d4201f5ba | ||
|
|
0453cdad66 | ||
|
|
88af8324b9 |
30
App.config
30
App.config
@@ -1,20 +1,21 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<configSections>
|
||||
<section name="SystemIcons" type="System.Configuration.DictionarySectionHandler" />
|
||||
<section
|
||||
name="SystemIcons"
|
||||
type="System.Configuration.DictionarySectionHandler" />
|
||||
</configSections>
|
||||
<SystemIcons>
|
||||
<add key="Calculator" value="计算器" />
|
||||
<add key="Computer" value="此电脑" />
|
||||
<add key="GroupPolicy" value="组策略" />
|
||||
<add key="Network" value="网络连接" />
|
||||
<add key="RecycleBin" value="回收站" />
|
||||
<add key="Registry" value="注册表编辑器" />
|
||||
<add key="Notepad" value="记事本" />
|
||||
<add key="Mstsc" value="远程桌面连接" />
|
||||
<add key="Control" value="控制面板" />
|
||||
<add key="CMD" value="命令行" />
|
||||
<add key="Services" value="服务" />
|
||||
<add key="Calculator" value="计算器"/>
|
||||
<add key="Computer" value="此电脑"/>
|
||||
<add key="GroupPolicy" value="组策略"/>
|
||||
<add key="Network" value="网络连接"/>
|
||||
<add key="RecycleBin" value="回收站"/>
|
||||
<add key="Registry" value="注册表编辑器"/>
|
||||
<add key="Notepad" value="记事本"/>
|
||||
<add key="Mstsc" value="远程桌面连接"/>
|
||||
<add key="Control" value="控制面板"/>
|
||||
<add key="CMD" value="命令行"/>
|
||||
</SystemIcons>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
|
||||
@@ -44,14 +45,15 @@
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
<appSettings>
|
||||
<add key="Version" value="2.4.12" />
|
||||
<add key="Version" value="2.4.10" />
|
||||
<add key="GitHubUrl" value="https://github.com/Demo-Liu/GeekDesk" />
|
||||
<add key="GiteeUrl" value="https://gitee.com/demo_liu/GeekDesk/tree/master" />
|
||||
<add key="GitHubUpdateUrl" value="https://demo-liu.github.io/GeekDesk/Update.json" />
|
||||
<add key="GiteeUpdateUrl" value="https://demo-liu.github.io/GeekDesk/Update.json" />
|
||||
<add key="ClientSettingsProvider.ServiceUri" value="" />
|
||||
<add key="CustomIconTeachUrl" value="https://mp.weixin.qq.com/s/LxoHAekho9HBVl4FRw_Law" />
|
||||
<add key="CustomIconTeachUrl" value="https://mp.weixin.qq.com/s/LxoHAekho9HBVl4FRw_Law"/>
|
||||
</appSettings>
|
||||
|
||||
<system.web>
|
||||
<membership defaultProvider="ClientAuthenticationMembershipProvider">
|
||||
<providers>
|
||||
|
||||
@@ -5,8 +5,8 @@ namespace GeekDesk.Constant
|
||||
{
|
||||
public enum CommonEnum
|
||||
{
|
||||
WINDOW_WIDTH = 666, //默认窗体宽度
|
||||
WINDOW_HEIGHT = 500, //默认窗体高度
|
||||
WINDOW_WIDTH = 950, //默认窗体宽度
|
||||
WINDOW_HEIGHT = 650, //默认窗体高度
|
||||
MENU_CARD_WIDHT = 165, //默认菜单栏宽度
|
||||
IMAGE_WIDTH = 45, //默认图标宽度
|
||||
IMAGE_HEIGHT = 45, //默认图标高度
|
||||
|
||||
@@ -26,6 +26,8 @@ namespace GeekDesk.Constant
|
||||
|
||||
public static string ERROR_FILE_PATH = APP_DIR + "Error.log";
|
||||
|
||||
//系统图标路径
|
||||
public static string SYSTEM_ICON_PATH = "GeekDesk.Resource.Image.SystemIcon.*";
|
||||
//系统图标
|
||||
public static Hashtable SYSTEM_ICONS = (Hashtable)ConfigurationManager.GetSection("SystemIcons");
|
||||
|
||||
|
||||
@@ -64,8 +64,7 @@ namespace GeekDesk.Control.Other
|
||||
{
|
||||
Growl.SuccessGlobal("下次任务将在 " + minutes + " 分钟后提醒您!");
|
||||
}
|
||||
}
|
||||
else
|
||||
} else
|
||||
{
|
||||
appData.ToDoList.Remove(info); //执行任务删除
|
||||
appData.HiToDoList.Add(info); //添加历史任务
|
||||
@@ -123,7 +122,7 @@ namespace GeekDesk.Control.Other
|
||||
ToDoInfo info = this.DataContext as ToDoInfo;
|
||||
int time = int.Parse(DelayTime.Text);
|
||||
string type = DelayType.Text;
|
||||
switch (type)
|
||||
switch(type)
|
||||
{
|
||||
case "分":
|
||||
info.ExeTime = DateTime.Now.AddMinutes(time).ToString("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
@@ -37,8 +37,7 @@ namespace GeekDesk.Control.Other
|
||||
if (!StringUtil.IsEmpty(IconUrl.Text) && !StringUtil.IsEmpty(JsonUrl.Text))
|
||||
{
|
||||
IconfontWindow.vm.IsSettingUrl = "true";
|
||||
}
|
||||
else
|
||||
} else
|
||||
{
|
||||
IconfontWindow.vm.IsSettingUrl = "false";
|
||||
}
|
||||
|
||||
@@ -75,8 +75,7 @@ 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, "修改图标失败!");
|
||||
|
||||
@@ -89,10 +89,10 @@ namespace GeekDesk.Control.Other
|
||||
info.BitmapImage = ImageUtil.GetBitmapIconByPath(ofd.FileName);
|
||||
CommonCode.SaveAppData(MainWindow.appData);
|
||||
}
|
||||
} catch (Exception ex)
|
||||
} catch (Exception e1)
|
||||
{
|
||||
HandyControl.Controls.Growl.WarningGlobal("修改图标失败,已重置为默认图标!");
|
||||
LogUtil.WriteErrorLog(ex, "修改图标失败!");
|
||||
LogUtil.WriteErrorLog(e1, "修改图标失败!");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -22,11 +22,11 @@
|
||||
<hc:Shield Subject=".net" Status=">=4.72" Margin="0,0,10,0" Color="#1182c3"/>
|
||||
<hc:Shield Subject="IDE" Status="VS2019" Margin="0,0,10,0" Color="#1182c3"/>
|
||||
|
||||
<hc:Shield Subject="GitHub" Visibility="Visible" Status="Demo-liu"
|
||||
<hc:Shield Subject="GitHub" Visibility="Visible" Status="Star"
|
||||
Command="hc:ControlCommands.OpenLink"
|
||||
CommandParameter="https://github.com/Demo-Liu/GeekDesk"
|
||||
Margin="0,0,10,0" Color="#24292F"/>
|
||||
<hc:Shield Subject="Gitee" Visibility="Visible" Status="Demo-liu"
|
||||
<hc:Shield Subject="Gitee" Visibility="Visible" Status="Star"
|
||||
Command="hc:ControlCommands.OpenLink"
|
||||
CommandParameter="https://gitee.com/demo_liu/GeekDesk"
|
||||
Margin="0,0,10,0" Color="#C71D23"/>
|
||||
|
||||
@@ -62,7 +62,7 @@ namespace GeekDesk.Control.UserControls.Config
|
||||
main = true;
|
||||
}
|
||||
|
||||
if (prevKeyTemp == Key.None || prevKeyTemp != downKey)
|
||||
if (prevKeyTemp == Key.None || prevKeyTemp!=downKey)
|
||||
{
|
||||
if (hotkeyFinished)
|
||||
{
|
||||
@@ -71,8 +71,7 @@ namespace GeekDesk.Control.UserControls.Config
|
||||
appConfig.Hotkey = 0;
|
||||
appConfig.HotkeyStr = "";
|
||||
appConfig.HotkeyModifiers = 0;
|
||||
}
|
||||
else
|
||||
} else
|
||||
{
|
||||
appConfig.ToDoHotkey = 0;
|
||||
appConfig.ToDoHotkeyStr = "";
|
||||
@@ -91,8 +90,7 @@ namespace GeekDesk.Control.UserControls.Config
|
||||
{
|
||||
appConfig.HotkeyStr = GetKeyName(downKey);
|
||||
appConfig.HotkeyModifiers = GetModifierKeys(downKey);
|
||||
}
|
||||
else
|
||||
} else
|
||||
{
|
||||
appConfig.ToDoHotkeyStr = GetKeyName(downKey);
|
||||
appConfig.ToDoHotkeyModifiers = GetModifierKeys(downKey);
|
||||
@@ -113,8 +111,7 @@ namespace GeekDesk.Control.UserControls.Config
|
||||
{
|
||||
appConfig.Hotkey = downKey;
|
||||
appConfig.HotkeyStr += downKey.ToString();
|
||||
}
|
||||
else
|
||||
} else
|
||||
{
|
||||
appConfig.ToDoHotkey = downKey;
|
||||
appConfig.ToDoHotkeyStr += downKey.ToString();
|
||||
@@ -128,8 +125,7 @@ namespace GeekDesk.Control.UserControls.Config
|
||||
{
|
||||
appConfig.HotkeyStr += GetKeyName(downKey);
|
||||
appConfig.HotkeyModifiers |= GetModifierKeys(downKey);
|
||||
}
|
||||
else
|
||||
} else
|
||||
{
|
||||
appConfig.ToDoHotkeyStr += GetKeyName(downKey);
|
||||
appConfig.ToDoHotkeyModifiers |= GetModifierKeys(downKey);
|
||||
@@ -147,8 +143,7 @@ namespace GeekDesk.Control.UserControls.Config
|
||||
if (key == Key.LeftCtrl || key == Key.RightCtrl)
|
||||
{
|
||||
return "Ctrl + ";
|
||||
}
|
||||
else if (key == Key.LWin || key == Key.RWin)
|
||||
} else if (key == Key.LWin || key == Key.RWin)
|
||||
{
|
||||
return "Win + ";
|
||||
}
|
||||
@@ -200,7 +195,7 @@ namespace GeekDesk.Control.UserControls.Config
|
||||
{
|
||||
main = true;
|
||||
}
|
||||
lock (this)
|
||||
lock(this)
|
||||
{
|
||||
bool allKeyUp = true;
|
||||
//判断所有键是否都松开
|
||||
@@ -226,8 +221,7 @@ namespace GeekDesk.Control.UserControls.Config
|
||||
GlobalHotKey.Dispose(MainWindow.hotKeyId);
|
||||
}
|
||||
MainWindow.RegisterHotKey(false);
|
||||
}
|
||||
else
|
||||
} else
|
||||
{
|
||||
if (MainWindow.toDoHotKeyId != -1)
|
||||
{
|
||||
@@ -260,8 +254,7 @@ namespace GeekDesk.Control.UserControls.Config
|
||||
if (appConfig.MarginHide)
|
||||
{
|
||||
MarginHide.StartHide();
|
||||
}
|
||||
else
|
||||
} else
|
||||
{
|
||||
MarginHide.StopHide();
|
||||
}
|
||||
@@ -288,8 +281,7 @@ namespace GeekDesk.Control.UserControls.Config
|
||||
if (appConfig.MouseMiddleShow)
|
||||
{
|
||||
MouseHookThread.MiddleHook();
|
||||
}
|
||||
else
|
||||
} else
|
||||
{
|
||||
MouseHookThread.Dispose();
|
||||
}
|
||||
|
||||
@@ -53,10 +53,10 @@ namespace GeekDesk.Control.UserControls.Config
|
||||
appConfig.BacImgName = ofd.FileName;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
catch (Exception e1)
|
||||
{
|
||||
LogUtil.WriteErrorLog(ex, "修改背景失败,已重置为默认背景!");
|
||||
HandyControl.Controls.Growl.WarningGlobal("修改背景失败,已重置为默认背景!");
|
||||
LogUtil.WriteErrorLog(e1, "修改背景失败!");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -70,10 +70,10 @@ namespace GeekDesk.Control.UserControls.Config
|
||||
appConfig.BitmapImage = ImageUtil.Base64ToBitmapImage(Constants.DEFAULT_BAC_IMAGE_BASE64);
|
||||
appConfig.BacImgName = "系统默认";
|
||||
}
|
||||
catch (Exception ex)
|
||||
catch (Exception e1)
|
||||
{
|
||||
LogUtil.WriteErrorLog(ex, "修改背景失败2,已重置为默认背景!");
|
||||
HandyControl.Controls.Growl.WarningGlobal("修改背景失败,已重置为默认背景!");
|
||||
LogUtil.WriteErrorLog(e1, "修改默认背景失败!");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -44,13 +44,24 @@
|
||||
</BeginStoryboard>
|
||||
</MultiTrigger.ExitActions>
|
||||
</MultiTrigger>
|
||||
<!--<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="Background" Value="#FFE4DBDB"/>
|
||||
</Trigger>-->
|
||||
<Trigger Property="IsSelected" Value="true">
|
||||
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="Background" Value="#FFECECEC"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsSelected" Value="True">
|
||||
<Setter Property="Background" Value="#FFECECEC"/>
|
||||
<Setter Property="Foreground" Value="Black"/>
|
||||
</Trigger>
|
||||
|
||||
<MultiDataTrigger>
|
||||
<MultiDataTrigger.Conditions>
|
||||
<Condition Binding="{Binding IsEdit}" Value="True"/>
|
||||
</MultiDataTrigger.Conditions>
|
||||
<MultiDataTrigger.Setters>
|
||||
<Setter Property="Background" Value="Transparent"/>
|
||||
</MultiDataTrigger.Setters>
|
||||
</MultiDataTrigger>
|
||||
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
<cvt:MenuWidthConvert x:Key="MenuWidthConvert"/>
|
||||
@@ -77,6 +88,7 @@
|
||||
</hc:Card.ContextMenu>
|
||||
<WrapPanel Orientation="Horizontal">
|
||||
<ListBox x:Name="MenuListBox"
|
||||
Padding="2,3,0,2"
|
||||
ItemsSource="{Binding MenuList}"
|
||||
Tag="{Binding AppConfig.MenuCardWidth}"
|
||||
BorderThickness="0" Foreground="{x:Null}"
|
||||
@@ -111,17 +123,18 @@
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel MouseLeftButtonDown="MenuClick" MouseRightButtonDown="MenuClick" Tag="{Binding}">
|
||||
<hc:TextBox Text="{Binding Path=MenuName, Mode=TwoWay}"
|
||||
<TextBox Text="{Binding Path=MenuName, Mode=TwoWay}"
|
||||
HorizontalAlignment="Left"
|
||||
Width="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type ListBox},AncestorLevel=1},Path=Tag, Mode=TwoWay, Converter={StaticResource MenuWidthConvert}, ConverterParameter=35}"
|
||||
FontSize="16"
|
||||
Height="25"
|
||||
Height="28"
|
||||
VerticalAlignment="Center"
|
||||
TextAlignment="Left"
|
||||
LostFocus="LostFocusOrEnterDown"
|
||||
KeyDown="LostFocusOrEnterDown"
|
||||
Tag="{Binding}"
|
||||
Margin="2"
|
||||
Padding="2"
|
||||
BorderThickness="0"
|
||||
IsVisibleChanged="MenuEditWhenVisibilityChanged"
|
||||
Visibility="{Binding MenuEdit}"/>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
|
||||
@@ -204,6 +204,7 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
||||
|
||||
private void menus_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
appData.AppConfig.SelectedMenuIcons = null;
|
||||
//设置对应菜单的图标列表
|
||||
if (MenuListBox.SelectedIndex == -1)
|
||||
{
|
||||
|
||||
@@ -104,8 +104,7 @@
|
||||
hc:Poptip.Content="{Binding Content}"
|
||||
hc:Poptip.Placement="BottomLeft"
|
||||
Background="#00FFFFFF"
|
||||
MouseLeftButtonDown="Icon_MouseLeftButtonDown"
|
||||
MouseLeftButtonUp="Icon_MouseLeftButtonUp"
|
||||
MouseLeftButtonDown="IconClick"
|
||||
MouseEnter="StackPanel_MouseEnter"
|
||||
MouseLeave="StackPanel_MouseLeave"
|
||||
>
|
||||
|
||||
@@ -60,23 +60,6 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
||||
|
||||
|
||||
|
||||
|
||||
private void Icon_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
if (appData.AppConfig.DoubleOpen)
|
||||
{
|
||||
IconClick(sender, e);
|
||||
}
|
||||
}
|
||||
|
||||
private void Icon_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
if (!appData.AppConfig.DoubleOpen)
|
||||
{
|
||||
IconClick(sender, e);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 图标点击事件
|
||||
/// </summary>
|
||||
@@ -95,8 +78,7 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
||||
{
|
||||
StartIconApp(icon, IconStartType.DEFAULT_STARTUP);
|
||||
}
|
||||
}
|
||||
else if (!appData.AppConfig.DoubleOpen && e.ClickCount == 1)
|
||||
} else if (!appData.AppConfig.DoubleOpen && e.ClickCount == 1)
|
||||
{
|
||||
IconInfo icon = (IconInfo)((SimpleStackPanel)sender).Tag;
|
||||
if (icon.AdminStartUp)
|
||||
@@ -137,15 +119,14 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
||||
{
|
||||
try
|
||||
{
|
||||
using (Process p = new Process())
|
||||
{
|
||||
Process p = new Process();
|
||||
|
||||
string startArg = icon.StartArg;
|
||||
|
||||
if (startArg != null && Constants.SYSTEM_ICONS.ContainsKey(startArg))
|
||||
if (startArg!=null && Constants.SYSTEM_ICONS.ContainsKey(startArg))
|
||||
{
|
||||
StartSystemApp(startArg, type);
|
||||
}
|
||||
else
|
||||
} else
|
||||
{
|
||||
p.StartInfo.FileName = icon.Path;
|
||||
if (!StringUtil.IsEmpty(startArg))
|
||||
@@ -228,7 +209,7 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
||||
}
|
||||
p.Start();
|
||||
}
|
||||
}
|
||||
|
||||
icon.Count++;
|
||||
}
|
||||
catch (Exception e)
|
||||
@@ -274,8 +255,7 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
||||
if (type == IconStartType.ADMIN_STARTUP)
|
||||
{
|
||||
Process.Start("mstsc", "-admin");
|
||||
}
|
||||
else
|
||||
} else
|
||||
{
|
||||
Process.Start("mstsc");
|
||||
}
|
||||
@@ -286,21 +266,15 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
||||
case "CMD":
|
||||
if (type == IconStartType.ADMIN_STARTUP)
|
||||
{
|
||||
using (Process process = new Process())
|
||||
{
|
||||
Process process = new Process();
|
||||
process.StartInfo.FileName = "cmd.exe";
|
||||
process.StartInfo.Verb = "runas";
|
||||
process.Start();
|
||||
}
|
||||
}
|
||||
else
|
||||
} else
|
||||
{
|
||||
Process.Start("cmd");
|
||||
}
|
||||
break;
|
||||
case "Services":
|
||||
Process.Start("services.msc");
|
||||
break;
|
||||
}
|
||||
//如果开启了贴边隐藏 则窗体不贴边才隐藏窗口
|
||||
if (appData.AppConfig.MarginHide)
|
||||
@@ -454,8 +428,7 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
||||
ThreadStart ts = new ThreadStart(crs.Remove);
|
||||
System.Threading.Thread t = new System.Threading.Thread(ts);
|
||||
t.Start();
|
||||
}
|
||||
else
|
||||
} else
|
||||
{
|
||||
img.BeginAnimation(WidthProperty, null);
|
||||
img.BeginAnimation(HeightProperty, null);
|
||||
@@ -538,6 +511,5 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
||||
{
|
||||
SystemItemWindow.Show();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -84,20 +84,5 @@ namespace GeekDesk.Control.UserControls.Backlog
|
||||
Menu.IsOpen = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 选中时颜色变化
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void DataGridRow_Selected(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Color c = Color.FromRgb(91, 192, 222);
|
||||
SolidColorBrush b = new SolidColorBrush
|
||||
{
|
||||
Color = c,
|
||||
Opacity = 0.9
|
||||
};
|
||||
((DataGridRow)sender).Background = b;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -95,7 +95,6 @@ namespace GeekDesk.Control.Windows
|
||||
{
|
||||
if (e.Key == Key.Escape)
|
||||
{
|
||||
this.DataContext = null;
|
||||
this.Close();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,7 +57,6 @@ namespace GeekDesk.Control.Windows
|
||||
|
||||
private void Close_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
this.DataContext = null;
|
||||
this.Close();
|
||||
}
|
||||
|
||||
@@ -74,15 +73,13 @@ namespace GeekDesk.Control.Windows
|
||||
LoadingEle.Visibility = Visibility.Visible;
|
||||
CustomIcon.Visibility = Visibility.Collapsed;
|
||||
HandyControl.Controls.Dialog.Show(new CustomIconUrlDialog(appConfig), "IconUrlDialog");
|
||||
}
|
||||
else
|
||||
} else
|
||||
{
|
||||
if (customIcons == null)
|
||||
{
|
||||
vm.Iconfonts = null;
|
||||
LoadingOnlineIcon();
|
||||
}
|
||||
else
|
||||
} else
|
||||
{
|
||||
vm.Iconfonts = customIcons;
|
||||
LoadingEle.Visibility = Visibility.Collapsed;
|
||||
@@ -124,7 +121,6 @@ namespace GeekDesk.Control.Windows
|
||||
}
|
||||
break;
|
||||
}
|
||||
this.DataContext = null;
|
||||
this.Close();
|
||||
}
|
||||
|
||||
@@ -152,8 +148,7 @@ namespace GeekDesk.Control.Windows
|
||||
if (CheckSettingUrl.Text == "true")
|
||||
{
|
||||
LoadingOnlineIcon();
|
||||
}
|
||||
else
|
||||
} else
|
||||
{
|
||||
LoadingEle.IsRunning = true;
|
||||
CustomIcon.Visibility = Visibility.Collapsed;
|
||||
@@ -184,7 +179,6 @@ namespace GeekDesk.Control.Windows
|
||||
{
|
||||
if (e.Key == Key.Escape)
|
||||
{
|
||||
this.DataContext = null;
|
||||
this.Close();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,9 +29,9 @@ namespace GeekDesk.Control.Windows
|
||||
{
|
||||
private static AppConfig appConfig = MainWindow.appData.AppConfig;
|
||||
private static SystemItemViewModel vm;
|
||||
private List<IconInfo> systemIcons;
|
||||
private List<IconInfo> startMenuIcons;
|
||||
private List<IconInfo> storeIcons;
|
||||
private static List<IconInfo> systemIcons;
|
||||
private static List<IconInfo> startMenuIcons;
|
||||
private static List<IconInfo> storeIcons;
|
||||
|
||||
private SystemItemWindow()
|
||||
{
|
||||
@@ -56,7 +56,6 @@ namespace GeekDesk.Control.Windows
|
||||
|
||||
private void Close_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
this.DataContext = null;
|
||||
this.Close();
|
||||
}
|
||||
|
||||
@@ -150,24 +149,13 @@ namespace GeekDesk.Control.Windows
|
||||
/// </summary>
|
||||
/// <param name="path"></param>
|
||||
/// <param name="listInfos"></param>
|
||||
private void GetInfos(string filePath, List<IconInfo> listInfos)
|
||||
private void GetInfos(string path, List<IconInfo> listInfos)
|
||||
{
|
||||
DirectoryInfo di = new DirectoryInfo(filePath);
|
||||
string[] filePaths = Directory.GetFiles(filePath);
|
||||
string[] dirPaths = Directory.GetDirectories(filePath);
|
||||
|
||||
string[] paths = new string[filePaths.Length + dirPaths.Length];
|
||||
filePaths.CopyTo(paths, 0);
|
||||
if (filePaths == null || filePaths.Length == 0)
|
||||
{
|
||||
dirPaths.CopyTo(paths, 0);
|
||||
} else
|
||||
{
|
||||
dirPaths.CopyTo(paths, filePaths.Length - 1);
|
||||
}
|
||||
|
||||
foreach (string path in paths)
|
||||
DirectoryInfo di = new DirectoryInfo(path);
|
||||
FileSystemInfo[] fileInfoArr = di.GetFileSystemInfos();
|
||||
foreach(FileSystemInfo fi in fileInfoArr)
|
||||
{
|
||||
path = fi.FullName;
|
||||
if (File.Exists(path))
|
||||
{
|
||||
string ext = Path.GetExtension(path).ToLower();
|
||||
@@ -190,13 +178,6 @@ namespace GeekDesk.Control.Windows
|
||||
GetInfos(path, listInfos);
|
||||
}
|
||||
}
|
||||
|
||||
//FileSystemInfo[] fileInfoArr = di.GetFileSystemInfos();
|
||||
//foreach(FileSystemInfo fi in fileInfoArr)
|
||||
//{
|
||||
// string path = fi.FullName;
|
||||
|
||||
//}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -289,7 +270,6 @@ namespace GeekDesk.Control.Windows
|
||||
{
|
||||
if (e.Key == Key.Escape)
|
||||
{
|
||||
this.DataContext = null;
|
||||
this.Close();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,7 +30,6 @@
|
||||
<Border.Resources>
|
||||
<Style x:Key="LeftTB" TargetType="TextBlock" BasedOn="{StaticResource TextBlockBaseStyle}">
|
||||
<Setter Property="Width" Value="67"/>
|
||||
<Setter Property="Margin" Value="0,5,0,0"/>
|
||||
<Setter Property="HorizontalAlignment" Value="Left"/>
|
||||
<Setter Property="VerticalAlignment" Value="Center"/>
|
||||
<Setter Property="TextAlignment" Value="Center"/>
|
||||
@@ -68,15 +67,13 @@
|
||||
IsChecked="{Binding ExecType, Mode=OneWay, Converter={StaticResource TodoTaskExecConvert}, ConverterParameter=2}"/>
|
||||
</hc:UniformSpacingPanel>
|
||||
|
||||
<hc:UniformSpacingPanel x:Name="SetTimePanel" Height="30" Visibility="Visible" Spacing="10" Grid.ColumnSpan="4" Margin="0,10,0,0">
|
||||
<WrapPanel VerticalAlignment="Center">
|
||||
<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"/>
|
||||
</WrapPanel>
|
||||
<hc:DateTimePicker x:Name="ExeTime" Text="{Binding ExeTime, Mode=OneWay}" ErrorStr="Error!" Width="200" Margin="1.6,0,0,0"/>
|
||||
<TextBlock Text="*" Foreground="Red" Margin="-10,0,0,0"/>
|
||||
<hc:DateTimePicker x:Name="ExeTime" Text="{Binding ExeTime, Mode=OneWay}" ErrorStr="Error!" Width="200" Margin="-5.2,0,0,0"/>
|
||||
</hc:UniformSpacingPanel>
|
||||
|
||||
<hc:UniformSpacingPanel x:Name="CronPanel" Height="30" Visibility="Collapsed" Spacing="10" Grid.ColumnSpan="4" Margin="0,10,0,0">
|
||||
<hc:UniformSpacingPanel x:Name="CronPanel" Visibility="Collapsed" Spacing="10" Grid.ColumnSpan="4" Margin="0,10,0,0">
|
||||
<WrapPanel VerticalAlignment="Center">
|
||||
<TextBlock Text="CRON:" Style="{StaticResource LeftTB}"/>
|
||||
<TextBlock Text="*" Foreground="Red" />
|
||||
@@ -87,10 +84,8 @@
|
||||
|
||||
|
||||
<hc:UniformSpacingPanel Spacing="10" Grid.ColumnSpan="4" Margin="0,10,0,0">
|
||||
<WrapPanel VerticalAlignment="Center">
|
||||
<TextBlock Text="完成时间:" Style="{StaticResource LeftTB}"/>
|
||||
</WrapPanel>
|
||||
<TextBlock x:Name="DoneTime" VerticalAlignment="Center" Margin="5,6,0,0" Text="{Binding DoneTime, Mode=OneWay}" Width="200"/>
|
||||
<TextBlock x:Name="DoneTime" Text="{Binding DoneTime, Mode=OneWay}" Width="200"/>
|
||||
</hc:UniformSpacingPanel>
|
||||
|
||||
|
||||
|
||||
@@ -151,14 +151,7 @@ namespace GeekDesk.Control.Windows
|
||||
};
|
||||
if (windowType != NEW_TODO)
|
||||
{
|
||||
ToDoInfo tdi = this.DataContext as ToDoInfo;
|
||||
if (appData.HiToDoList.Contains(tdi))
|
||||
{
|
||||
appData.HiToDoList.Remove(tdi);
|
||||
} else if (appData.ToDoList.Contains(tdi))
|
||||
{
|
||||
appData.ToDoList.Remove(tdi);
|
||||
}
|
||||
appData.HiToDoList.Remove(this.DataContext as ToDoInfo);
|
||||
}
|
||||
appData.ToDoList.Add(info);
|
||||
|
||||
@@ -254,7 +247,6 @@ namespace GeekDesk.Control.Windows
|
||||
{
|
||||
if (e.Key == Key.Escape)
|
||||
{
|
||||
this.DataContext = null;
|
||||
this.Close();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -102,7 +102,6 @@ namespace GeekDesk.Control.Windows
|
||||
{
|
||||
if (e.Key == Key.Escape)
|
||||
{
|
||||
this.DataContext = null;
|
||||
this.Close();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,9 +38,9 @@ namespace GeekDesk.Control.Windows
|
||||
InitializeComponent();
|
||||
DataHandle(jo);
|
||||
}
|
||||
catch (Exception)
|
||||
catch (Exception e)
|
||||
{
|
||||
|
||||
LogUtil.WriteErrorLog(e, "更新信息格式化失败!");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -111,7 +111,6 @@ namespace GeekDesk.Control.Windows
|
||||
{
|
||||
if (e.Key == Key.Escape)
|
||||
{
|
||||
this.DataContext = null;
|
||||
this.Close();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
<GenerateSerializationAssemblies>Auto</GenerateSerializationAssemblies>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
@@ -221,6 +222,7 @@
|
||||
<Compile Include="Util\ShowWindowFollowMouse.cs" />
|
||||
<Compile Include="Util\StringUtil.cs" />
|
||||
<Compile Include="Util\SvgToGeometry.cs" />
|
||||
<Compile Include="Util\SystemIcon.cs" />
|
||||
<Compile Include="ViewModel\AppConfig.cs" />
|
||||
<Compile Include="ViewModel\AppData.cs" />
|
||||
<Compile Include="ViewModel\ToDoInfo.cs" />
|
||||
@@ -383,21 +385,35 @@
|
||||
<Isolated>False</Isolated>
|
||||
<EmbedInteropTypes>True</EmbedInteropTypes>
|
||||
</COMReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="Resource\Image\SystemIcon\Services.png" />
|
||||
<COMReference Include="Shell32">
|
||||
<Guid>{50A7E9B0-70EF-11D1-B75A-00A0C90564FE}</Guid>
|
||||
<VersionMajor>1</VersionMajor>
|
||||
<VersionMinor>0</VersionMinor>
|
||||
<Lcid>0</Lcid>
|
||||
<WrapperTool>tlbimp</WrapperTool>
|
||||
<Isolated>False</Isolated>
|
||||
<EmbedInteropTypes>True</EmbedInteropTypes>
|
||||
</COMReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="Resource\Image\SystemIcon\Calculator.png" />
|
||||
<Resource Include="Resource\Image\SystemIcon\CMD.png" />
|
||||
<Resource Include="Resource\Image\SystemIcon\Computer.png" />
|
||||
<Resource Include="Resource\Image\SystemIcon\Control.png" />
|
||||
<Resource Include="Resource\Image\SystemIcon\GroupPolicy.png" />
|
||||
<Resource Include="Resource\Image\SystemIcon\Mstsc.png" />
|
||||
<Resource Include="Resource\Image\SystemIcon\Network.png" />
|
||||
<Resource Include="Resource\Image\SystemIcon\Notepad.png" />
|
||||
<Resource Include="Resource\Image\SystemIcon\RecycleBin.png" />
|
||||
<Resource Include="Resource\Image\SystemIcon\Registry.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="Resource\Image\SystemIcon\Notepad.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="Resource\Image\SystemIcon\Mstsc.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="Resource\Image\SystemIcon\Control.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="Resource\Image\SystemIcon\CMD.png" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||
@@ -61,11 +61,10 @@ 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;
|
||||
@@ -84,13 +83,11 @@ namespace GeekDesk
|
||||
if (appData.AppConfig.AppAnimation)
|
||||
{
|
||||
this.Opacity = 0;
|
||||
}
|
||||
else
|
||||
} else
|
||||
{
|
||||
this.Visibility = Visibility.Collapsed;
|
||||
}
|
||||
}
|
||||
else
|
||||
} else
|
||||
{
|
||||
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>
|
||||
@@ -172,7 +206,7 @@ namespace GeekDesk
|
||||
try
|
||||
{
|
||||
|
||||
if (appData.AppConfig.ToDoHotkeyModifiers != 0)
|
||||
if (appData.AppConfig.ToDoHotkeyModifiers!=0)
|
||||
{
|
||||
//加载完毕注册热键
|
||||
toDoHotKeyId = GlobalHotKey.RegisterHotKey(appData.AppConfig.ToDoHotkeyModifiers, appData.AppConfig.ToDoHotkey, () =>
|
||||
@@ -264,8 +298,7 @@ namespace GeekDesk
|
||||
if (appData.AppConfig.AppAnimation)
|
||||
{
|
||||
FadeStoryBoard(0, (int)CommonEnum.WINDOW_ANIMATION_TIME, Visibility.Collapsed);
|
||||
}
|
||||
else
|
||||
} else
|
||||
{
|
||||
this.Visibility = Visibility.Collapsed;
|
||||
}
|
||||
@@ -316,45 +349,6 @@ namespace GeekDesk
|
||||
FadeStoryBoard(0, (int)CommonEnum.WINDOW_ANIMATION_TIME, Visibility.Collapsed);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 淡入淡出效果
|
||||
/// </summary>
|
||||
/// <param name="opacity"></param>
|
||||
/// <param name="milliseconds"></param>
|
||||
/// <param name="visibility"></param>
|
||||
public static void FadeStoryBoard(int opacity, int milliseconds, Visibility visibility)
|
||||
{
|
||||
if (appData.AppConfig.AppAnimation)
|
||||
{
|
||||
DoubleAnimation opacityAnimation = new DoubleAnimation
|
||||
{
|
||||
From = mainWindow.Opacity,
|
||||
To = opacity,
|
||||
Duration = new Duration(TimeSpan.FromMilliseconds(milliseconds))
|
||||
};
|
||||
opacityAnimation.Completed += (s, e) =>
|
||||
{
|
||||
mainWindow.BeginAnimation(OpacityProperty, null);
|
||||
if (visibility == Visibility.Visible)
|
||||
{
|
||||
mainWindow.Opacity = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
mainWindow.Opacity = 0;
|
||||
}
|
||||
};
|
||||
Timeline.SetDesiredFrameRate(opacityAnimation, 60);
|
||||
mainWindow.BeginAnimation(OpacityProperty, opacityAnimation);
|
||||
}
|
||||
else
|
||||
{
|
||||
//防止关闭动画后 窗体仍是0透明度
|
||||
mainWindow.Opacity = 1;
|
||||
mainWindow.Visibility = visibility;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -49,5 +49,5 @@ using System.Windows;
|
||||
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
|
||||
//通过使用 "*",如下所示:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("2.4.1.2")]
|
||||
[assembly: AssemblyFileVersion("2.4.1.2")]
|
||||
[assembly: AssemblyVersion("2.4.1.0")]
|
||||
[assembly: AssemblyFileVersion("2.4.1.0")]
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 30 KiB |
@@ -1,4 +1,5 @@
|
||||
using GeekDesk.Control.UserControls.Config;
|
||||
using GeekDesk.Util;
|
||||
using GeekDesk.ViewModel;
|
||||
using Gma.System.MouseKeyHook;
|
||||
using System;
|
||||
@@ -15,7 +16,7 @@ namespace GeekDesk.Thread
|
||||
public class MouseHookThread
|
||||
{
|
||||
private static AppConfig appConfig = MainWindow.appData.AppConfig;
|
||||
private static IKeyboardMouseEvents m_GlobalHook = Hook.GlobalEvents();
|
||||
private static IKeyboardMouseEvents m_GlobalHook = null;
|
||||
private static Dispatcher dispatcher;
|
||||
|
||||
|
||||
@@ -23,7 +24,9 @@ namespace GeekDesk.Thread
|
||||
public static void MiddleHook()
|
||||
{
|
||||
//使用dispatcher来单独监听UI线程 防止程序卡顿
|
||||
if (dispatcher != null) return;
|
||||
dispatcher = DispatcherBuild.Build();
|
||||
m_GlobalHook = Hook.GlobalEvents();
|
||||
dispatcher.Invoke((Action)(() =>
|
||||
{
|
||||
m_GlobalHook.MouseDownExt += M_GlobalHook_MouseDownExt;
|
||||
@@ -31,10 +34,17 @@ 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 { }
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -50,7 +60,9 @@ namespace GeekDesk.Thread
|
||||
{
|
||||
MainWindow.mainWindow.Dispatcher.Invoke((Action)(() =>
|
||||
{
|
||||
if (MainWindow.mainWindow.Visibility == Visibility.Collapsed || MainWindow.mainWindow.Opacity == 0)
|
||||
if (MainWindow.mainWindow.Visibility == Visibility.Collapsed
|
||||
|| MainWindow.mainWindow.Opacity == 0
|
||||
|| MarginHide.IS_HIDE)
|
||||
{
|
||||
MainWindow.ShowApp();
|
||||
}
|
||||
|
||||
@@ -59,9 +59,9 @@ namespace GeekDesk.Thread
|
||||
}));
|
||||
}
|
||||
}
|
||||
} catch (Exception ex)
|
||||
} catch (Exception e)
|
||||
{
|
||||
LogUtil.WriteErrorLog(ex, "获取更新失败!");
|
||||
LogUtil.WriteErrorLog(e, "检测更新失败!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
{
|
||||
"title": "GeekDesk版本更新",
|
||||
"subTitle": "V2.4.12",
|
||||
"subTitle": "V2.4.10",
|
||||
"msgTitle": "本次更新内容如下",
|
||||
"msg": "['各位兄弟去给我点个免费Star呗','这是个修复版本,主要修复上个版本的bug','修复图标无法拖动','修复界面遮挡任务栏']",
|
||||
"msg": "['各位兄弟去给我点个免费Star呗','增加添加系统和开始菜单应用功能','增加项目启动参数','优化贴边隐藏动画效果(可能现在并不完美)','增加双击打开功能','其它已知问题修复(如果有人发现)']",
|
||||
"githubUrl": "https://github.com/Demo-Liu/GeekDesk/releases",
|
||||
"giteeUrl": "https://gitee.com/demo_liu/GeekDesk/releases",
|
||||
"version": "2.4.12"
|
||||
"version": "2.4.10"
|
||||
}
|
||||
9
Update.json.bak
Normal file
9
Update.json.bak
Normal 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"
|
||||
}
|
||||
@@ -36,7 +36,7 @@ namespace GeekDesk.Util
|
||||
|
||||
public static BitmapImage GetBitmapImage(string filePath)
|
||||
{
|
||||
Icon ico;
|
||||
Icon ico = null;
|
||||
//选中文件中的图标总数
|
||||
var iconTotalCount = PrivateExtractIcons(filePath, 0, 0, 0, null, null, 0, 0);
|
||||
//用于接收获取到的图标指针
|
||||
@@ -53,18 +53,31 @@ namespace GeekDesk.Util
|
||||
{
|
||||
ip = hIcons[0];
|
||||
ico = Icon.FromHandle(ip);
|
||||
if (IsMinOrTransparent(ico))
|
||||
{
|
||||
ico = null;
|
||||
}
|
||||
else if (GetBlurExts().Contains(ext))
|
||||
}
|
||||
if (ico == null && GetBlurExts().Contains(ext))
|
||||
{
|
||||
ico = Icon.ExtractAssociatedIcon(filePath);
|
||||
if (IsMinOrTransparent(ico))
|
||||
{
|
||||
ico = null;
|
||||
}
|
||||
else
|
||||
}
|
||||
if (ico == null)
|
||||
{
|
||||
ip = GetJumboIcon(GetIconIndex(filePath));
|
||||
ico = Icon.FromHandle(ip);
|
||||
}
|
||||
|
||||
Bitmap bmp = ico.ToBitmap();
|
||||
return IconToBitmapImage(ico, ip);
|
||||
}
|
||||
|
||||
private static BitmapImage IconToBitmapImage(Icon icon, IntPtr iconIP)
|
||||
{
|
||||
Bitmap bmp = icon.ToBitmap();
|
||||
MemoryStream strm = new MemoryStream();
|
||||
|
||||
ImageCodecInfo myImageCodecInfo = GetEncoderInfo("image/png");
|
||||
@@ -73,19 +86,51 @@ namespace GeekDesk.Util
|
||||
EncoderParameters myEncoderParameters = new EncoderParameters(1);
|
||||
myEncoderParameters.Param[0] = myEncoderParameter;
|
||||
|
||||
//bmp.Save("d:\\test.png");
|
||||
|
||||
bmp.Save(strm, myImageCodecInfo, myEncoderParameters);
|
||||
BitmapImage bmpImage = new BitmapImage();
|
||||
bmpImage.BeginInit();
|
||||
strm.Seek(0, SeekOrigin.Begin);
|
||||
bmpImage.StreamSource = strm;
|
||||
bmpImage.EndInit();
|
||||
if (ip != IntPtr.Zero)
|
||||
if (iconIP != IntPtr.Zero)
|
||||
{
|
||||
Shell32.DestroyIcon(ip);
|
||||
Shell32.DestroyIcon(iconIP);
|
||||
}
|
||||
return bmpImage.Clone();
|
||||
}
|
||||
|
||||
|
||||
private static bool IsMinOrTransparent(Icon ico)
|
||||
{
|
||||
Bitmap bm = ico.ToBitmap();
|
||||
double w = bm.Width;
|
||||
double h = bm.Height;
|
||||
|
||||
Color middleColor = bm.GetPixel((int)(w * 0.50), (int)(h * 0.50));
|
||||
Color transparent = Color.FromArgb(0, 0, 0, 0);
|
||||
|
||||
//如果中间像素不为空 直接判断此icon不为空
|
||||
if (middleColor != Color.Transparent && middleColor != transparent)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
//判断中间一条横线像素 有不透明元素即判断 icon不为空
|
||||
Color c;
|
||||
int h2 = (int)h / 2;
|
||||
for (int i=0; i<(int)w; i++)
|
||||
{
|
||||
c = bm.GetPixel(i, h2);
|
||||
if (c!= Color.Transparent && c != transparent)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private static ImageCodecInfo GetEncoderInfo(String mimeType)
|
||||
{
|
||||
int j;
|
||||
@@ -416,7 +461,6 @@ namespace GeekDesk.Util
|
||||
int iOverlay,
|
||||
ref int piIndex);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
@@ -79,8 +79,7 @@ namespace GeekDesk.Util
|
||||
|| !Regex.IsMatch(iconPath, HAVE_ICO))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
else
|
||||
} else
|
||||
{
|
||||
return iconPath.Split(',')[0];
|
||||
}
|
||||
|
||||
@@ -53,9 +53,10 @@ namespace GeekDesk.Util
|
||||
UnregisterHotKey(handleTemp[id].Handle, id);
|
||||
GlobalHotKey.handleTemp[id].Dispose();
|
||||
GlobalHotKey.handleTemp.Remove(id);
|
||||
} catch
|
||||
} catch (Exception e)
|
||||
{
|
||||
//nothing
|
||||
LogUtil.WriteErrorLog(e, "取消注册热键异常!");
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -93,25 +93,20 @@ 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);
|
||||
@@ -223,7 +218,7 @@ namespace GeekDesk.Util
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LogUtil.WriteErrorLog(e, "获取文件缩略图失败!filePath=" + filePath);
|
||||
LogUtil.WriteErrorLog(e, "获取文件缩略图失败!filePath="+filePath);
|
||||
return Base64ToBitmapImage(Constants.DEFAULT_IMG_IMAGE_BASE64);
|
||||
}
|
||||
|
||||
@@ -324,7 +319,7 @@ namespace GeekDesk.Util
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LogUtil.WriteErrorLog(e, "图片文件转base64失败!Imagefilename=" + Imagefilename + ",ImageFormat=" + format);
|
||||
LogUtil.WriteErrorLog(e, "图片文件转base64失败!Imagefilename=" + Imagefilename + ",ImageFormat="+format);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -122,8 +122,7 @@ namespace GeekDesk.Util
|
||||
HideAnimation(windowLeft, screenWidth - Math.Abs(screenLeft) - showMarginWidth, Window.LeftProperty, HideType.RIGHT_HIDE);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (mouseX >= windowLeft && mouseX <= windowLeft + windowWidth
|
||||
} else if (mouseX >= windowLeft && mouseX <= windowLeft + windowWidth
|
||||
&& mouseY >= windowTop && mouseY <= windowTop + windowHeight && IS_HIDE)
|
||||
{
|
||||
//上方显示
|
||||
@@ -262,8 +261,7 @@ namespace GeekDesk.Util
|
||||
if (to == 0D)
|
||||
{
|
||||
time = fadeHideTime;
|
||||
}
|
||||
else
|
||||
} else
|
||||
{
|
||||
time = fadeShowTime;
|
||||
}
|
||||
|
||||
@@ -48,9 +48,11 @@ namespace GeekDesk.Util
|
||||
key.Close();
|
||||
|
||||
}
|
||||
#pragma warning disable CS0168 // 声明了变量“ex”,但从未使用过
|
||||
catch (Exception ex)
|
||||
#pragma warning restore CS0168 // 声明了变量“ex”,但从未使用过
|
||||
{
|
||||
LogUtil.WriteErrorLog(ex, "设置开机/取消失败!started=" + started);
|
||||
LogUtil.WriteErrorLog(ex, "注册启动Error1!");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -61,21 +63,25 @@ namespace GeekDesk.Util
|
||||
key.DeleteValue(exeName);//取消开机启动
|
||||
key.Close();
|
||||
}
|
||||
#pragma warning disable CS0168 // 声明了变量“ex”,但从未使用过
|
||||
catch (Exception ex)
|
||||
#pragma warning restore CS0168 // 声明了变量“ex”,但从未使用过
|
||||
{
|
||||
LogUtil.WriteErrorLog(ex, "取消开机启动失败!started=" + started);
|
||||
LogUtil.WriteErrorLog(ex, "注册启动Error2!");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
#pragma warning disable CS0168 // 声明了变量“ex”,但从未使用过
|
||||
catch (Exception ex)
|
||||
#pragma warning restore CS0168 // 声明了变量“ex”,但从未使用过
|
||||
{
|
||||
LogUtil.WriteErrorLog(ex, "取消/开机/失败!started=" + started);
|
||||
if (key != null)
|
||||
{
|
||||
key.Close();
|
||||
}
|
||||
LogUtil.WriteErrorLog(ex, "注册启动Error3!");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace GeekDesk.Util
|
||||
double left = SystemParameters.VirtualScreenLeft;
|
||||
double top = SystemParameters.VirtualScreenTop;
|
||||
double width = SystemParameters.VirtualScreenWidth;
|
||||
double height = SystemParameters.WorkArea.Height + 20;
|
||||
double height = SystemParameters.WorkArea.Height + 20; // 不遮挡任务栏
|
||||
double right = width - Math.Abs(left);
|
||||
double bottom = height - Math.Abs(top);
|
||||
|
||||
@@ -36,7 +36,6 @@ namespace GeekDesk.Util
|
||||
|
||||
switch (position)
|
||||
{
|
||||
|
||||
case MousePosition.LEFT_BOTTOM:
|
||||
afterWidth = 0;
|
||||
afterHeight = window.Height;
|
||||
|
||||
@@ -21,15 +21,18 @@ namespace GeekDesk.Util
|
||||
string svgPath = "/GeekDesk;component/Resource/Iconfont/iconfont.js";
|
||||
string jsonPath = "/GeekDesk;component/Resource/Iconfont/iconfont.json";
|
||||
|
||||
Stream svgStream = Application.GetResourceStream(new Uri(svgPath, UriKind.Relative)).Stream;
|
||||
Stream jsonStream = Application.GetResourceStream(new Uri(jsonPath, UriKind.Relative)).Stream;
|
||||
|
||||
StreamReader streamReader = new StreamReader(svgStream);
|
||||
using (Stream svgStream = Application.GetResourceStream(new Uri(svgPath, UriKind.Relative)).Stream,
|
||||
jsonStream = Application.GetResourceStream(new Uri(jsonPath, UriKind.Relative)).Stream)
|
||||
{
|
||||
using (StreamReader streamReader = new StreamReader(svgStream))
|
||||
{
|
||||
string svgJsStr = streamReader.ReadToEnd();
|
||||
JObject jo = ReadJson(jsonStream);
|
||||
|
||||
return GetIconfonts(svgJsStr, jo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static List<IconfontInfo> GetIconfonts(string svgJsStr, string jsonStr)
|
||||
{
|
||||
|
||||
34
Util/SystemIcon.cs
Normal file
34
Util/SystemIcon.cs
Normal 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;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -121,8 +121,7 @@ namespace GeekDesk.ViewModel
|
||||
if (imageWidth == 0)
|
||||
{
|
||||
return (int)CommonEnum.IMAGE_WIDTH;
|
||||
}
|
||||
else
|
||||
} else
|
||||
{
|
||||
return imageWidth;
|
||||
}
|
||||
@@ -397,8 +396,7 @@ namespace GeekDesk.ViewModel
|
||||
if (blurEffect)
|
||||
{
|
||||
BlurValue = 100;
|
||||
}
|
||||
else
|
||||
} else
|
||||
{
|
||||
BlurValue = 0;
|
||||
}
|
||||
@@ -570,8 +568,7 @@ namespace GeekDesk.ViewModel
|
||||
bacImgName = "系统默认";
|
||||
//Image image = ImageUtil.ByteArrayToImage(Convert.FromBase64String(Constants.DEFAULT_BAC_IMAGE_BASE64));
|
||||
return ImageUtil.ByteArrToImage(Convert.FromBase64String(Constants.DEFAULT_BAC_IMAGE_BASE64));
|
||||
}
|
||||
else
|
||||
} else
|
||||
{
|
||||
return ImageUtil.ByteArrToImage(ImageByteArr);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using GeekDesk.Util;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
@@ -84,6 +85,11 @@ namespace GeekDesk.ViewModel
|
||||
}
|
||||
}
|
||||
|
||||
public override String ToString()
|
||||
{
|
||||
return JsonConvert.SerializeObject(this);
|
||||
}
|
||||
|
||||
[field: NonSerializedAttribute()]
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
private void OnPropertyChanged(string propertyName)
|
||||
|
||||
@@ -143,8 +143,7 @@ namespace GeekDesk.ViewModel
|
||||
if (StringUtil.IsEmpty(Path))
|
||||
{
|
||||
Content = Name + "\n使用次数: " + Count;
|
||||
}
|
||||
else
|
||||
} else
|
||||
{
|
||||
Content = Path + "\n" + Name + "\n使用次数: " + Count;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@@ -36,5 +37,11 @@ namespace GeekDesk.ViewModel
|
||||
name = value;
|
||||
}
|
||||
}
|
||||
|
||||
public override String ToString()
|
||||
{
|
||||
return JsonConvert.SerializeObject(this);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using GeekDesk.Constant;
|
||||
using GeekDesk.Util;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.ComponentModel;
|
||||
@@ -17,11 +18,23 @@ namespace GeekDesk.ViewModel
|
||||
private string menuId;
|
||||
private Visibility menuEdit = Visibility.Collapsed;
|
||||
private Visibility notMenuEdit = Visibility.Visible;
|
||||
private bool isEdit = false;
|
||||
private string menuGeometry; //菜单几何图标
|
||||
private string geometryColor; //几何图标颜色
|
||||
private ObservableCollection<IconInfo> iconList = new ObservableCollection<IconInfo>();
|
||||
|
||||
|
||||
public bool IsEdit
|
||||
{
|
||||
get
|
||||
{
|
||||
return isEdit;
|
||||
}
|
||||
set
|
||||
{
|
||||
isEdit = value;
|
||||
OnPropertyChanged("IsEdit");
|
||||
}
|
||||
}
|
||||
public string MenuGeometry
|
||||
{
|
||||
get
|
||||
@@ -93,9 +106,11 @@ namespace GeekDesk.ViewModel
|
||||
menuEdit = value;
|
||||
if (menuEdit == Visibility.Visible)
|
||||
{
|
||||
IsEdit = true;
|
||||
NotMenuEdit = Visibility.Collapsed;
|
||||
} else
|
||||
{
|
||||
IsEdit = false;
|
||||
NotMenuEdit = Visibility.Visible;
|
||||
}
|
||||
OnPropertyChanged("MenuEdit");
|
||||
@@ -128,6 +143,11 @@ namespace GeekDesk.ViewModel
|
||||
}
|
||||
}
|
||||
|
||||
public override String ToString()
|
||||
{
|
||||
return JsonConvert.SerializeObject(this);
|
||||
}
|
||||
|
||||
[field: NonSerializedAttribute()]
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
private void OnPropertyChanged(string propertyName)
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using GeekDesk.Constant;
|
||||
using GeekDesk.Util;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
@@ -129,7 +130,10 @@ namespace GeekDesk.ViewModel
|
||||
// }
|
||||
//}
|
||||
|
||||
|
||||
public override String ToString()
|
||||
{
|
||||
return JsonConvert.SerializeObject(this);
|
||||
}
|
||||
|
||||
|
||||
[field: NonSerializedAttribute()]
|
||||
|
||||
Reference in New Issue
Block a user