Ejemplo n.º 1
0
        private static void AddOrReplace(DateTime dt, UserRecentDataCategoryItemCollection recentTimePoints)
        {
            int index = -1; // 查找是否是使用过的日期

            for (int i = 0; i < recentTimePoints.Count; i++)
            {
                if (recentTimePoints[i].GetValue("timePoint", DateTime.MinValue) == dt)
                {
                    index = i;
                    break;
                }
            }

            // 如果是使用过的数据
            if (index >= 0)
            {
                recentTimePoints.Advance(index);
            }
            else
            {
                // 新的日子
                var newItem = recentTimePoints.CreateItem();

                newItem.SetValue("timePoint", dt);

                recentTimePoints.Add(newItem);
            }
        }
Ejemplo n.º 2
0
        private IEnumerable GetRecentTimeView(UserRecentDataCategoryItemCollection recentTimePoints, int limit)
        {
            if (recentTimePoints != null)
            {
                int count = 0;
                foreach (PropertyValueCollection item in recentTimePoints)
                {
                    yield return(new { TimePoint = (DateTime)item["timePoint"].GetRealValue(), LastAccessData = (DateTime)item["lastAccessDate"].GetRealValue() });

                    count++;
                    if (count > limit)
                    {
                        break;
                    }
                }
            }

            yield break;
        }
Ejemplo n.º 3
0
		private IEnumerable GetRecentTimeView(UserRecentDataCategoryItemCollection recentTimePoints, int limit)
		{
			if (recentTimePoints != null)
			{
				int count = 0;
				foreach (PropertyValueCollection item in recentTimePoints)
				{
					yield return new { TimePoint = (DateTime)item["timePoint"].GetRealValue(), LastAccessData = (DateTime)item["lastAccessDate"].GetRealValue() };
					count++;
					if (count > limit)
						break;
				}
			}

			yield break;
		}
Ejemplo n.º 4
0
		private static void AddOrReplace(DateTime dt, UserRecentDataCategoryItemCollection recentTimePoints)
		{
			int index = -1; // 查找是否是使用过的日期

			for (int i = 0; i < recentTimePoints.Count; i++)
			{
				if (recentTimePoints[i].GetValue("timePoint", DateTime.MinValue) == dt)
				{
					index = i;
					break;
				}
			}

			// 如果是使用过的数据
			if (index >= 0)
			{
				recentTimePoints.Advance(index);
			}
			else
			{
				// 新的日子
				var newItem = recentTimePoints.CreateItem();

				newItem.SetValue("timePoint", dt);

				recentTimePoints.Add(newItem);
			}
		}