public static void Com_Reset() { if (Com_CC.son == null) { return; } int c = Com_CC.son.Count; c--; if (c > 50) { for (int e = c; e > 50; e--) { CommentConponent cc = Com_CC.son[e]; Com_CC.son.RemoveAt(e); Com_CC.stack.Children.RemoveAt(e); GC.SuppressFinalize(cc.title); GC.SuppressFinalize(cc.time); GC.SuppressFinalize(cc.content); GC.SuppressFinalize(cc.head); GC.SuppressFinalize(cc.can); } GC.Collect(); } for (int e = 0; e < Com_CC.son.Count; e++) { Com_CC.son[e].can.Visibility = Visibility.Collapsed; } }
static void CommentLoad(int s, int count) { List <CommentConponent> temp = Com_CC.son; int len = temp.Count; int all = buff_com.Count; int i; for (i = s; i < len & i < all; i++) { temp[i].can.Visibility = Visibility.Visible; BitmapImage bi = new BitmapImage(); bi.UriSource = new Uri(buff_com[i].url); temp[i].head.Source = bi; temp[i].title.Text = buff_com[i].username; temp[i].time.Text = buff_com[i].time + buff_com[i].region; temp[i].content.Text = buff_com[i].content; } CommentConponent CC = new CommentConponent(); Thickness tk = new Thickness(); while (i < all) { Canvas can = new Canvas(); Com_CC.stack.Children.Add(can); CC.can = can; Image img = new Image(); CC.head = img; img.Width = 48; img.Height = 48; BitmapImage bi = new BitmapImage(); if (buff_com[i].url.Length > 10) { bi.UriSource = new Uri(buff_com[i].url); } else { bi.UriSource = new Uri("ms-appx:///Pic/User.png"); } img.Source = bi; can.Children.Add(img); TextBlock tb = new TextBlock(); CC.title = tb; can.Children.Add(tb); tk.Top = 0; tk.Left = 54; tb.Margin = tk; tb.Foreground = font_brush; string str = buff_com[i].username + " uid:" + buff_com[i].uidA;// + " mid:" + buff_com[i].uidB; tb.Text = str; tb = new TextBlock(); CC.time = tb; can.Children.Add(tb); tk.Top = 24; tb.Margin = tk; tb.Foreground = font_brush; tb.Text = buff_com[i].time + buff_com[i].region; tb = new TextBlock(); CC.content = tb; can.Children.Add(tb); tk.Left = 0; tk.Top = 54; tb.Margin = tk; tb.Width = 380; tb.TextWrapping = TextWrapping.Wrap; tb.Foreground = font_brush; tb.Text = buff_com[i].content; Com_CC.son.Add(CC); int c = buff_com[i].content.Length; c /= 21; c++; c *= 21; c += 70; can.Height = c; i++; } Com_load = false; }