Beispiel #1
0
        /// <summary>
        /// Add a new source folder
        /// </summary>
        /// <param name="sender">Sender (not used)</param>
        /// <param name="e">Event arguments (not used)</param>
        private void OnFolderAdd(object sender, EventArgs e)
        {
            FolderRecord Dialog = new FolderRecord(FoldersListBox.Items, -1);

            if (Dialog.ShowDialog(this) != DialogResult.OK)
            {
                return;
            }
            // insert based on sort order
            FoldersListBox.Items.Insert(Dialog.FolderIndex, Dialog.NewFolder);
            FoldersListBox.SelectedIndex = Dialog.FolderIndex;
            Modified = true;
            FolderModifyButton.Enabled = true;
            if (FoldersListBox.Items.Count > 1)
            {
                FolderDeleteButton.Enabled = true;
            }
            return;
        }
Beispiel #2
0
        /// <summary>
        /// Modify source folder
        /// </summary>
        /// <param name="sender">Sender (not used)</param>
        /// <param name="e">Event arguments (not used)</param>
        private void OnFolderModify(object sender, EventArgs e)
        {
            int Index = FoldersListBox.SelectedIndex;

            if (Index < 0)
            {
                return;
            }
            FolderRecord Dialog = new FolderRecord(FoldersListBox.Items, Index);

            if (Dialog.ShowDialog(this) != DialogResult.OK)
            {
                return;
            }

            // folder index
            int NewIndex = Dialog.FolderIndex;

            // modify text only
            if (NewIndex == Index)
            {
                FoldersListBox.Items[Index] = Dialog.NewFolder;
                Modified = true;
                return;
            }

            // delete
            FoldersListBox.Items.RemoveAt(Index);

            // adjust new index
            if (Index < NewIndex)
            {
                NewIndex--;
            }

            // insert based on sort order
            FoldersListBox.Items.Insert(NewIndex, Dialog.NewFolder);
            FoldersListBox.SelectedIndex = NewIndex;
            Modified = true;
            return;
        }