예제 #1
0
        public void BasicNotifyTest()
        {
            ProjectData project1 = new ProjectData(1);
            var startPoint1 = DateTime.Now;
            DataItem item1 = new DataItem(1, startPoint1);
            Assert.AreEqual(startPoint1, item1.StartPoint);
            Assert.IsNull(item1.EndPoint);
            Assert.AreEqual(1, item1.ItemType);

            project1.Data.Add(item1);
            Assert.AreEqual(1, project1.Data.Count);

            Assert.AreEqual(startPoint1, project1.StartPoint);
            Assert.AreEqual(startPoint1, project1.EndPoint);

            var endPoint1 = startPoint1.AddMinutes(5);
            item1.EndPoint = endPoint1;

            Assert.AreEqual(endPoint1, project1.EndPoint);

            project1.Data.Add(new DataItem(1, startPoint1.AddMinutes(2), null));

            var endPoint2 = startPoint1.AddMinutes(10);
            project1.Data.Add(new DataItem(1, startPoint1.AddMinutes(2), endPoint2));

            Assert.AreEqual(endPoint2, project1.EndPoint);
        }
 public DataItemViewModel(DiagramViewModel parentViewModel, DataItem data, int index, IntervalBarSeries intervallBarSeries)
 {
     this.dataViewModels = new List<DataItemViewModel>();
     this.ParentViewModel = parentViewModel;
     this.Data = data;
     this.Index = index;
     this.intervallBarSeries = intervallBarSeries;
     this.Data.PropertyChanged += this.Data_PropertyChanged;
     this.Data.Children.CollectionChanged += this.Children_CollectionChanged;
     this.CreateView();
 }
예제 #3
0
        public void NotifyTestWithSubItems()
        {
            ProjectData project1 = new ProjectData(1);
            var startPoint1 = DateTime.Now;
            var endPoint1 = startPoint1.AddMinutes(5);
            DataItem item1 = new DataItem(1, startPoint1, endPoint1);
            project1.Data.Add(item1);
            Assert.AreEqual(endPoint1, project1.EndPoint);

            var endPoint2 = startPoint1.AddMinutes(10);
            item1.Children.Add(new DataItem(1, startPoint1.AddMinutes(2), endPoint2));

            Assert.AreEqual(endPoint2, project1.EndPoint);
        }
예제 #4
0
        /// <summary>
        /// Creates the specified item type.
        /// </summary>
        /// <param name="itemType">Type of the item.</param>
        /// <param name="startPoint">The start point.</param>
        /// <param name="endPoint">The end point.</param>
        /// <param name="subItems">The sub items.</param>
        /// <returns>New create instance of <see cref="DataItem"/>.</returns>
        public static DataItem Create(int itemType, DateTime startPoint, DateTime? endPoint = null, params DataItem[] subItems)
        {
            var item = new DataItem(itemType, startPoint, endPoint);
            foreach (var subItem in subItems)
            {
                item.Children.Add(subItem);
            }

            return item;
        }
예제 #5
0
        /// <summary>
        /// Adds the item.
        /// </summary>
        /// <param name="itemType">Type of the item.</param>
        /// <param name="startPoint">The start point.</param>
        /// <param name="endPoint">The end point.</param>
        /// <param name="subItems">The sub items.</param>
        /// <returns>This DataItem instance.</returns>
        public DataItem AddItem(int itemType, DateTime startPoint, DateTime?endPoint = null, params DataItem[] subItems)
        {
            DataItem child = Create(itemType, startPoint, endPoint, subItems);

            return(this);
        }