示例#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"));
            }
        }
        /// <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;
        }
示例#3
0
        private PackageDescription GetPackageDescription()
        {
            PackageElementProviderAvailablePackagesItemEntityToken castedEntityToken = (PackageElementProviderAvailablePackagesItemEntityToken)this.EntityToken;

            PackageDescription packageDescription =
                (from description in PackageSystemServices.GetFilteredAllAvailablePackages()
                 where description.Id == castedEntityToken.PackageId
                 select description).SingleOrDefault();

            if (packageDescription == null)
            {
                this.UpdateBinding("ServerError", true);
            }

            return(packageDescription);
        }
        private void viewStateCodeActivity_Initialize_ExecuteCode(object sender, EventArgs e)
        {
            if (this.BindingExist("PackageDescription") == false)
            {
                PackageElementProviderAvailablePackagesItemEntityToken castedToken = (PackageElementProviderAvailablePackagesItemEntityToken)this.EntityToken;

                PackageDescription packageDescription =
                    (from description in PackageSystemServices.GetFilteredAllAvailablePackages()
                     where description.Id.ToString() == castedToken.Id
                     select description).SingleOrDefault();

                this.Bindings.Add("PackageDescription", packageDescription);

                if (packageDescription != null)
                {
                    // Valid package names:
                    //  "Composite.Community.Versioning"
                    //  "Composite C1 3.0"
                    string name = packageDescription.Name.Trim();

                    string documentTitle = name;

                    if (name.Contains(".") && !name.EndsWith("."))
                    {
                        string packageName      = name.Substring(name.LastIndexOf('.') + 1);
                        string packageNamespace = name.Substring(0, name.LastIndexOf('.'));

                        int temp;
                        if (!int.TryParse(packageName, out temp))
                        {
                            documentTitle = "{0} ({1})".FormatWith(packageName, packageNamespace);
                        }
                    }

                    this.Bindings.Add("DocumentTitle", documentTitle);
                    this.Bindings.Add("AddOnServerSource", PackageSystemServices.GetPackageSourceNameByPackageId(packageDescription.Id, InstallationInformationFacade.InstallationId, UserSettings.CultureInfo));
                    this.Bindings.Add("HasOwnPrice", packageDescription.PriceAmmount > 0);
                    this.Bindings.Add("PriceText", string.Format("{0} {1}", packageDescription.PriceAmmount, packageDescription.PriceCurrency));
                    this.Bindings.Add("IsInPurchasableSubscriptions", packageDescription.AvailableInSubscriptions.Any(f => f.Purchasable));
                    this.Bindings.Add("PurchasableSubscriptions",
                                      string.Join(", \n", packageDescription.AvailableInSubscriptions.Where(f => f.Purchasable).Select(f => f.Name)));
                }
            }

            this.SetCustomToolbarDefinition(new FormDefinitionFileMarkupProvider(@"\Administrative\PackageElementProviderViewAvailablePackageInformationToolbar.xml"));
        }
        private void installAddOnCodeActivity_Execute_ExecuteCode(object sender, EventArgs e)
        {
            PackageElementProviderAvailablePackagesItemEntityToken castedToken = (PackageElementProviderAvailablePackagesItemEntityToken)this.EntityToken;

            PackageDescription packageDescription =
                (from description in PackageSystemServices.GetFilteredAllAvailablePackages()
                 where description.Id.ToString() == castedToken.Id
                 select description).FirstOrDefault();

            if (packageDescription != null)
            {
#pragma warning disable 436
                this.ExecuteWorklow(this.EntityToken, typeof(InstallRemotePackageWorkflow));
#pragma warning restore 436
            }
            else
            {
                this.ShowMessage(
                    DialogType.Message,
                    "${Composite.Plugins.PackageElementProvider, ViewAvailableInformation.ShowError.MessageTitle}",
                    "${Composite.Plugins.PackageElementProvider, ViewAvailableInformation.ShowError.MessageMessage}");
            }
        }