Exemple #1
0
        public object BuildItem(BuildItemArgs args)
        {
            string entityName = args.Codon.Properties["entityName"];

            string addinFileName = AppDomain.CurrentDomain.BaseDirectory + "AddIns\\" + "Related.AddIn";
            AddIn  addin         = AddIn.Load(addinFileName);

            List <Codon> subItems = GetSubItems(entityName, addin, args);

            if (subItems.Count <= 0)
            {
                return(null);
            }

            ICSharpCode.Core.Properties properies = new ICSharpCode.Core.Properties();
            properies.Set <string>("id", "RelatedGroup");
            properies.Set <string>("type", "Group");
            properies.Set <string>("label", "${res:Related}");
            properies.Set <string>("OrderNumber", "98");
            properies.Set <string>("builderid", "RibbonPageGroupBuilder");
            Codon codon = new Codon(addin, "MenuItem", properies, args.Conditions.ToArray());

            args.SubItemNode.AddCodons(subItems);
            return(new MenuItemDescriptor(args.Caller, codon, args.BuildSubItems <object>(), args.Conditions));
        }
Exemple #2
0
 /// <summary>
 /// Creates a new memento from the state.
 /// </summary>
 ICSharpCode.Core.Properties IMementoCapable.CreateMemento()
 {
     ICSharpCode.Core.Properties p = properties;
     p.Set("StartupProject", startupProject);
     p.Set("ActiveConfiguration", activeConfiguration);
     p.Set("ActivePlatform", activePlatform);
     return(p);
 }
Exemple #3
0
 public ICSharpCode.Core.Properties CreateMemento()
 {
     ICSharpCode.Core.Properties properties = new ICSharpCode.Core.Properties();
     properties.Set("CaretOffset", textEditorControl.ActiveTextAreaControl.Caret.Offset);
     properties.Set("VisibleLine", textEditorControl.ActiveTextAreaControl.TextArea.TextView.FirstVisibleLine);
     if (textEditorControl.HighlightingExplicitlySet)
     {
         properties.Set("HighlightingLanguage", textEditorControl.Document.HighlightingStrategy.Name);
     }
     return(properties);
 }
Exemple #4
0
        private List <Codon> GetSubItems(string entityName, AddIn addin, BuildItemArgs args)
        {
            List <Codon> codonList = new List <Codon>();

            if (string.IsNullOrEmpty(entityName))
            {
                return(codonList);
            }

            var allRelationshipRoles = MetadataRepository.EntityRelationshipRoles;
            var relationshipRoles    = allRelationshipRoles.Where(role => role.Entity.PhysicalName == entityName && role.NavPanelDisplayOption == 1);

            if (relationshipRoles.Any())
            {
                foreach (var relationshipRole in relationshipRoles)
                {
                    var entityRelation = relationshipRole.EntityRelationship;
                    var relatedRole    = entityRelation.EntityRelationshipRoles
                                         .FirstOrDefault(r => r != relationshipRole &&
                                                         r.RelationshipRoleType != (int)RelationshipRoleType.Relationship);
                    if (relatedRole == null)
                    {
                        continue;
                    }
                    var commandName = relatedRole.Entity.PhysicalName;
                    if (!AuthorizationManager.CheckAccess(commandName, "Read"))
                    {
                        continue;
                    }
                    ICSharpCode.Core.Properties properies = new ICSharpCode.Core.Properties();
                    properies.Set <string>("id", commandName);
                    properies.Set <string>("type", "Item");
                    properies.Set <string>("label", "${res:" + commandName + "}");
                    properies.Set <string>("imageName", commandName);
                    properies.Set <string>("overlay", "overlay_search");
                    properies.Set <string>("Parameter", commandName);
                    properies.Set <string>("groupName", "Related");
                    properies.Set <string>("class", "Katrin.Win.RelatedModule.Commands.RelatedCommand");
                    properies.Set <string>("builderid", "BarButtonItemBuilder");
                    if (relationshipRoles.Count() > 1)
                    {
                        properies.Set <string>("RibbonStyle", "Small");
                    }

                    Codon codon = new Codon(addin, "MenuItem", properies, args.Conditions.ToArray());
                    codonList.Add(codon);
                }
            }
            return(codonList);
        }
Exemple #5
0
        private List <Codon> GetSubItems(string entityName, AddIn addin, BuildItemArgs args)
        {
            List <Codon> codonList = new List <Codon>();

            if (string.IsNullOrEmpty(entityName))
            {
                return(codonList);
            }
            List <ColumnMapping> mappingList = MetadataRepository.MappingList
                                               .Where(c => c.SourceEntityName == entityName).ToList();
            var toConverList = mappingList.Select(c => c.TargetEntityName).Distinct();

            if (toConverList.Any())
            {
                foreach (string commandName in toConverList)
                {
                    if (!AuthorizationManager.CheckAccess(commandName, "Write"))
                    {
                        continue;
                    }
                    ICSharpCode.Core.Properties properies = new ICSharpCode.Core.Properties();
                    properies.Set <string>("id", "Convert" + commandName);
                    properies.Set <string>("type", "Item");
                    properies.Set <string>("label", "${res:" + commandName + "}");
                    properies.Set <string>("imageName", commandName);
                    properies.Set <string>("Parameter", commandName);
                    properies.Set <string>("groupName", "Convert");
                    properies.Set <string>("overlay", "overlay_convert");
                    properies.Set <string>("class", "Katrin.Win.ConvertModule.Commands.CovertCommand");
                    properies.Set <string>("builderid", "BarButtonItemBuilder");
                    if (toConverList.Count() > 1)
                    {
                        properies.Set <string>("RibbonStyle", "Small");
                    }

                    Codon codon = new Codon(addin, "MenuItem", properies, args.Conditions.ToArray());
                    codonList.Add(codon);
                }
            }
            return(codonList);
        }
Exemple #6
0
        public object BuildItem(BuildItemArgs args)
        {
            //string entityName = args.Codon.Properties["entityName"];

            string addinFileName = AppDomain.CurrentDomain.BaseDirectory + "AddIns\\" + "TimeTracking.AddIn";
            AddIn  addin         = AddIn.Load(addinFileName);

            ICSharpCode.Core.Properties properies = new ICSharpCode.Core.Properties();
            //properies.Set<string>("id", "TimeTracking");
            properies.Set <string>("label", "${res:TimeTracking}");
            properies.Set <string>("class", "Katrin.Win.TimeTrackingModule.TimeTracking.TimeTrackingListView");
            foreach (var codonPro in args.Codon.Properties.Elements)
            {
                if (codonPro == "label")
                {
                    continue;
                }
                properies.Set <string>(codonPro, args.Codon.Properties[codonPro]);
            }
            Codon codon = new Codon(addin, "DockPanel", properies, args.Conditions.ToArray());

            return(new DockPanelDescriptor(args.Caller, codon));
        }
 public static void Set <T>(string property, T value)
 {
     properties.Set(property, value);
 }
Exemple #8
0
 /// <inheritdoc cref="Properties.Set{T}(string, T)"/>
 public void Set <T>(string key, T value)
 {
     properties.Set(key, value);
 }