Exemple #1
0
        private async void buttonOk_Click(object sender, EventArgs e)
        {
            buttonOk.Enabled = false;
            string URL = FixUrl(textBoxUrl.Text);

            try
            {
                // Use the Uri class for quick validation of the URL.
                new Uri(URL);
            }
            catch
            {
                MessageBox.Show("The URL is invalid", Application.ProductName,
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            bookmark.Title   = textBoxCaption.Text;
            bookmark.Url     = URL;
            bookmark.FavIcon = await Bookmark.GetFavIconAsyc(URL);

            Close();
        }