private void backgroundWorker1_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { if (e.Error == null) { var item = Adapter.GroupLogonList.FirstOrDefault(r => r.Name == this.称); if (item != null) { Adapter.GroupLogonList.Remove(item); } } else { var item = Adapter.GroupLogonList.FirstOrDefault(r => r.Name == this.称); if (item == null) { item = new GroupLogonInfo() { Name = this.称 }; item.Times = e.Error.Message; Adapter.GroupLogonList.Add(item); } else { item.Times = e.Error.Message; } } }
public void Start() { GroupLogonList = new List <GroupLogonInfo>(); foreach (var item in GroupsDict.Values) { var o = new GroupLogonInfo() { Name = item.称 }; GroupLogonList.Add(o); if (item.Safe启用) { item.ClientID = -1; item.Start(); } else { if (item.Status.Length > 0) { o.Times = item.Status; } o.CanUse = false; } } }
private void backgroundWorker1_ProgressChanged(object sender, ProgressChangedEventArgs e) { switch (e.ProgressPercentage) { case 0: var status = e.UserState as string; var item = Adapter.GroupLogonList.FirstOrDefault(r => r.Name == this.称); if (item == null) { item = new GroupLogonInfo(); item.Name = this.称; item.Times = status; Adapter.GroupLogonList.Add(item); } else { item.Times = status; } if (Regex.IsMatch(status, "[\u4e00-\u9fa5]+")) { this._status = status; } break; default: break; } }