示例#1
0
        private void CreateItems()
        {
            foreach (ChronoEntry entry in dati.Values)
            {
                if (entry.IsRunning())
                {
                    throw new ApplicationException("Timer still executing.");
                }

                List <ChronoItem> locallist = items;
                string[]          splitted  = entry.name.Split(';');
                for (int i = 0; i < splitted.Length; i++)
                {
                    string     s  = splitted[i];
                    ChronoItem ci = locallist.Find(new Predicate <ChronoItem>(delegate(ChronoItem citemp) { return(citemp.Name == s); }));
                    if (ci == null)
                    {
                        if (i == splitted.Length - 1)
                        {
                            ci = new ChronoItem(s, (int)entry.sw.ElapsedMilliseconds, entry.timesstarted);
                        }
                        else
                        {
                            ci = new ChronoItem(s, -1, -1);
                        }
                        locallist.Add(ci);
                    }
                    locallist = ci.chronoitemschildren;
                }
            }
        }
        public int Compare(object x, object y)
        {
            ChronoItem a   = x as ChronoItem;
            ChronoItem b   = y as ChronoItem;
            int        res = 0;

            if (_mode == "Name")
            {
                res = a.Name.CompareTo(b.Name);
            }
            else if (_mode == "Elapsed")
            {
                res = a.Elapsed.CompareTo(b.Elapsed);
            }
            else if (_mode == "Qty")
            {
                res = a.Qty.CompareTo(b.Qty);
            }
            else
            {
                res = a.Average.CompareTo(b.Average);
            }

            if (_order == SortOrder.Ascending)
            {
                return(-res);
            }
            else
            {
                return(res);
            }
        }
示例#3
0
        public bool IsLeaf(TreePath treePath)
        {
            ChronoItem i = (ChronoItem)treePath.FullPath[0];

            return(i.IsLeaf());
        }