Exemple #1
0
 /// <summary>
 /// Sets the KryptonUACShieldInstallUpdateButton to the value of value.
 /// </summary>
 /// <param name="value">The desired value of KryptonUACShieldInstallUpdateButton.</param>
 private void SetKryptonUACShieldInstallUpdateButton(KryptonUACShieldButton value)
 {
     KryptonUACShieldInstallUpdateButton = value;
 }
Exemple #2
0
        /// <summary>
        /// Downloads the file.
        /// </summary>
        /// <param name="downloadClient">The download client.</param>
        /// <param name="sourcePath">The source path.</param>
        /// <param name="destinationPath">The destination path.</param>
        /// <param name="downloadSource">The download source.</param>
        /// <param name="downloadDestination">The download destination.</param>
        /// <param name="amountDownloaded">The amount downloaded.</param>
        /// <param name="currentSpeed">The current speed.</param>
        /// <param name="downloadPercentage">The download percentage.</param>
        /// <param name="downloadProgress">The download progress.</param>
        /// <param name="installUpdateButton">The install update button.</param>
        /// <param name="kryptonInstallUpdateButton">The krypton install update button.</param>
        /// <param name="kryptonUACShieldInstallUpdateButton">The krypton UAC shield install update button.</param>
        /// <param name="hypertextTransferProtocolType">Type of the hypertext transfer protocol.</param>
        public void DownloadFile(WebClient downloadClient, string sourcePath, string destinationPath, KryptonLabel downloadSource = null, KryptonLabel downloadDestination = null, KryptonLabel amountDownloaded = null, KryptonLabel currentSpeed = null, KryptonLabel downloadPercentage = null, ProgressBar downloadProgress = null, Button installUpdateButton = null, KryptonButton kryptonInstallUpdateButton = null, KryptonUACShieldButton kryptonUACShieldInstallUpdateButton = null, HypertextTransferProtocolType hypertextTransferProtocolType = HypertextTransferProtocolType.HYPERTEXTTRANSFERPROTOCOL)
        {
            try
            {
                xmlFileApplicationUpdaterSettingsManager.SetUpdatePackageServerURLDownloadLocation(sourcePath);

                internalApplicationUpdaterSettingsManager.SetDestinationDownloadPath(destinationPath);

                if (kryptonUACShieldInstallUpdateButton != null)
                {
                    if (destinationPath != null)
                    {
                        kryptonUACShieldInstallUpdateButton.ProcessName = destinationPath;
                    }
                }

                #region Setting Variables Up
                SetDownloadClient(downloadClient);

                SetDownloadSource(downloadSource);

                SetDownloadDestination(downloadDestination);

                SetAmountDownloaded(amountDownloaded);

                SetCurrentSpeed(currentSpeed);

                SetDownloadPercentage(downloadPercentage);

                SetDownloadProgress(downloadProgress);

                SetInstallUpdateButton(installUpdateButton);

                SetKryptonInstallUpdateButton(kryptonInstallUpdateButton);

                SetKryptonUACShieldInstallUpdateButton(kryptonUACShieldInstallUpdateButton);
                #endregion

                if (GetDownloadClient() != null)
                {
                    using (DownloadClient = new WebClient())
                    {
                        GetDownloadClient().DownloadFileCompleted += DownloadFileCompleted;

                        GetDownloadClient().DownloadProgressChanged += DownloadProgressChanged;

                        GetDownloadClient().Disposed += Disposed;

                        Uri uri = sourcePath.StartsWith("http://", StringComparison.OrdinalIgnoreCase) ? new Uri(sourcePath) : new Uri("http://" + sourcePath);

                        try
                        {
                            GetDownloadClient().DownloadFile(uri, destinationPath);
                        }
                        catch (Exception e)
                        {
                            if (_globalMethods.GetIsTargetPlatformSupported())
                            {
                                _exceptionHandler.ShowException($"Error: { e.Message }", true, false, false, false, false, null, null, "An Error has Occurred", MessageBoxButtons.OK, MessageBoxDefaultButton.Button1, MessageBoxIcon.Error);
                            }
                            else
                            {
                            }
                        }
                    }
                }
            }
            catch (Exception e)
            {
                if (_globalMethods.GetIsTargetPlatformSupported())
                {
                    _exceptionHandler.ShowException($"Error: { e.Message }", true, false, false, false, false, null, null, "An Error has Occurred", MessageBoxButtons.OK, MessageBoxDefaultButton.Button1, MessageBoxIcon.Error);
                }
                else
                {
                }
            }
        }