/// <summary>
        /// Removes the time line item at the end or after the current selection.
        /// </summary>
        public void RemoveTimeLineItem()
        {
            if (CanRemoveItem)
            {
                int index = TimeLineItems.IndexOf(SelectedTimeLineItem);
                TimeLineItemViewModel toRemove = SelectedTimeLineItem;

                // If not last item, select next, otherwise select last
                SelectedTimeLineItem = SelectedTimeLineItem != TimeLineItems.Last()
                    ? TimeLineItems[index + 1]
                    : TimeLineItems[TimeLineItems.Count() - 2];

                TimeLineItems.Remove(toRemove);

                NotifyOfPropertyChange(() => CanRemoveItem);
                NotifyOfPropertyChange(() => TimeLineItems);
            }
        }
Example #2
0
        /// <summary>
        /// Removes the time line item at the end or after the current selection.
        /// </summary>
        public void RemoveTimeLineItem()
        {
            if (CanRemoveItem)
            {
                int index = TimeLineItems.IndexOf(SelectedTimeLineItem);

                TimeLineItems.Remove(SelectedTimeLineItem);
                if (index != TimeLineItems.Count)
                {
                    SelectedTimeLineItem = TimeLineItems[index];
                }
                else
                {
                    SelectedTimeLineItem = TimeLineItems.Last();
                }
                NotifyOfPropertyChange(() => CanRemoveItem);
                NotifyOfPropertyChange(() => TimeLineItems);
            }
        }