From 001d807bb355511746aea2adb1a1c9fb66264d3c Mon Sep 17 00:00:00 2001 From: liufei Date: Fri, 17 Jun 2022 10:03:35 +0800 Subject: [PATCH] =?UTF-8?q?:bug:=20=E4=BF=AE=E5=A4=8D=E4=BA=86=E6=9F=90?= =?UTF-8?q?=E4=BA=9B=E8=B7=AF=E5=BE=84=E6=97=A0=E6=B3=95=E5=BB=BA=E7=AB=8B?= =?UTF-8?q?=E7=9B=B8=E5=AF=B9=E8=B7=AF=E5=BE=84=E5=AF=BC=E8=87=B4=E7=A8=8B?= =?UTF-8?q?=E5=BA=8F=E5=90=AF=E5=8A=A8=E5=B4=A9=E6=BA=83=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- App.config | 2 +- GeekDesk.csproj | 1 + MainWindow.xaml.cs | 27 ++++++++++++++------------- Task/ShowSecondTask.cs | 31 +++++++++++++++++++++++++++++++ Update.json | 4 ++-- Util/FileUtil.cs | 27 +++++++++++++++++---------- ViewModel/IconInfo.cs | 16 ++++++++++++++++ 7 files changed, 82 insertions(+), 26 deletions(-) create mode 100644 Task/ShowSecondTask.cs diff --git a/App.config b/App.config index 2a204ef..d6fe745 100644 --- a/App.config +++ b/App.config @@ -54,7 +54,7 @@ - + diff --git a/GeekDesk.csproj b/GeekDesk.csproj index 6721d3b..0652fd3 100644 --- a/GeekDesk.csproj +++ b/GeekDesk.csproj @@ -265,6 +265,7 @@ + diff --git a/MainWindow.xaml.cs b/MainWindow.xaml.cs index 4b690e9..9d3ee6f 100644 --- a/MainWindow.xaml.cs +++ b/MainWindow.xaml.cs @@ -185,7 +185,7 @@ namespace GeekDesk { ShowApp(); } - + //ShowSecondTask.SHowSecond(); //给任务栏图标一个名字 BarIcon.Text = Constants.MY_NAME; @@ -426,17 +426,6 @@ namespace GeekDesk // return; //} - MainWindow.mainWindow.Activate(); - mainWindow.Show(); - //mainWindow.Visibility = Visibility.Visible; - if (appData.AppConfig.AppAnimation) - { - appData.AppConfig.IsShow = true; - } else - { - appData.AppConfig.IsShow = null; - } - if (MarginHide.ON_HIDE) { //修改贴边隐藏状态为未隐藏 @@ -452,7 +441,19 @@ namespace GeekDesk { ShowWindowFollowMouse.Show(mainWindow, MousePosition.CENTER, 0, 0); } - + + MainWindow.mainWindow.Activate(); + mainWindow.Show(); + //mainWindow.Visibility = Visibility.Visible; + if (appData.AppConfig.AppAnimation) + { + appData.AppConfig.IsShow = true; + } + else + { + appData.AppConfig.IsShow = null; + } + //FadeStoryBoard(1, (int)CommonEnum.WINDOW_ANIMATION_TIME, Visibility.Visible); diff --git a/Task/ShowSecondTask.cs b/Task/ShowSecondTask.cs new file mode 100644 index 0000000..8cd3186 --- /dev/null +++ b/Task/ShowSecondTask.cs @@ -0,0 +1,31 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using System.Text; +using System.Threading; +using System.Threading.Tasks; + +namespace GeekDesk.Task +{ + internal class ShowSecondTask + { + + public static void SHowSecond() + { + System.Timers.Timer timer = new System.Timers.Timer + { + Enabled = true, + Interval = 5000 + }; + timer.Start(); + timer.Elapsed += Timer_Elapsed; + } + + private static void Timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e) + { + Process[] pcArr = Process.GetProcessesByName("ShellExperienceHost.exe"); + Thread.Sleep(1000); + } + } +} diff --git a/Update.json b/Update.json index 93c4f2c..eb58061 100644 --- a/Update.json +++ b/Update.json @@ -1,9 +1,9 @@ { "title": "GeekDesk版本更新", - "subTitle": "V2.5.10", + "subTitle": "V2.5.11", "msgTitle": "本次更新内容如下", "msg": "['依旧耗费了我大量精力开发,希望大家去给我点个免费的Star', '这个版本有一些优化点, 大家可以自行探索, 另外征集新Logo的设计, 要求美观并能体现\\'极客\\'风格','本次重新打包了程序文件(文件目录更清爽了,注意,这次不要使用覆盖升级), 可以将旧版本根目录下的Data文件复制到新版本根目录, 然后使用新版本启动','增加可拖动图标到其它菜单的功能,取消了拖动时的动画','增加了列表展开动画的开关','增加了数据备份功能','优化大部分动画','优化搜索功能(达到了可只用键盘或只用鼠标启动所需目标)','增加了相对路径(实验性,可能有bug)','增加列表加密功能(实验性,可能有bug)','其它已知问题修复']", "githubUrl": "https://github.com/BookerLiu/GeekDesk/releases", "giteeUrl": "https://gitee.com/BookerLiu/GeekDesk/releases", - "version": "2.5.10" + "version": "2.5.11" } \ No newline at end of file diff --git a/Util/FileUtil.cs b/Util/FileUtil.cs index cf05976..50f01c9 100644 --- a/Util/FileUtil.cs +++ b/Util/FileUtil.cs @@ -159,16 +159,23 @@ namespace GeekDesk.Util public static string MakeRelativePath(string fromPath, string toPath) { - if (string.IsNullOrEmpty(toPath) || string.IsNullOrEmpty(fromPath)) return null; - Uri file = new Uri(@toPath); - // Must end in a slash to indicate folder - Uri folder = new Uri(@fromPath); - string relativePath = - Uri.UnescapeDataString( - folder.MakeRelativeUri(file) - .ToString() - .Replace('/', Path.DirectorySeparatorChar) - ); + string relativePath = null; + try + { + if (string.IsNullOrEmpty(toPath) || string.IsNullOrEmpty(fromPath)) return null; + Uri file = new Uri(@toPath); + // Must end in a slash to indicate folder + Uri folder = new Uri(@fromPath); + relativePath = + Uri.UnescapeDataString( + folder.MakeRelativeUri(file) + .ToString() + .Replace('/', Path.DirectorySeparatorChar) + ); + } catch (Exception ex) + { + LogUtil.WriteErrorLog(ex, "建立相对路径出错:fromPath:" + fromPath + ",toPath:" + toPath); + } return relativePath; } diff --git a/ViewModel/IconInfo.cs b/ViewModel/IconInfo.cs index 6501010..c83ae52 100644 --- a/ViewModel/IconInfo.cs +++ b/ViewModel/IconInfo.cs @@ -205,6 +205,14 @@ namespace GeekDesk.ViewModel set { name = value; + if (StringUtil.IsEmpty(Path)) + { + content = Name + "\n使用次数: " + Count; + } + else + { + content = Path + "\n" + Name + "\n使用次数: " + Count; + } } } @@ -238,6 +246,14 @@ namespace GeekDesk.ViewModel set { path = value; + if (StringUtil.IsEmpty(Path)) + { + content = Name + "\n使用次数: " + Count; + } + else + { + content = Path + "\n" + Name + "\n使用次数: " + Count; + } } }