public bool GetLenta() { if (Connection.ConnectionAvailable()) { WebClient client = new WebClient() { Encoding = Encoding.GetEncoding(1251) }; string url = "https://acomics.ru/profile/featured"; string text = client.DownloadString(url); List <Comics> a = new List <Comics>(); for (int i = 0; i < Amounts.AmountLenta(); i++) { text = text.Remove(0, text.IndexOf("agrBody")); text = text.Remove(0, text.IndexOf("~")); String f1 = text.Substring(0, text.IndexOf("\"")); text = text.Remove(0, text.IndexOf("numbers")); text = text.Remove(0, text.IndexOf("#") + 1); String f2 = text.Substring(0, text.IndexOf("<")); a.Add(new Comics(f1, f2)); } Lenta = a; return(true); } else { return(false); } }
public List() { //REVIEW: Всё это должно задаваться в XAML InitializeComponent(); Logic Lo = new Logic(); if (Lo.CreateLenta()) { for (int i = 0; i < Amounts.AmountLenta(); i++) { Label l1 = new Label(); l1.Width = 250; l1.Height = 30; l1.Foreground = Brushes.White; Label l2 = new Label(); l2.Width = 100; l2.Height = 30; l2.Foreground = Brushes.White; Button b = new Button(); b.Width = 90; b.Height = 30; b.Tag = i; b.Click += ButtonClick; b.HorizontalAlignment = HorizontalAlignment.Center; b.VerticalAlignment = VerticalAlignment.Center; b.Content = "Добавить"; StackPanel sp = new StackPanel(); sp.Orientation = Orientation.Horizontal; sp.Height = 60; l1.Content = Lo.name(i); l2.Content = Lo.LastPage(i); sp.Children.Add(l1); sp.Children.Add(l2); sp.Children.Add(b); LentaStack.Children.Add(sp); } } }