/// <summary>
        /// Swap splits when a split is dragged.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void flowLayoutSplits_DragOver(object sender, DragEventArgs e)
        {
            SplitSettings draggedControl = (SplitSettings)e.Data.GetData(typeof(SplitSettings));
            SplitSettings coveredControl = flowLayoutSplits.GetChildAtPoint(flowLayoutSplits.PointToClient(new Point(e.X, e.Y))) as SplitSettings;

            if (draggedControl != coveredControl && coveredControl != null)
            {
                int draggedIndex = flowLayoutSplits.Controls.GetChildIndex(draggedControl);
                int coveredIndex = flowLayoutSplits.Controls.GetChildIndex(coveredControl, false);

                if (Math.Abs(draggedIndex - coveredIndex) > 1)
                {
                    coveredIndex   = coveredIndex > draggedIndex ? draggedIndex + 1 : draggedIndex - 1;
                    coveredControl = (SplitSettings)flowLayoutSplits.Controls[coveredIndex];
                }

                Split draggedSplit = AutosplitterSettings.Autosplits[draggedIndex];
                Split coveredSplit = AutosplitterSettings.Autosplits[coveredIndex];

                string tmpName = draggedSplit.Name;
                draggedSplit.Name = coveredSplit.Name;
                coveredSplit.Name = tmpName;

                AutosplitterSettings.Autosplits[draggedIndex] = coveredSplit;
                AutosplitterSettings.Autosplits[coveredIndex] = draggedSplit;

                draggedControl.UpdateControl();
                coveredControl.UpdateControl();
                flowLayoutSplits.Controls.SetChildIndex(draggedControl, coveredIndex);
                flowLayoutSplits.Invalidate();
            }
        }
        private void UpdateSplitControls()
        {
            // Ensure Autosplits are up to date
            bool changed = false;

            for (var i = 0; i < _state.Run.Count; i++)
            {
                ISegment segment = _state.Run[i];

                if (i >= AutosplitterSettings.Autosplits.Count)
                {
                    AutosplitterSettings.Autosplits.Add(new Split());
                    changed = true;
                }

                Split autosplit = AutosplitterSettings.Autosplits[i];

                if (segment.Name != autosplit.Name)
                {
                    autosplit.Name = segment.Name;
                    changed        = true;
                }
            }

            //Remove any extra splits
            while (AutosplitterSettings.Autosplits.Count > _state.Run.Count)
            {
                AutosplitterSettings.Autosplits.RemoveAt(AutosplitterSettings.Autosplits.Count - 1);
                changed = true;
            }

            if (changed)
            {
                flowLayoutSplits.SuspendLayout();
                flowLayoutSplits.Controls.Clear();

                foreach (Split split in AutosplitterSettings.Autosplits)
                {
                    SplitSettings splitBox = new SplitSettings(split);
                    flowLayoutSplits.Controls.Add(splitBox);
                }

                flowLayoutSplits.ResumeLayout(true);
            }
        }