// Show the short URL in the window after the long URL has been converted private void Shorten_URL(object sender, RoutedEventArgs e) { shortURL.Text = URLShortener.ShortenURL(longURL.Text); // The short URL was retrieved successfully if (shortURL.Text.Length > 0) { copy.Visibility = System.Windows.Visibility.Visible; clear.Visibility = System.Windows.Visibility.Visible; } }
public UploadResult ShortenURL(string url) { URLShortenerService service = UploaderFactory.URLShortenerServices[Info.TaskSettings.URLShortenerDestination]; if (!service.CheckConfig(Program.UploadersConfig)) { return(GetInvalidConfigResult(service)); } URLShortener urlShortener = service.CreateShortener(Program.UploadersConfig, taskReferenceHelper); if (urlShortener != null) { return(urlShortener.ShortenURL(url)); } return(null); }