Пример #1
0
 private void btnAddUrl_Click(object sender, EventArgs e)
 {
     using (UrlDialog form = new UrlDialog())
     {
         if (form.ShowDialog() == DialogResult.OK)
         {
             ListViewItem item = new ListViewItem(new string[] { form.Url, "1" });
             item.Tag = URL_TAG;
             lstPatches.Items.Add(item);
         }
     }
 }
Пример #2
0
        private void lstPatches_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            if (lstPatches.SelectedItems.Count <= 0)
            {
                return;
            }

            ListViewItem item = lstPatches.SelectedItems[0];

            string fileOrUrl = item.SubItems[0].Text;

            if (item.Tag.ToString() == FILE_TAG)
            {
                openFileDialog.FileName = fileOrUrl;

                if (openFileDialog.ShowDialog() == DialogResult.OK)
                {
                    fileOrUrl = openFileDialog.FileName;
                }
            }
            else if (item.Tag.ToString() == URL_TAG)
            {
                using (UrlDialog form = new UrlDialog())
                {
                    form.Url = fileOrUrl;

                    if (form.ShowDialog() == DialogResult.OK)
                    {
                        fileOrUrl = form.Url;
                    }
                }
            }
            else
            {
            }


            item.SubItems[0].Text = fileOrUrl;
        }
Пример #3
0
 string AskForUrl()
 {
     string url = null;
     UrlDialog dlg = new UrlDialog (null);
     if (dlg.Run () == (int) ResponseType.Accept)
       {
           url = dlg.Url;
       }
     dlg.Destroy ();
     return url;
 }