Example #1
0
        /// <summary>
        /// Used to check the codeplex site for any updates
        /// </summary>
        /// <param name="userRequested"></param>
        public void CheckForUpdates(bool userRequested)
        {
            // First check if the user is able to connect
            // Check if the user has a proxy
            if (_proxyHelper.HasProxy())
            {
                // Open new window and prompt for user details
                ProxyAuthentication authentication = new ProxyAuthentication();
                authentication.Show();

                return;
            }

            // Go ahead and download
            string url = Properties.Settings.Default.UpdateUrl;
            Thread thread = new Thread(delegate()
            {
                WebClient webClient = new WebClient();
                webClient.DownloadDataCompleted += this.OnDownloadDataCompleted;
                webClient.DownloadDataAsync(new Uri(url), userRequested);
            }) { IsBackground = true };

            thread.Start();
        }
Example #2
0
        /// <summary>
        /// Smush images for URL
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSmush_Click(object sender, RoutedEventArgs e)
        {
            HideControls();

            // Show progress bar
            progressRing.ToggleProgressRing(true);

            string siteMapUrl = txtSiteMapUrl.Text;
            string outputUrl = txtOutputUrl.Text;

            if (txtOutputUrl.Text == string.Empty)
            {
                lblError.Content = "Please choose an output directory";
                return;
            }

            // Check if the user has a proxy
            if (_proxyHelper.HasProxy())
            {
                // Open new window and prompt for user details
                ProxyAuthentication authentication = new ProxyAuthentication();
                authentication.Show();

                // Disable the progress ring
                progressRing.ToggleProgressRing(false);

                return;
            }

            // Start a separate thread and download the images
            Observable.Start(() => SmushAndDownloadImages(siteMapUrl, outputUrl));
        }