diff --git a/KoKo/Danbooru.fs b/KoKo/Danbooru.fs index 217f151..c16c43e 100644 --- a/KoKo/Danbooru.fs +++ b/KoKo/Danbooru.fs @@ -29,7 +29,7 @@ type DanbooruSpider (name, domain) = retry <- retry - 1 System.Threading.Thread.Sleep 5000 result) - |> Utils.takeWhileTimes 5 (function + |> Utils.takeWhileTimes 3 (function | Ok x when x.Posts.Length > 0 -> true | _ -> false) |> Seq.choose (function diff --git a/KoKo/Konachan.fs b/KoKo/Konachan.fs index ef7ba25..b832b6a 100644 --- a/KoKo/Konachan.fs +++ b/KoKo/Konachan.fs @@ -59,7 +59,7 @@ type KonachanSpider (args: SpiderArguments) = let head = Seq.head pages let pages = Seq.append [head] <| Seq.tail pages pages - |> Utils.takeWhileTimes 5 (function + |> Utils.takeWhileTimes 3 (function | Ok x when x.Posts.Length > 0 -> true | _ -> false) |> Seq.choose (function diff --git a/KoKo/SankakuComplex.fs b/KoKo/SankakuComplex.fs index 5095f08..fd6ef7e 100644 --- a/KoKo/SankakuComplex.fs +++ b/KoKo/SankakuComplex.fs @@ -27,7 +27,7 @@ type SankakuComplex () = retry <- retry - 1 System.Threading.Thread.Sleep 5000 result) - |> Utils.takeWhileTimes 5 (function + |> Utils.takeWhileTimes 3 (function | Ok x when x.Length > 0 -> true | _ -> false) |> Seq.choose (function diff --git a/KoKoViewer/BrowsePage.xaml.cs b/KoKoViewer/BrowsePage.xaml.cs index 86ba383..3b47583 100644 --- a/KoKoViewer/BrowsePage.xaml.cs +++ b/KoKoViewer/BrowsePage.xaml.cs @@ -207,28 +207,50 @@ from post in Browser.SelectedItems private void Image_ImageOpened(object sender, RoutedEventArgs e) { - var image = sender as Image; - var post = image.Tag as KoKo.Post; - - var parent = (image.Parent as Grid); - var stackPanel = parent.Children - .Where(item => null != item as StackPanel) - .First() as StackPanel; - - - if (FavoritesData.Get().Has(post.fromSpider.Name, post.id)) - (stackPanel.FindName("Info_Fav") as SymbolIcon).Visibility = Visibility.Visible; - - if (DownloadHelper.GetDownloaded(post) != null) - (stackPanel.FindName("Info_Downloaded") as SymbolIcon).Visibility = Visibility.Visible; - - var imageName = post.images.First().First().fileName.ToLower().Trim(); - - if (imageName.EndsWith(".gif")) - (stackPanel.FindName("Info_GIF") as SymbolIcon).Visibility = Visibility.Visible; + try + { + var image = sender as Image; + var post = image.Tag as KoKo.Post; - else if (imageName.EndsWith(".mp4") || imageName.EndsWith(".webm")) - (stackPanel.FindName("Info_Video") as SymbolIcon).Visibility = Visibility.Visible; ; + DependencyObject parent = VisualTreeHelper.GetParent(image); + for (int i = 0; i < VisualTreeHelper.GetChildrenCount(parent); ++i) + { + DependencyObject obj = VisualTreeHelper.GetChild(parent, i); + if (obj is StackPanel) + { + var stackPanel = (obj as StackPanel); + if (stackPanel.Name == "InformationDisplay") + { + try + { + if (FavoritesData.Get().Has(post.fromSpider.Name, post.id)) + (stackPanel.FindName("Info_Fav") as SymbolIcon).Visibility = Visibility.Visible; + } + catch (Exception) { } + + try + { + if (DownloadHelper.GetDownloaded(post) != null) + (stackPanel.FindName("Info_Downloaded") as SymbolIcon).Visibility = Visibility.Visible; + } + catch (Exception) { } + + try + { + var imageName = post.images.First().First().fileName.ToLower().Trim(); + + if (imageName.EndsWith(".gif")) + (stackPanel.FindName("Info_GIF") as SymbolIcon).Visibility = Visibility.Visible; + + else if (imageName.EndsWith(".mp4") || imageName.EndsWith(".webm")) + (stackPanel.FindName("Info_Video") as SymbolIcon).Visibility = Visibility.Visible; + } + catch (Exception) { } + } + } + } + } + catch (Exception) { } } } } diff --git a/KoKoViewer/Package.appxmanifest b/KoKoViewer/Package.appxmanifest index 8b2c5b1..b4f662e 100644 --- a/KoKoViewer/Package.appxmanifest +++ b/KoKoViewer/Package.appxmanifest @@ -9,7 +9,7 @@ + Version="0.3.0.0" /> diff --git a/README.md b/README.md index bfe330f..eb92c95 100644 --- a/README.md +++ b/README.md @@ -36,6 +36,7 @@ Anime wallpaper downloader. * Spider输出内容改为Result,以将错误信息报告给GUI. * More Spiders. * KoKo.Viewer支持搜索时常用关键字补全。 +* KoKo.Viewer支持查看历史记录。 ## KoKoViewer KoKoViewer是KoKo的使用UWP的GUI实现,提供了基本的浏览功能。