コード例 #1
0
        private void step5CodeActivity_RefreshTree_ExecuteCode(object sender, EventArgs e)
        {
            if (this.GetBinding <bool>("ReloadConsoleOnCompletion"))
            {
                ConsoleMessageQueueFacade.Enqueue(new RebootConsoleMessageQueueItem(), null);
            }

            if (this.GetBinding <bool>("FlushOnCompletion"))
            {
                GlobalEventSystemFacade.FlushTheSystem();
            }

            SpecificTreeRefresher specificTreeRefresher = this.CreateSpecificTreeRefresher();

            specificTreeRefresher.PostRefreshMesseges(new PackageElementProviderRootEntityToken());

            if (this.GetBinding <bool>("ReloadConsoleOnCompletion") == false)
            {
                PackageElementProviderAvailablePackagesItemEntityToken castedEntityToken = (PackageElementProviderAvailablePackagesItemEntityToken)this.EntityToken;

                InstalledPackageInformation installedPackage = PackageManager.GetInstalledPackages().FirstOrDefault(f => f.Id == castedEntityToken.PackageId);

                var installedPackageEntityToken = new PackageElementProviderInstalledPackageItemEntityToken(
                    installedPackage.Id,
                    installedPackage.GroupName,
                    installedPackage.IsLocalInstalled,
                    installedPackage.CanBeUninstalled);

                ExecuteWorklow(installedPackageEntityToken, WorkflowFacade.GetWorkflowType("Composite.Plugins.Elements.ElementProviders.PackageElementProvider.ViewInstalledPackageInfoWorkflow"));
            }
        }
コード例 #2
0
        private void step2CodeActivity_Validate_ExecuteCode(object sender, EventArgs e)
        {
            PackageElementProviderInstalledPackageItemEntityToken castedEntityToken = (PackageElementProviderInstalledPackageItemEntityToken)this.EntityToken;

            PackageManagerUninstallProcess packageManagerUninstallProcess = PackageManager.Uninstall(castedEntityToken.PackageId);

            this.Bindings.Add("PackageManagerUninstallProcess", packageManagerUninstallProcess);

            this.Bindings.Add("FlushOnCompletion", packageManagerUninstallProcess.FlushOnCompletion);
            this.Bindings.Add("ReloadConsoleOnCompletion", packageManagerUninstallProcess.ReloadConsoleOnCompletion);

            if (packageManagerUninstallProcess.PreUninstallValidationResult.Count > 0)
            {
                this.UpdateBinding("Errors", WorkflowHelper.ValidationResultToBinding(packageManagerUninstallProcess.PreUninstallValidationResult));
            }
            else
            {
                List <PackageFragmentValidationResult> validationResult = packageManagerUninstallProcess.Validate();

                if (validationResult.Count > 0)
                {
                    this.UpdateBinding("Errors", WorkflowHelper.ValidationResultToBinding(validationResult));
                }
            }
        }
コード例 #3
0
        /// <summary>
        /// </summary>
        /// <param name="packageId"></param>
        /// <param name="groupName"></param>
        /// <returns></returns>
        public virtual PackageElementProviderInstalledPackageItemEntityToken GetInstalledPackageEntityToken(Guid packageId, string groupName)
        {
            PackageElementProviderAvailablePackagesItemEntityToken castedEntityToken = new PackageElementProviderAvailablePackagesItemEntityToken(packageId.ToString(), groupName);
            InstalledPackageInformation installedPackage = PackageManager.GetInstalledPackages().FirstOrDefault(f => f.Id == castedEntityToken.PackageId);
            PackageElementProviderInstalledPackageItemEntityToken installedPackageEntityToken = new PackageElementProviderInstalledPackageItemEntityToken(
                installedPackage.Id,
                installedPackage.GroupName,
                installedPackage.IsLocalInstalled,
                installedPackage.CanBeUninstalled);

            return installedPackageEntityToken;
        }
コード例 #4
0
        private void step2CodeActivity_Uninstall_ExecuteCode(object sender, EventArgs e)
        {
            PackageElementProviderInstalledPackageItemEntityToken castedToken = (PackageElementProviderInstalledPackageItemEntityToken)this.EntityToken;
            PackageManagerUninstallProcess packageManagerUninstallProcess     = this.GetBinding <PackageManagerUninstallProcess>("PackageManagerUninstallProcess");

            Exception exception = null;

            try
            {
                string packageServerAddress =
                    (from a in PackageManager.GetInstalledPackages()
                     where a.Id == castedToken.PackageId
                     select a.PackageServerAddress).Single();

                List <PackageFragmentValidationResult> uninstallResult = packageManagerUninstallProcess.Uninstall();

                try
                {
                    PackageServerFacade.RegisterPackageUninstall(packageServerAddress, InstallationInformationFacade.InstallationId, castedToken.PackageId, UserSettings.Username, UserSettings.UserIPAddress.ToString());
                }
                catch (Exception ex)
                {
                    LoggingService.LogWarning("UninstallRemovePackageWorkflow", ex);
                    this.UpdateBinding("UnregisterError", true);
                }

                if (uninstallResult.Count > 0)
                {
                    this.UpdateBinding("Errors", WorkflowHelper.ValidationResultToBinding(uninstallResult));
                }
            }
            catch (Exception ex)
            {
                exception = ex;

                this.UpdateBinding("Errors", new List <List <string> > {
                    new List <string> {
                        ex.Message, ""
                    }
                });
            }
        }
コード例 #5
0
        private void step5CodeActivity_RefreshTree_ExecuteCode(object sender, EventArgs e)
        {
            if (this.GetBinding<bool>("ReloadConsoleOnCompletion"))
            {
                ConsoleMessageQueueFacade.Enqueue(new RebootConsoleMessageQueueItem(), null);
            }

            if (this.GetBinding<bool>("FlushOnCompletion"))
            {
                GlobalEventSystemFacade.FlushTheSystem();
            }

            SpecificTreeRefresher specificTreeRefresher = this.CreateSpecificTreeRefresher();
            specificTreeRefresher.PostRefreshMesseges(new PackageElementProviderRootEntityToken());

            if (this.GetBinding<bool>("ReloadConsoleOnCompletion") == false)
            {

                PackageElementProviderAvailablePackagesItemEntityToken castedEntityToken = (PackageElementProviderAvailablePackagesItemEntityToken)this.EntityToken;

                InstalledPackageInformation installedPackage = PackageManager.GetInstalledPackages().FirstOrDefault(f => f.Id == castedEntityToken.PackageId);

                var installedPackageEntityToken = new PackageElementProviderInstalledPackageItemEntityToken(
                    installedPackage.Id,
                    installedPackage.GroupName,
                    installedPackage.IsLocalInstalled,
                    installedPackage.CanBeUninstalled);

                ExecuteWorklow(installedPackageEntityToken, WorkflowFacade.GetWorkflowType("Composite.Plugins.Elements.ElementProviders.PackageElementProvider.ViewInstalledPackageInfoWorkflow"));
            }

        }