コード例 #1
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            AddPathPopup pathPopup = new AddPathPopup();
            DialogResult result = pathPopup.ShowDialog(this);

            if (result == DialogResult.OK)
            {
                string path = pathPopup.SelectedPath;

                if (!Directory.Exists(path))
                {
                    string message = "The path entered does not exist!";
                    MessageBox.Show(message, "Path", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                // add path to list
                if (!listFolders.Items.Contains(path))
                    listFolders.Items.Add(path);
            }
        }
コード例 #2
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            AddPathPopup pathPopup = new AddPathPopup();
            DialogResult result    = pathPopup.ShowDialog(this);

            if (result == DialogResult.OK)
            {
                string path = pathPopup.SelectedPath;

                if (!Directory.Exists(path))
                {
                    string message = "The path entered does not exist!";
                    MessageBox.Show(message, "Path", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                // add path to list
                if (!listFolders.Items.Contains(path))
                {
                    listFolders.Items.Add(path);
                }
            }
        }