示例#1
0
        private void chkSource_ItemCheck(object sender, ItemCheckEventArgs e)
        {
            string item = chkSource.Items[e.Index].ToString();

            if (e.NewValue == CheckState.Checked)
            {
                SourceFolders.Add(txtSource.Text.TrimEnd('\\') + "\\" + item);
            }
            else if (e.CurrentValue == CheckState.Checked && e.NewValue == CheckState.Unchecked)
            {
                SourceFolders.Remove(txtSource.Text.TrimEnd('\\') + "\\" + item);
            }
        }
示例#2
0
        /// <summary>
        /// Remove folder from <see cref="SourceFolders"/>
        /// </summary>
        /// <param name="folder"></param>
        /// TODO: Use dictionary instead?
        public void RemoveFolder(string folder)
        {
            // Find the item by the name of the folder
            SourceFolder item = SourceFolders.Where(sf => sf.FolderInfo.FullPath == folder).FirstOrDefault();


            // Check if the item was found
            if (item != null)
            {
                // Remove the item from the list
                SourceFolders.Remove(item);
            }
        }