Exemplo n.º 1
0
        // 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;
            }
        }
Exemplo n.º 2
0
        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);
        }