Beispiel #1
0
        /// <summary>
        /// 今日App计时器 Key为AppName+AppPath, Value为今日剩余时间
        /// </summary>
        //public Dictionary<string, TimeSpan> AppTimers = new Dictionary<string, TimeSpan>();

        /// <summary>
        /// 获取今日小结,即为时间线内相同软件使用时间合并后的列表
        /// </summary>
        /// <returns>今日小结 - Dictionary<string, TimeSpan></returns>
        public Dictionary <string, Software> GetOverView()
        {
            List <MyTimeDuration>         myTimeDurations = new List <MyTimeDuration>(TimeLine.ToArray());
            Dictionary <string, Software> overView        = new Dictionary <string, Software>();

            foreach (MyTimeDuration item in myTimeDurations)
            {
                string nowAppName = item.TimeDurationTask.ApplicationName;
                if (string.IsNullOrEmpty(nowAppName) || nowAppName == "Frogy")
                {
                    continue;
                }

                TimeSpan duration = item.Duration;
                if (overView.ContainsKey(nowAppName))
                {
                    overView[nowAppName].Duration += duration;
                }

                else
                {
                    Software result =
                        new Software()
                    {
                        Duration = item.Duration,
                        Name     = nowAppName,
                        Icon     = MyDataHelper.BitmapToBitmapImage(
                            MyDataHelper.Base64StringToImage(item.TimeDurationTask.ApplicationIcon_Base64))
                    };
                    overView.Add(nowAppName, result);
                }
            }
            return(overView);
        }