Пример #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("This can be reversed. Are you sure?", "Confirm deletion",
                                MessageBoxButtons.YesNo,
                                MessageBoxIcon.Question,
                                MessageBoxDefaultButton.Button1) == System.Windows.Forms.DialogResult.Yes)
            {
                string pathStr = GetPathStr();

                if (pathStr != null)
                {
                    List <string> path   = GeneralUse.Split(pathStr, ';');
                    int           offset = 0;
                    foreach (ListViewItem item in listView1.SelectedItems)
                    {
                        path.RemoveAt(item.Index - offset);
                        ++offset;
                    }

                    string newPathStr = GeneralUse.Join(path, ';');

                    SetPathStr(newPathStr);
                }
                else
                {
                    MessageBox.Show("Error loading path, please restart the app.");
                }
            }

            UploadPathEntriesList();
        }
Пример #2
0
        private void UploadPathEntriesList()
        {
            string pathStr = GetPathStr();

            if (pathStr != null)
            {
                List <string> path = GeneralUse.Split(pathStr, ';');

                listView1.Items.Clear();

                foreach (string s in path)
                {
                    ListViewItem list = new ListViewItem(s);
                    listView1.Items.Add(list);
                }
            }
            else
            {
                MessageBox.Show("Error loading path, please restart the app.");
            }
        }