private void ZipArtistsElements_Loaded(object sender, RoutedEventArgs e) { if (IsDataLoaded) { return; } IsDataLoaded = true; var parent = ((ZipArtists)Window.GetWindow(this)); if (parent.IsBookmarked(ArtistTextBox.Text)) { Bookmark.Kind = MaterialDesignThemes.Wpf.PackIconKind.Star; (BookmarkButton.FindResource("GlowOn") as Storyboard).Begin(BookmarkButton); Bookmark.Foreground = new SolidColorBrush(parent.GetBookmarkColor(ArtistTextBox.Text)); } else { Bookmark.Kind = MaterialDesignThemes.Wpf.PackIconKind.StarOutline; (BookmarkButton.FindResource("GlowOff") as Storyboard).Begin(BookmarkButton); } Task.Run(() => { List <string> titles = new List <string>(); List <string> paths = new List <string>(); List <string> ids = new List <string>(); for (int i = 0, j = 0; i < 5 && j < sub_folder.Count; j++) { string ttitle = sub_folder[i].Split('|')[0]; if (ZipArtistsModelManager.Instance.Setting.UsingTextMatchingAccuracy && titles.Count > 0 && !titles.TrueForAll((title) => Strings.ComputeLevenshteinDistance(ttitle, title) > ZipArtistsModelManager.Instance.Setting.TextMatchingAccuracy)) { continue; } titles.Add(ttitle); paths.Add(path + sub_folder[i]); zip_paths[i] = (path + sub_folder[i]); ids.Add(magics[i]); i++; } if (!ZipArtistsModelManager.Instance.Setting.LoadFromOnline) { ImageLoadFromOffline(paths); } else { ImageLoadFromOnline(ids); } }); }
private async Task BlackButtons() { MenuButton.ImageSource("menu.png"); MenuButton.RippleColor(Colors.Black); Back.ImageSource("back.png"); Back.RippleColor(Colors.Black); Forward.ImageSource("forward.png"); Forward.RippleColor(Colors.Black); RefreshButton.ImageSource("reload.png"); RefreshButton.RippleColor(Colors.Black); BookmarkButton.ImageSource("bookmark.png"); BookmarkButton.RippleColor(Colors.Black); StopButton = "stop.png"; mainWindow.TabBar.getTabFromForm(this).CloseTab.ImageSource("close_Tab.png"); }
private void Button_Click(object sender, RoutedEventArgs e) { var parent = ((ZipArtists)Window.GetWindow(this)); if (parent.IsBookmarked(ArtistTextBox.Text)) { parent.RemoveBookmark(ArtistTextBox.Text); Bookmark.Kind = MaterialDesignThemes.Wpf.PackIconKind.StarOutline; (BookmarkButton.FindResource("GlowOff") as Storyboard).Begin(BookmarkButton); } else { parent.AddBookmark(ArtistTextBox.Text); Bookmark.Kind = MaterialDesignThemes.Wpf.PackIconKind.Star; (BookmarkButton.FindResource("GlowOn") as Storyboard).Begin(BookmarkButton); Bookmark.Foreground = new SolidColorBrush(parent.GetBookmarkColor(ArtistTextBox.Text)); } }