public static bool EditExistingDefinition(IController hud, AbstractDefinition definition)
        {
            var definitionEditor = GetNewDefinitionEditor(hud, definition);

            definitionEditor.ShowDialog();

            return(definitionEditor.modified);
        }
        private void cb_DefinitionType_SelectedIndexChanged(object sender, EventArgs e)
        {
            definition = (AbstractDefinition)Activator.CreateInstance((Type)cb_DefinitionType.SelectedItem);
            definition.definitionGroup = currentDefinitionGroup;
            parameters = definition.GetParameters(hud);

            RegenerateForm();
        }
Beispiel #3
0
        protected override void MergeInternal(AbstractDefinition definition)
        {
            var d = (RelationshipAttributeDefinition)definition;

            Role                   = d.Role;
            TargetEntityName       = d.TargetEntityName;
            NavigationPropertyName = d.NavigationPropertyName;
            LookupFieldName        = d.LookupFieldName;
        }
        private void LoadExistingDefinition(AbstractDefinition existingDefinition)
        {
            currentDefinitionGroup         = existingDefinition.definitionGroup;
            cb_Group.SelectedItem          = existingDefinition.category;
            cb_DefinitionType.SelectedItem = existingDefinition.GetType();
            definition = existingDefinition;

            cb_Inverted.Checked = definition.inverted;
            parameters          = definition.GetParameters(hud);

            RegenerateForm();
        }
        private static DefinitionEditor GetNewDefinitionEditor(IController hud, AbstractDefinition definition = null)
        {
            var definitionEditor = new DefinitionEditor(hud)
            {
                Enabled = true
            };

            if (definition is null)
            {
                return(definitionEditor);
            }

            definitionEditor.LoadExistingDefinition(definition);
            definitionEditor.cb_Group.Enabled          = false;
            definitionEditor.cb_DefinitionType.Enabled = false;

            return(definitionEditor);
        }
        static void Main(string[] args)
        {
            AbstractDefinition model = Factory.Model; // get either Natif or SQL model

            while (true)
            {
                Console.WriteLine("$ Type IATA code to search for luggages, or type 'quit' to quit");
                Console.Write("> ");
                string input = Console.ReadLine();
                if (input == "quit")
                {
                    break;
                }
                Console.WriteLine("Looking for luggage " + input);
                List <BagageDefinition> bagageList = model.GetBagage(input);
                switch (bagageList.Count)
                {
                case 0:
                    // TODO create
                    BagageDefinition newBagage = readBagageAttributes();
                    if (newBagage == null)     // user quit
                    {
                        Console.WriteLine("$ Bagage creation canceled");
                        continue;
                    }
                    model.CreateBagage(newBagage);
                    Console.WriteLine("Created luggage " + newBagage.CodeIata);
                    break;

                case 1:
                    Console.WriteLine(bagageList.First());
                    break;

                default:
                    Console.WriteLine("Several luggages have been found:");
                    foreach (var bagage in bagageList)
                    {
                        Console.WriteLine("    * " + bagage + "\n");
                    }
                    break;
                }
            }
        }
 private void DoManageCurrentAbstractDefinition(AbstractDefinition definition)
 {
 }
 protected override void MergeInternal(AbstractDefinition definition)
 {
     Attributes.Merge(((ClassDefinition)definition).Attributes);
 }
        protected override void MergeInternal(AbstractDefinition definition)
        {
            var def = definition as EntityDefinition;

            IsLoaded = definition.IsLoaded;

            _attributes.AddRange(def.AttributesCollection.Definitions);

            _additionalClasses.AddRange(def.AdditionalClassesCollection.Definitions);

            _additionalInfos.AddRange(def.AdditionalInfoCollection.Definitions);
        }
 private void b_Cancel_Click(object sender, EventArgs e)
 {
     definition = null;
     Close();
 }
        protected override void MergeInternal(AbstractDefinition definition)
        {
            var def = (AttributeDefinition)definition;

            if (def.IsPrimaryIdAttribute || def.IsPrimaryImageAttribute || def.IsPrimaryNameAttribute || def.KeyNames.Any())
            {
                IsSelected = true;
            }
        }
Beispiel #12
0
 protected AbstractDestinyObject(string baseUrl, AbstractDefinition item)
     : this(item.DisplayProperties.Name, baseUrl + item.DisplayProperties.Icon, item.Hash)
 {
 }
        protected override void MergeInternal(AbstractDefinition definition)
        {
            var def = (EnumDefinition)definition;

            Values.Merge(def.Values);
        }