Exemple #1
0
        public async Task Upgrade(ProgramInformation pi)
        {
            if (!pi.UpgradeAvailable)
            {
                throw new Exception("Program does not have an upgrade available");
            }
            string[]            packages   = { pi.Name };
            ChocoUpgradeCommand upgradeCmd = Choco.CreateUpgradeCommand(packages: packages);

            upgradeCmd.OnCommandRunning += Cmd_OnCommandRunning;
            upgradeCmd.OnCommandUpdated += Cmd_OnCommandUpdated;
            await upgradeCmd.Run();
        }
Exemple #2
0
        public async Task UpgradeAll()
        {
            List <String> packages = new List <string>();

            for (int i = 0; i < this.Count; i++)
            {
                if (this[i].UpgradeAvailable)
                {
                    packages.Add(this[i].Name);
                }
            }

            ChocoUpgradeCommand upgradeCmd = Choco.CreateUpgradeCommand(packages.ToArray <String>());

            upgradeCmd.OnCommandRunning += Cmd_OnCommandRunning;
            upgradeCmd.OnCommandUpdated += Cmd_OnCommandUpdated;
            await upgradeCmd.Run();
        }