diff --git a/App.xaml.cs b/App.xaml.cs index 3d92836..1701231 100644 --- a/App.xaml.cs +++ b/App.xaml.cs @@ -54,7 +54,7 @@ namespace GeekDesk void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e) { LogUtil.WriteErrorLog(e, "严重异常!"); - MessageBox.Show("GeekDesk遇到未知问题崩溃!"); + //MessageBox.Show("GeekDesk遇到未知问题崩溃!"); } public static void DoEvents() { diff --git a/MainWindow.xaml b/MainWindow.xaml index fe9c3cb..bc28901 100644 --- a/MainWindow.xaml +++ b/MainWindow.xaml @@ -164,7 +164,7 @@ - + @@ -233,7 +233,7 @@ - + + { + try { int x = e.X; int y = e.Y; @@ -197,8 +200,8 @@ namespace ShowSeconds SecondsDataContext dc = this.DataContext as SecondsDataContext; dc.Seconds = (DateTime.Now.Hour).ToString() + ":" + - FormatMS(DateTime.Now.Minute) + ":" + - FormatMS(DateTime.Now.Second); + FormatMS(DateTime.Now.Minute) + ":" + + FormatMS(DateTime.Now.Second); int sx = (int)(SystemParameters.PrimaryScreenWidth * lProportion); int sMarginBottom = (int)(SystemParameters.WorkArea.Height * tProportion); @@ -209,7 +212,7 @@ namespace ShowSeconds } else { - BGBorder.Visibility= Visibility.Collapsed; + BGBorder.Visibility = Visibility.Collapsed; timer.Stop(); } } @@ -217,22 +220,25 @@ namespace ShowSeconds else if (true) { if ((expandClock && (x < 1574 / w * width - || x > 1906 / w * width - || y < 598 / h * height - || y > 1020 / h * height) - ) - || !expandClock && (x < 1574 / w * width - || x > 1906 / w * width - || y < 950 / h * height - || y > 1020 / h * height) - ) + || x > 1906 / w * width + || y < 598 / h * height + || y > 1020 / h * height) + ) + || !expandClock && (x < 1574 / w * width + || x > 1906 / w * width + || y < 950 / h * height + || y > 1020 / h * height) + ) { BGBorder.Visibility = Visibility.Collapsed; timer.Stop(); } } + } + catch (Exception) { } })); } + } diff --git a/Task/ToDoTask.cs b/Task/ToDoTask.cs index 457fd60..77bfcae 100644 --- a/Task/ToDoTask.cs +++ b/Task/ToDoTask.cs @@ -34,18 +34,22 @@ namespace GeekDesk.Task { App.Current.Dispatcher.Invoke((Action)(() => { - if (MainWindow.appData.ToDoList.Count > 0) + try { - string nowTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); - ObservableCollection exeBacklogList = MainWindow.appData.ToDoList; - foreach (ToDoInfo info in exeBacklogList) + if (MainWindow.appData.ToDoList.Count > 0) { - if (info.ExeTime.CompareTo(nowTime) == -1 && !activityBacklog.ContainsKey(info)) + string nowTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); + ObservableCollection exeBacklogList = MainWindow.appData.ToDoList; + foreach (ToDoInfo info in exeBacklogList) { - activityBacklog.Add(info, Notification.Show(new BacklogNotificatin(info), ShowAnimation.Fade, true)); + if (info.ExeTime.CompareTo(nowTime) == -1 && !activityBacklog.ContainsKey(info)) + { + activityBacklog.Add(info, Notification.Show(new BacklogNotificatin(info), ShowAnimation.Fade, true)); + } } } } + catch (Exception) { } //ClearMemory(); })); } diff --git a/Util/CommonCode.cs b/Util/CommonCode.cs index 4602ac3..92345f6 100644 --- a/Util/CommonCode.cs +++ b/Util/CommonCode.cs @@ -296,33 +296,38 @@ namespace GeekDesk.Util /// public static void SortIconList() { - if (MainWindow.appData.AppConfig.IconSortType != SortType.CUSTOM) + try { - ObservableCollection menuList = MainWindow.appData.MenuList; - //List list = new List(menuList[MainWindow.appData.AppConfig.SelectedMenuIndex].IconList); - List list; - foreach (MenuInfo menuInfo in menuList) + if (MainWindow.appData.AppConfig.IconSortType != SortType.CUSTOM) { - list = new List(menuInfo.IconList); - switch (MainWindow.appData.AppConfig.IconSortType) + ObservableCollection menuList = MainWindow.appData.MenuList; + //List list = new List(menuList[MainWindow.appData.AppConfig.SelectedMenuIndex].IconList); + List list; + foreach (MenuInfo menuInfo in menuList) { - case SortType.COUNT_UP: - list.Sort((x, y) => x.Count.CompareTo(y.Count)); - break; - case SortType.COUNT_LOW: - list.Sort((x, y) => y.Count.CompareTo(x.Count)); - break; - case SortType.NAME_UP: - list.Sort((x, y) => x.Name.CompareTo(y.Name)); - break; - case SortType.NAME_LOW: - list.Sort((x, y) => y.Name.CompareTo(x.Name)); - break; + list = new List(menuInfo.IconList); + switch (MainWindow.appData.AppConfig.IconSortType) + { + case SortType.COUNT_UP: + list.Sort((x, y) => x.Count.CompareTo(y.Count)); + break; + case SortType.COUNT_LOW: + list.Sort((x, y) => y.Count.CompareTo(x.Count)); + break; + case SortType.NAME_UP: + list.Sort((x, y) => x.Name.CompareTo(y.Name)); + break; + case SortType.NAME_LOW: + list.Sort((x, y) => y.Name.CompareTo(x.Name)); + break; + } + menuInfo.IconList = new ObservableCollection(list); } - menuInfo.IconList = new ObservableCollection(list); + MainWindow.appData.AppConfig.SelectedMenuIcons = MainWindow.appData.MenuList[MainWindow.appData.AppConfig.SelectedMenuIndex].IconList; } - MainWindow.appData.AppConfig.SelectedMenuIcons = MainWindow.appData.MenuList[MainWindow.appData.AppConfig.SelectedMenuIndex].IconList; } + catch (Exception) { } + } diff --git a/Util/FileWatcher.cs b/Util/FileWatcher.cs index 8aa1e1f..6eda7e6 100644 --- a/Util/FileWatcher.cs +++ b/Util/FileWatcher.cs @@ -105,29 +105,33 @@ namespace GeekDesk.Util { new Thread(() => { - foreach (MenuInfo menuInfo in appData.MenuList) + try { - if (menuInfo.MenuType == Constant.MenuType.LINK) + foreach (MenuInfo menuInfo in appData.MenuList) { - DirectoryInfo dirInfo = new DirectoryInfo(menuInfo.LinkPath); - FileSystemInfo[] fileInfos = dirInfo.GetFileSystemInfos(); + if (menuInfo.MenuType == Constant.MenuType.LINK) + { + DirectoryInfo dirInfo = new DirectoryInfo(menuInfo.LinkPath); + FileSystemInfo[] fileInfos = dirInfo.GetFileSystemInfos(); - ObservableCollection iconList = new ObservableCollection(); - foreach (FileSystemInfo fileInfo in fileInfos) - { - IconInfo iconInfo = CommonCode.GetIconInfoByPath_NoWrite(fileInfo.FullName); - iconList.Add(iconInfo); - } - App.Current.Dispatcher.Invoke(() => - { - foreach (IconInfo iconInfo in iconList) + ObservableCollection iconList = new ObservableCollection(); + foreach (FileSystemInfo fileInfo in fileInfos) { - menuInfo.IconList = null; - menuInfo.IconList = iconList; + IconInfo iconInfo = CommonCode.GetIconInfoByPath_NoWrite(fileInfo.FullName); + iconList.Add(iconInfo); } - }); + App.Current.Dispatcher.Invoke(() => + { + foreach (IconInfo iconInfo in iconList) + { + menuInfo.IconList = null; + menuInfo.IconList = iconList; + } + }); + } } } + catch (Exception) { } }).Start(); }