✨ feture 增加关联实时文件夹
This commit is contained in:
@@ -222,10 +222,7 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
|||||||
if (dialog.ShowDialog() == CommonFileDialogResult.Ok)
|
if (dialog.ShowDialog() == CommonFileDialogResult.Ok)
|
||||||
{
|
{
|
||||||
string menuId = System.Guid.NewGuid().ToString();
|
string menuId = System.Guid.NewGuid().ToString();
|
||||||
new Thread(() =>
|
|
||||||
{
|
|
||||||
this.Dispatcher.BeginInvoke(new Action(() =>
|
|
||||||
{
|
|
||||||
string path = dialog.FileName;
|
string path = dialog.FileName;
|
||||||
|
|
||||||
MenuInfo menuInfo = new MenuInfo
|
MenuInfo menuInfo = new MenuInfo
|
||||||
@@ -246,35 +243,27 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
|||||||
object obj = MenuListBox.ItemContainerGenerator.ContainerFromIndex(MenuListBox.SelectedIndex);
|
object obj = MenuListBox.ItemContainerGenerator.ContainerFromIndex(MenuListBox.SelectedIndex);
|
||||||
SetListBoxItemEvent((ListBoxItem)obj);
|
SetListBoxItemEvent((ListBoxItem)obj);
|
||||||
Lbi_Selected(obj, null);
|
Lbi_Selected(obj, null);
|
||||||
|
|
||||||
HandyControl.Controls.Growl.Success("菜单关联成功, 后台加载列表!", "MainWindowGrowl");
|
HandyControl.Controls.Growl.Success("菜单关联成功, 后台加载列表!", "MainWindowGrowl");
|
||||||
|
|
||||||
FileWatcher.LinkMenuWatcher(menuInfo);
|
FileWatcher.LinkMenuWatcher(menuInfo);
|
||||||
}));
|
|
||||||
}).Start();
|
|
||||||
|
|
||||||
new Thread(() =>
|
new Thread(() =>
|
||||||
{
|
{
|
||||||
Thread.Sleep(1000);
|
DirectoryInfo dirInfo = new DirectoryInfo(menuInfo.LinkPath);
|
||||||
this.Dispatcher.BeginInvoke(new Action(() =>
|
|
||||||
{
|
|
||||||
MenuInfo info = null;
|
|
||||||
foreach (MenuInfo menuInfo in appData.MenuList)
|
|
||||||
{
|
|
||||||
if (menuInfo.MenuId.Equals(menuId))
|
|
||||||
{
|
|
||||||
info = menuInfo;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
DirectoryInfo dirInfo = new DirectoryInfo(info.LinkPath);
|
|
||||||
FileSystemInfo[] fileInfos = dirInfo.GetFileSystemInfos();
|
FileSystemInfo[] fileInfos = dirInfo.GetFileSystemInfos();
|
||||||
|
|
||||||
|
ObservableCollection<IconInfo> iconList = new ObservableCollection<IconInfo>();
|
||||||
foreach (FileSystemInfo fileInfo in fileInfos)
|
foreach (FileSystemInfo fileInfo in fileInfos)
|
||||||
{
|
{
|
||||||
IconInfo iconInfo = CommonCode.GetIconInfoByPath_NoWrite(fileInfo.FullName);
|
IconInfo iconInfo = CommonCode.GetIconInfoByPath_NoWrite(fileInfo.FullName);
|
||||||
info.IconList.Add(iconInfo);
|
iconList.Add(iconInfo);
|
||||||
}
|
}
|
||||||
}));
|
this.Dispatcher.Invoke(() =>
|
||||||
|
{
|
||||||
|
foreach (IconInfo iconInfo in iconList)
|
||||||
|
{
|
||||||
|
menuInfo.IconList.Add(iconInfo);
|
||||||
|
}
|
||||||
|
});
|
||||||
}).Start();
|
}).Start();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ namespace GeekDesk.MyThread
|
|||||||
foreach (MenuInfo mi in menuList)
|
foreach (MenuInfo mi in menuList)
|
||||||
{
|
{
|
||||||
ObservableCollection<IconInfo> iconList = mi.IconList;
|
ObservableCollection<IconInfo> iconList = mi.IconList;
|
||||||
|
if (iconList == null) continue;
|
||||||
foreach (IconInfo icon in iconList)
|
foreach (IconInfo icon in iconList)
|
||||||
{
|
{
|
||||||
if (icon == null) continue;
|
if (icon == null) continue;
|
||||||
|
|||||||
Reference in New Issue
Block a user