Exemplo n.º 1
0
        void checkUpdates(object showResult0)
        {
            bool   showResult = (bool)showResult0;
            string currentVersion;
            string webVersion;
            string assemblyName;

            try
            {
                currentVersion = Util.getAssemblyVersion();
                assemblyName   = Util.getAssemblyName().ToLower();
                webVersion     = Util.getUrl(Constants.webFilesUrl + assemblyName + "ver");
                if (webVersion != "")
                {
                    if (compareVersions(currentVersion, webVersion) > 0)
                    {
                        // newer version found
                        if (System.Windows.MessageBox.Show("New version available to download\nGo to download page now?", Util.getAssemblyTitle(),
                                                           MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes)
                        {
                            Util.openWebLink(Constants.webPage);
                        }
                        return;
                    }
                    else if (showResult)
                    {
                        // same (or older) version
                        System.Windows.MessageBox.Show("Current version is up to date.", Util.getAssemblyTitle());
                        return;
                    }
                }
            }
            catch (Exception)
            {
            }
            if (showResult)
            {
                // unable to check version
                System.Windows.MessageBox.Show("No newer version found.", Util.getAssemblyTitle());
            }
        }