示例#1
0
        private static void ReceiveIcons()
        {
            while (CanRun)
            {
                if (CanFetchIcons)
                {
                    foreach (FileViewModel file in FetcherPool)
                    {
                        if (CanFetchIcons)
                        {
                            if (IconHelper.IsImageFile(file.FilePath))
                            {
                                if (CanFetchIcons)
                                {
                                    ImageSource source = IconHelper.LoadBitmapImage(file.FilePath);
                                    source.Freeze();
                                    Application.Current?.Dispatcher?.Invoke(() =>
                                    {
                                        file.Icon = source.Clone();
                                    });
                                }
                                else
                                {
                                    break;
                                }
                            }
                            else
                            {
                                Icon icon = IconHelper.GetIconOfFile(file.FilePath, false, false);
                                if (CanFetchIcons)
                                {
                                    ImageSource source = IconHelper.ToImageSource(icon);
                                    source.Freeze();
                                    Application.Current?.Dispatcher?.Invoke(() =>
                                    {
                                        file.Icon = source.Clone();
                                    });
                                }
                                else
                                {
                                    break;
                                }
                            }

                            Thread.Sleep(1);
                        }
                        else
                        {
                            break;
                        }
                    }

                    FetcherPool.Clear();
                    StopFetching();
                }
            }

            Thread.Sleep(1);
        }
示例#2
0
 public static void ClearPool()
 {
     FetcherPool.Clear();
 }