private void CreateNewItem()
        {
            using (var editor = new TimeFrameEditor())
            {
                var result = editor.ShowDialog(this);
                if (result != DialogResult.OK)
                    return;

                var newTimeFrame = editor.CreateTimeFrame();
                var listViewItem = CreateListViewItemFromTimeFrame(newTimeFrame);
                ListView.Items.Add(listViewItem);
                ItemCollectionChanged?.Invoke(this, EventArgs.Empty);
            }
        }
        private void EditSelectedItem()
        {
            var selected = GetSelectedItems().FirstOrDefault();
            if (selected == null)
            {
                MessageBox.Show(this, "No item selected.", "No item selected", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            using (var editor = new TimeFrameEditor((TimeFrame)selected.Tag))
            {
                var result = editor.ShowDialog(this);
                if (result != DialogResult.OK)
                    return;

                ListView.Items.Remove(selected);
                var newTimeFrame = editor.CreateTimeFrame();
                var listViewItem = CreateListViewItemFromTimeFrame(newTimeFrame);
                ListView.Items.Add(listViewItem);
                ItemCollectionChanged?.Invoke(this, EventArgs.Empty);
            }
        }