Beispiel #1
0
        private void RefreshVersions()
        {
            var softwareManager = new SoftwareManager();

            latestVersionLabel.Text    = "Checking . . . ";
            installedVersionLabel.Text = "Checking . . . ";
            string latestVersion;

            var installFile = softwareManager.DownloadSoftware(System.Configuration.ConfigurationManager.AppSettings["AWSCliX64"]);

            try
            {
                latestVersion = softwareManager.GetMsiProperty(installFile, "ProductVersion").Replace(":", ".");
            }
            finally
            {
                File.Delete(installFile);
            }

            var installedVersion = softwareManager.GetInstalledSoftwareProperty("AWS Command Line Interface", "DisplayVersion");

            latestVersionLabel.Text    = latestVersion;
            installedVersionLabel.Text = string.IsNullOrEmpty(installedVersion) ? "Not installed" : installedVersion;
            installButton.Enabled      = false;
            if (string.IsNullOrEmpty(installedVersion))
            {
                installButton.Enabled   = true;
                installButton.Text      = Resources.Resources.Install;
                uninstallButton.Enabled = false;
            }
            else if (new Version(latestVersion) > new Version(installedVersion))
            {
                installButton.Enabled   = true;
                installButton.Text      = Resources.Resources.Upgrade;
                uninstallButton.Enabled = false;
            }
            else if (new Version(latestVersion) == new Version(installedVersion))
            {
                installButton.Text      = Resources.Resources.Upgrade;
                installButton.Enabled   = false;
                uninstallButton.Enabled = false;
            }

            lastCheckedLabel.Text = $@"Last checked: {DateTime.Now.ToShortDateString()} {DateTime.Now.ToShortTimeString()}";
        }
Beispiel #2
0
        private void installButton_Click(object sender, EventArgs e)
        {
            var softwareManager = new SoftwareManager();

            if (softwareManager.IsSoftwareInstalled("AWS Command Line Interface"))
            {
                UninstallSoftware("AWS Command Line Interface");
            }

            var installPath = softwareManager.DownloadSoftware(System.Configuration.ConfigurationManager.AppSettings["AWSCliX64"]);

            try
            {
                softwareManager.InstallSoftware(installPath);
            }
            finally
            {
                File.Delete(installPath);
            }

            Task.Run(() => RefreshVersions());
        }