public void SelectedClear(LogUnit start, LogUnit End) { int st = Math.Min(start.Index, End.Index); int ed = Math.Max(start.Index, End.Index); var removeItems = this.Items.Where(x => x.Index >= st && x.Index <= ed).ToList(); foreach (LogUnit unit in removeItems) { this.Items.Remove(unit); } }
public void Add(string content, bool bConn = true) { LogUnit unit = new LogUnit(); unit.Index = Index; unit.Content = content; unit.Time = DateTime.Now.ToLongTimeString(); unit.IsConnected = bConn; this.Items.Add(unit); Index++; }
public void Insert(string content, bool bConn = true) { LogUnit unit = new LogUnit(); unit.Index = Index; unit.Content = content; unit.Time = DateTime.Now.ToLongTimeString(); unit.IsConnected = bConn; this.Items.Insert(0, unit); if (bCheckConnect != bConn) //이 상태면 접속상태가 변경된 시점, 시간 저장 { bCheckConnect = bConn; LogUnit statUnit = new LogUnit(); statUnit.Index = Index; if (bConn) { TimeSpan span = DateTime.Now - preDateTime; string info = DiffTime(span); statUnit.Content = content + ", 오류시간: " + info; } else { preDateTime = DateTime.Now; statUnit.Content = content; } statUnit.Time = DateTime.Now.ToLongTimeString(); statUnit.IsConnected = bConn; this.StatItems.Insert(0, statUnit); } Index++; }
public void Add(LogUnit unit) { this.Items.Add(unit); }