🚑 修复可能导致输入法特定场景卡顿的问题

This commit is contained in:
BookerLiu
2022-08-30 09:06:27 +08:00
parent cbaeb71a0c
commit e82af431b5
31 changed files with 2687 additions and 430 deletions

View File

@@ -2,13 +2,9 @@
using GeekDesk.Util;
using GeekDesk.ViewModel;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace GeekDesk.MyThread
{
@@ -18,24 +14,33 @@ namespace GeekDesk.MyThread
{
new Thread(() =>
{
ObservableCollection<MenuInfo> menuList = MainWindow.appData.MenuList;
string myExePath = Constants.APP_DIR + "GeekDesk.exe";
foreach (MenuInfo mi in menuList)
try
{
ObservableCollection<IconInfo> iconList = mi.IconList;
foreach (IconInfo icon in iconList)
ObservableCollection<MenuInfo> menuList = MainWindow.appData.MenuList;
string myExePath = Constants.APP_DIR + "GeekDesk.exe";
foreach (MenuInfo mi in menuList)
{
string relativePath = FileUtil.MakeRelativePath(myExePath, icon.Path);
if (File.Exists(icon.Path)
&& !string.IsNullOrEmpty(relativePath)
&& !relativePath.Equals(icon.Path)) {
icon.RelativePath_NoWrite = relativePath;
ObservableCollection<IconInfo> iconList = mi.IconList;
foreach (IconInfo icon in iconList)
{
if (icon == null) continue;
string relativePath = FileUtil.MakeRelativePath(myExePath, icon.Path);
if (File.Exists(icon.Path)
&& !string.IsNullOrEmpty(relativePath)
&& !relativePath.Equals(icon.Path))
{
icon.RelativePath_NoWrite = relativePath;
}
}
}
CommonCode.SaveAppData(MainWindow.appData, Constants.DATA_FILE_PATH);
CommonCode.SaveAppData(MainWindow.appData, Constants.DATA_FILE_BAK_PATH);
}
catch (Exception ex)
{
LogUtil.WriteErrorLog(ex, "init相对路径出错!");
}
CommonCode.SaveAppData(MainWindow.appData, Constants.DATA_FILE_PATH);
CommonCode.SaveAppData(MainWindow.appData, Constants.DATA_FILE_BAK_PATH);
}).Start();
}
}