public ModelProfileComment MakeModelProfileComment(Tuple <Service.Comment, Service.Profile> profile) { DataProvider dp = new DataProvider(); ModelProfileComment modelProfile = new ModelProfileComment(); modelProfile.Image = dp.GetImageFromByte(profile.Item2.MainImage); modelProfile.ID = profile.Item2.ID; modelProfile.Login = profile.Item2.Login; modelProfile.Comment = profile.Item1.comment; modelProfile.Star = Convert.ToString(profile.Item1.Score) + @"\5"; return(modelProfile); }
private void Inicialize(Service.Product productnow) { ocenka.Text = Convert.ToString(productnow.Rate); screns = new List <byte[]>(); screns.Add(productnow.MainImage); List <byte[]> d = ShopWindows.client.GetGameImages(productnow.Id).ToList(); for (int i = 0; i < d.Count; i++) { screns.Add(d.ToList()[i]); } ; foreach (string janr in productnow.GameGenre) { janrs.Text += " " + janr + " "; } foreach (string minr in productnow.MinGameSysReq) { sysmin.Text += " " + minr + "\n"; } foreach (string recr in productnow.RecGameSysReq) { sysrec.Text += " " + recr + "\n"; } modelProducts = new List <ModelImage>(); foreach (byte[] product in screns) { ModelImage modelProduct = new ModelImage(); modelProducts.Add(modelProduct.MakeModelImage(product)); } Back.IsEnabled = false; cms = ShopWindows.client.GetAllGameComments(tv1.Id).ToList(); modelComments = new List <ModelProfileComment>(); foreach (Tuple <Service.Comment, Service.Profile> product in cms) { ModelProfileComment modelComment = new ModelProfileComment(); modelComments.Add(modelComment.MakeModelProfileComment(product)); } for (int i = 0; i < modelComments.Count; i++) { if (modelComments[i].ID != MainWindow.shopWindows.profile.ID) { Lvcomment.Items.Add(modelComments[i]); } else { qqqq = 1; mycom_hint.Text = modelComments[i].Comment; com.ToolTip = "Вы можете оставить только один комментарий"; } } Back.IsEnabled = false; if (modelComments.Count == 0) { nocomments.Visibility = Visibility.Visible; Lvcomment.Visibility = Visibility.Hidden; } else { nocomments.Visibility = Visibility.Hidden; Lvcomment.Visibility = Visibility.Visible; } if (!inmylibrary()) { mycom_hint.Text = "Только купившие игру пользователи могут оставлять на нее комментарии"; mycomm.IsEnabled = false; com.IsEnabled = false; ocenka.IsEnabled = false; } Screenshoot.Items.Add(modelProducts[ishop]); Screenshoot1.Items.Add(modelProducts[ishop + 1]); Screenshoot2.Items.Add(modelProducts[ishop + 2]); Screenshoot3.Items.Add(modelProducts[ishop + 3]); Screenshoot4.Items.Add(modelProducts[ishop + 4]); Screenshoot5.Items.Add(modelProducts[ishop + 5]); tbgameName.Text = productnow.Name; tbDescription.Text = productnow.Description; tbDeveloper.Text = productnow.Developer; tbPublisher.Text = productnow.Publisher; //tbgame1.Text = productnow.Description + "\n" + productnow.Developer + "\n"; price.Text = Convert.ToString(productnow.RetailPrice); price.ToolTip = "Тут должна быть цена другая, но она пока не рабоатет"; // Screenshoot.Source = dp.GetImageFromByte(tv.MainImage); }