public ViewMailLabelLink(ViewMailItem item, ViewLabel label, bool subscribed, bool current) { Label = label; Mail = item; mSubscribed = subscribed; mCurrent = current; }
public void Sync(IAccountSource source) { mSource = source; UserName = source.UserName; ImageUrl = source.ImageUrl; AccountState = source.AccountState; UnreadCount = source.UnreadCount; IsExpanded = source.IsExpanded; Id = source.Id; var label_dict = mFilters.ToDictionary((l) => l.Id); var delete = new List <ViewLabel>(mFilters); var order = new List <ViewLabel>(source.Labels.Length); foreach (var i in source.Labels) { ViewLabel label; if (!label_dict.TryGetValue(i.Id, out label)) { label = new ViewLabel(this, i); mFilters.Add(label); order.Add(label); continue; } delete.Remove(label); order.Add(label); label.Sync(this, i); } foreach (var i in delete) { mFilters.Remove(i); } for (int i = 0; i < order.Count; i++) { int index = mFilters.IndexOf(order[i]); if (index == i) { continue; } mFilters.Move(index, i); } }