private void btExecute_Click(object sender, RoutedEventArgs e) { var listErr = ErrorReason.GetInitial(); ErrorReason.Set(listErr, Reason.Duplicate.ToString()); foreach (var d in Delete) { Log.Remove(d); } foreach (var l in Log) { l.FailedStr.Replace(ErrorReason.GetFailedStr(listErr), ""); } this.Close(); }
public void setErrorStr() { log.FailedStr = ErrorReason.GetFailedStr(listErr); }
private void UpdateData() { if (Work.Log.Count == 0) { return; } int unsearchen = 0; int unfinden = 0; int erroren = 0; int dupen = 0; int dupegrpen = 0; var listErr = ErrorReason.GetInitial(); ErrorReason.Set(listErr, Reason.Duplicate.ToString()); string dup = ErrorReason.GetFailedStr(listErr); foreach (var l in Work.Log) { while (l.FailedStr.Contains(dup)) { int idx = l.FailedStr.IndexOf(dup); if (idx < 0) { break; } l.FailedStr = l.FailedStr.Remove(idx, dup.Length); } } Duplicates = new ObservableCollection <List <LogData> >(); var gb = Work.Log.GroupBy(wl => new { wl.Callsign, wl.Freq }).Where(g => g.Count() > 1).ToList(); dupegrpen = gb.Count; foreach (var g in gb) { var tmp = new List <LogData>(); dupen += g.Count(); for (int i = 0; i < g.Count(); i++) { if (!g.ElementAt(i).FailedStr.Contains(dup)) { g.ElementAt(i).FailedStr += dup; } tmp.Add(g.ElementAt(i)); } Duplicates.Add(tmp); } lbReadenLogNum.Content = Work.Log.Count; Work.Log = new ObservableCollection <LogData>(Work.Log.OrderByDescending(l => l.FailedStr)); dgLog.ItemsSource = Work.Log; if (Work.Config != null) { lbSettingConfigen.Content = ""; } foreach (var l in Work.Log) { if (!l.IsSearched) { unsearchen++; } if (!l.IsFinded) { unfinden++; } if (!l.IsRate0) { erroren++; } } lbUnsearchenLogNum.Content = unsearchen; lbUnavailenLogNum.Content = unfinden; lbErrorenLogNum.Content = erroren; lbDupenLogNum.Content = dupegrpen + "(" + dupen + ")"; }