Exemple #1
0
		private bool CheckDownloadFromUri()
		{
			using (var dlog = new DownloadApplianceDialog(m_textBoxFile.Text))
			{
				if (dlog.ShowDialog(ParentForm) == DialogResult.Yes && !string.IsNullOrEmpty(dlog.DownloadedPath))
				{
					m_textBoxFile.Text = dlog.DownloadedPath;
					return true;
				}
				return false; //an error happened during download or the user cancelled
			}
		}
        private bool CheckDownloadFromUri(out string error)
        {
            error = string.Empty;
            Uri uri;
            try
            {
                uri = new Uri(m_textBoxFile.Text);
            }
            catch (ArgumentNullException)
            {
                error = Messages.IMPORT_SELECT_APPLIANCE_PAGE_ERROR_INVALID_URI;
                return false;
            }
            catch (UriFormatException)
            {
                error = Messages.IMPORT_SELECT_APPLIANCE_PAGE_ERROR_INVALID_URI;
                return false;
            }

            using (var dlog = new DownloadApplianceDialog(uri))
            {
                if (dlog.ShowDialog(ParentForm) == DialogResult.Yes && !string.IsNullOrEmpty(dlog.DownloadedPath))
                {
                    m_textBoxFile.Text = dlog.DownloadedPath;
                    return true;
                }
                return false; //an error happened during download or the user cancelled
            }
        }