Пример #1
0
        public void Add(Program prog, Program.LogEntry entry)
        {
            ProgramList.ID id = entry.mID;

            Tuple <Program, List <Program.LogEntry> > list;

            if (!mEvents.TryGetValue(id, out list))
            {
                list = new Tuple <Program, List <Program.LogEntry> >(prog, new List <Program.LogEntry>());
                mEvents.Add(id, list);
                mEventList.Add(id);
            }

            list.Item2.Add(entry);

            if (curIndex >= mEventList.Count)
            {
                curIndex = mEventList.Count - 1;
            }

            UpdateIndex();

            int index = mEventList.FindIndex((x) => { return(id.CompareTo(x) == 0); });

            if (curIndex == index)
            {
                LoadCurrent();
            }
        }
Пример #2
0
        public void Add(Program prog, Program.LogEntry entry)
        {
            ProgramList.ID id = entry.mID;

            Tuple <Program, List <Program.LogEntry> > list;

            if (!mEvents.TryGetValue(id, out list))
            {
                list = new Tuple <Program, List <Program.LogEntry> >(prog, new List <Program.LogEntry>());
                mEvents.Add(id, list);
                mEventList.Add(id);
            }

            list.Item2.Add(entry);

            int oldIndex = curIndex;

            if (curIndex < 0)
            {
                curIndex = 0;
            }
            else if (curIndex >= mEventList.Count)
            {
                curIndex = mEventList.Count - 1;
            }

            UpdateIndex();

            // don't update if the event is for a different entry
            int index = mEventList.FindIndex((x) => { return(id.CompareTo(x) == 0); });

            if (curIndex != index)
            {
                return;
            }

            LoadCurrent(oldIndex == curIndex);
        }