public ServerSelectionItem Promote(int index)
        {
            if (index <= SAVED_SERVER_INDEX)
            {
                return(null);
            }

            int    savedIndex = comboBox.SelectedIndex;
            object savedItem  = comboBox.SelectedItem;

            comboBox.SelectedIndex = -1;
            ServerSelectionItem item = this[index];

            comboBox.Items.RemoveAt(index);
            comboBox.Items.Insert(SAVED_SERVER_INDEX, item);
            if (savedIndex == index)
            {
                comboBox.SelectedIndex = SAVED_SERVER_INDEX;
            }
            else
            {
                comboBox.SelectedItem = savedItem;
            }
            return(item);
        }
        private ServerSelectionItem Insert(int index, IServerSource item)
        {
            ServerSelectionItem result = new ServerSelectionItem(item);

            comboBox.Items.Insert(index, result);
            return(result);
        }
        public ServerSelectionItem SaveProfile(string filename)
        {
            int    savedIndex = comboBox.SelectedIndex;
            object savedItem  = comboBox.SelectedItem;

            comboBox.SelectedIndex = -1;
            int removedIndex         = RemoveProfile(filename);
            ServerSelectionItem item = Insert(SAVED_SERVER_INDEX, new LatestServerSource(filename, Path.GetDirectoryName(filename), Path.GetFileName(filename)));

            if (removedIndex == savedIndex)
            {
                comboBox.SelectedIndex = SAVED_SERVER_INDEX;
            }
            else
            {
                comboBox.SelectedItem = savedItem;
            }
            return(item);
        }
        public ServerSelectionItem SaveServer(Server server, string name)
        {
            int    savedIndex = comboBox.SelectedIndex;
            object savedItem  = comboBox.SelectedItem;

            comboBox.SelectedIndex = -1;
            int removedIndex         = RemoveServer(server);
            ServerSelectionItem item = Insert(SAVED_SERVER_INDEX, new SavedServerSource(server, name));

            if (removedIndex == savedIndex)
            {
                comboBox.SelectedIndex = SAVED_SERVER_INDEX;
            }
            else
            {
                comboBox.SelectedItem = savedItem;
            }
            return(item);
        }