public DoujinControl(int nhentaiId) { InitializeComponent(); prevSize = this.Height; tagsPrevSize = doujinTags.Height; gridPrevSize = infoGrid.Height; Doujin doujin = new Doujin(nhentaiId); this.nHentaiId = nhentaiId; //foreach (Database.DoujinSet.DoujinDataRow row in Database.DatabaseControler.favorites) //{ if (DatabaseControler.favorites.Any(item => item.nHentaiID == doujin.nhentaiId)) { //doujin = new Doujin(row.nHentaiID); doujin.favorised = true; Console.WriteLine("fav matched"); heart.Source = new BitmapImage(new Uri("pack://application:,,,/UiElements/heart_fav.png")); } //} var source = new BitmapImage(new Uri(doujin.coverUrl)); img.Source = source; double ratio = source.Width / source.Height; img.ToolTip = doujin.name; img.Tag = doujin.nhentaiId; img.Width = 160; img.Height = 230; img.Margin = new Thickness(5, 3, 5, 3); img.MouseLeftButtonDown += Img_MouseLeftButtonDown; //img.MouseRightButtonDown += Img_MouseRightButtonDown; heart.MouseLeftButtonDown += Heart_MouseLeftButtonDown; Thickness margin = Margin; margin.Right = 10; margin.Bottom = 10; Margin = margin; doujinName.Text = doujin.name; foreach (var tag in doujin.tags) { DoujinUtility.MainWindow.tagList.Add(tag); Console.WriteLine(tag); } Console.WriteLine(doujin.TagsConcat()); doujinCreator.Text = doujin.ArtistsConcat(); doujinTags.Text = doujin.TagsConcat(); var testRow = DatabaseControler.doujinCache.NewRow(); testRow[0] = nhentaiId; testRow[1] = true; bool contains = DatabaseControler.doujinCache.AsEnumerable().Any(row => nhentaiId == row.Field <Int32>("hentaiID")); }
public AccountDoujinControl(Doujin doujin, string doujinrater, double rating, string comment) { InitializeComponent(); prevSize = this.Height; tagsPrevSize = doujinTags.Height; gridPrevSize = infoGrid.Height; doujinRecomender.Text = doujinrater; doujinRatingText.Text = $"Rating: {rating}/5"; doujinComment.Text = comment; foreach (Database.DoujinSet.DoujinDataRow row in Database.DatabaseControler.favorites) { if (row.nHentaiID == doujin.nhentaiId) { //doujin = new Doujin(row.nHentaiID); doujin.favorised = true; Console.WriteLine("fav matched"); heart.Source = new BitmapImage(new Uri("pack://application:,,,/UiElements/heart_fav.png")); } } var source = new BitmapImage(new Uri(doujin.coverUrl)); img.Source = source; double ratio = source.Width / source.Height; img.ToolTip = doujin.name; img.Tag = (int)doujin.nhentaiId; img.Width = 160; img.Height = 230; img.Margin = new Thickness(5, 3, 5, 3); img.MouseLeftButtonDown += Img_MouseLeftButtonDown; img.MouseRightButtonDown += Img_MouseRightButtonDown; heart.MouseLeftButtonDown += Heart_MouseLeftButtonDown; Thickness margin = Margin; margin.Right = 10; margin.Bottom = 10; Margin = margin; doujinName.Text = doujin.name; doujinCreator.Text = doujin.ArtistsConcat(); doujinTags.Text = string.Join(", ", doujin.tags); Tag = doujin.nhentaiId.ToString(); bool contains = DatabaseControler.doujinCache.AsEnumerable().Any(row => doujin.nhentaiId == row.Field <Int32>("hentaiID")); if (contains) { img.Opacity = 0.3; } }
public DoujinControl(Doujin doujin) { InitializeComponent(); prevSize = this.Height; tagsPrevSize = doujinTags.Height; gridPrevSize = infoGrid.Height; this.nHentaiId = doujin.nhentaiId; if (DatabaseControler.favorites.Any(item => item.nHentaiID == doujin.nhentaiId)) { //doujin = new Doujin(row.nHentaiID); doujin.favorised = true; Console.WriteLine("fav matched"); heart.Source = new BitmapImage(new Uri("pack://application:,,,/UiElements/heart_fav.png")); } var cm = new ContextMenu(); var mitem = new MenuItem { Header = "Recommend to" }; cm.Items.Add(mitem); if (DoujinUtility.loggedIn) { foreach (var friend in DoujinUtility.MainWindow.accountElement.apiHelper.GetFriends().Result.Friends) { mitem.Items.Add(new MenuItem { Header = friend }); } } else { mitem.Items.Add(new MenuItem { Header = "You have to be logged in to use this feature" }); } this.cm = cm; var source = new BitmapImage(new Uri(doujin.coverUrl)); img.Source = source; double ratio = source.Width / source.Height; img.ToolTip = doujin.name; img.Tag = (int)doujin.nhentaiId; img.Width = 160; img.Height = 230; img.Margin = new Thickness(5, 3, 5, 3); img.MouseLeftButtonDown += Img_MouseLeftButtonDown; img.MouseRightButtonDown += Img_MouseRightButtonDown; heart.MouseLeftButtonDown += Heart_MouseLeftButtonDown; Thickness margin = Margin; margin.Right = 10; margin.Bottom = 10; Margin = margin; doujinName.Text = doujin.name; doujinCreator.Text = doujin.ArtistsConcat(); foreach (var tag in doujin.tags) { DoujinUtility.MainWindow.tagList.Add(tag); Console.WriteLine(tag); } Console.WriteLine(doujin.tags); doujinTags.Text = string.Join(", ", doujin.tags); Tag = doujin.nhentaiId.ToString(); bool contains = DatabaseControler.doujinCache.AsEnumerable().Any(row => doujin.nhentaiId == row.Field <Int32>("hentaiID")); if (contains) { img.Opacity = 0.3; } }