-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSelectFolders.cs
87 lines (77 loc) · 2.23 KB
/
SelectFolders.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Collections.Specialized;
namespace DuplicateDetector
{
public partial class SelectFolders : UserControl
{
public SelectFolders()
{
InitializeComponent();
RefreshPriorityItemsButtons();
}
public StringCollection SelectedItems
{
get
{
StringCollection selectedItems = new StringCollection();
foreach (ListViewItem item in lstPriorityFolders.Items)
{
selectedItems.Add(item.Text);
}
return selectedItems;
}
set
{
StringCollection selectedItems = value;
var items = selectedItems;
if (items != null)
{
foreach (string item in items)
{
lstPriorityFolders.Items.Add(item);
}
}
RefreshPriorityItemsButtons();
}
}
public string Description
{
get
{
return lblPriorityFolderLocations.Text;
}
set
{
lblPriorityFolderLocations.Text=value;
}
}
private void btnRemoveItem_Click(object sender, EventArgs e)
{
foreach (ListViewItem item in lstPriorityFolders.SelectedItems)
{
lstPriorityFolders.Items.Remove(item);
}
RefreshPriorityItemsButtons();
}
private void btnAddItem_Click(object sender, EventArgs e)
{
if (selectFolderDialog.ShowDialog() == DialogResult.OK)
{
lstPriorityFolders.Items.Add(selectFolderDialog.SelectedPath);
}
RefreshPriorityItemsButtons();
}
private void RefreshPriorityItemsButtons()
{
btnRemoveItem.Enabled = (lstPriorityFolders.Items.Count != 0);
}
}
}