예제 #1
0
        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);
            }
        }
예제 #2
0
        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++;
        }
예제 #3
0
        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++;
        }
예제 #4
0
 public void Add(LogUnit unit)
 {
     this.Items.Add(unit);
 }