Example #1
0
        private void Delete(TimeLineItemViewModel timeLineItem)
        {
            // Remove from memory
            TimeLineItems.Remove(timeLineItem);

            // Remove from disk
            var pathToRemove = Path.Combine(_serializationDir,
                                            timeLineItem.Name + ".xml");

            if (File.Exists(pathToRemove))
            {
                File.Delete(pathToRemove);
            }
        }
        /// <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 #3
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);
            }
        }