Winkle.UpdateNotification.setDownloadLink C# (CSharp) Méthode

setDownloadLink() public méthode

public setDownloadLink ( string downloadLinkText ) : bool
downloadLinkText string
Résultat bool
        public bool setDownloadLink(string downloadLinkText)
        {
            this.updateDownloadLink = downloadLinkText;
            return true;
        }

Usage Example

Exemple #1
0
        private UpdateInfo _doUpdateCheck(int currentMajorVersion, int currentMinorVersion, int currentBuild, int currentRevision, bool includeBetaVersions)
        {
            UpdateInfo returnCode = new UpdateInfo();
            WinkleResponse = getUpdateFile(updateInfoUrl);
            if (WinkleResponse == null)
            {
                returnCode.errorCode = 1;
                returnCode.updateInfoRetrievalSuccessfull = false;
                returnCode.errorTitle = "Retrieval of update information failed";
                returnCode.errorDescription = "Cannot download the update file description from " + updateInfoUrl;
                return returnCode;
            }
            int major = getLatestMajorVersion(includeBetaVersions);
            int minor = getLatestMinorVersion(includeBetaVersions);
            int build = getLatestBuild(includeBetaVersions);
            int revision = getLatestRevision(includeBetaVersions);

            getChangeLog();
               // return returnCode;
            bool updateAvailable = false;

            if (currentMajorVersion < major)
            {
                updateAvailable = true;
            }
            else if (currentMajorVersion == major && currentMinorVersion < minor)
            {
                updateAvailable = true;
            }
            else if (currentMajorVersion == major && currentMinorVersion == minor && currentBuild < build)
            {
                updateAvailable = true;
            }
            else if (currentMajorVersion == major && currentMinorVersion == minor && currentBuild == build && currentRevision < revision)
            {
                updateAvailable = true;
            }

            if (updateAvailable)
            {
                returnCode.updateAvailable = true;
                returnCode.updateInfoRetrievalSuccessfull = true;
                returnCode.updateMajor = major;
                returnCode.updateMinor = minor;
                returnCode.updateBuild = build;

                returnCode.manualDownloadUrl = new System.Uri(getDownloadLinkUrl(includeBetaVersions));

                if(showWindowIfUpdateAvailable) {
                    Winkle.UpdateNotification myUpdateNotification = new UpdateNotification();

                    myUpdateNotification.setDownloadLink(returnCode.manualDownloadUrl.ToString());
                    string myDescription = "";
                    Version newestVersion = new Version("0.0.0.0");

                    foreach (DescriptionOfChanges myChanges in changeLog) {
                        if (myChanges.version < newestVersion)
                        {
                            myDescription += "New in " + myChanges.getFormattedVersionString() + "\n";
                            myDescription += myChanges.updateDescription;
                            myDescription += "\n--------\n";
                        }
                        else
                        {
                            string tempString = "New in " + myChanges.getFormattedVersionString() + "\n";
                            tempString += myChanges.updateDescription;
                            tempString += "\n----------\n";
                            myDescription = tempString + myDescription;
                            newestVersion = myChanges.version;
                        }
                    }
                    myUpdateNotification.setVersion(applicatenName, newestVersion.ToString());
                    myUpdateNotification.setDescription(myDescription);
                    myUpdateNotification.Show();
                }

                return returnCode;
            }

            returnCode.updateInfoRetrievalSuccessfull = true;
            return returnCode;
        }
All Usage Examples Of Winkle.UpdateNotification::setDownloadLink