Example #1
0
        public object GetProperty(KnowledgeBase.Record kbrec)
        {
            if (Properties == null || !Properties.ContainsKey(kbrec))
            {
                return(0.0);
            }

            return(Properties[kbrec]);
        }
Example #2
0
        public void Delete(KnowledgeBase.Record record)
        {
            KB.Records.Remove(record);

            foreach (var input in Inputs)
            {
                if (input.KBRec == record)
                {
                    input.KBRec = null;
                }
            }

            ItemDelete(this, new DeletionEventArgs {
                DeletedObject = record
            });
        }
        internal EditWidgetKnowledgeBaseRecord(KnowledgeBase.Record rec, Project project)
        {
            InitializeComponent();
            EditingRec     = rec;
            EditingProject = project;

            RecordTagEditBox.Text = EditingRec.ReadableName;

            if (EditingRec.Computed)
            {
                OriginComboBox.SelectedIndex = 1;
            }
            else
            {
                OriginComboBox.SelectedIndex = 0;
            }

            ClampingBehaviorComboBox.SelectedIndex = (int)EditingRec.Params;

            if (EditingRec.Params == KnowledgeBase.Record.Parameterization.Enumeration)
            {
                UpdateEnumeration();
            }
            else
            {
                RangeMinimum.Value = (decimal)EditingRec.MinimumValue;
                RangeMaximum.Value = (decimal)EditingRec.MaximumValue;
            }

            if (EditingRec.Prefab != KnowledgeBase.Record.Prefabs.NoPrefab)
            {
                PrefabComboBox.SelectedIndex = (int)(EditingRec.Prefab) - 1;
            }
            else
            {
                PrefabPanel.Visible = false;
            }

            Paint += (obj, args) =>
            {
                args.Graphics.DrawLine(SystemPens.ButtonShadow, 0, Height - 1, Width, Height - 1);
            };
        }
Example #4
0
        internal EditWidgetKnowledgeBaseRecord(KnowledgeBase.Record rec, Project project)
        {
            InitializeComponent();
            EditRec     = rec;
            EditProject = project;

            RecordTagEditBox.Text = EditRec.ReadableName;

            if (EditRec.Computed)
            {
                OriginComboBox.SelectedIndex = 1;
            }
            else
            {
                OriginComboBox.SelectedIndex = 0;
            }

            ClampingBehaviorComboBox.SelectedIndex = (int)EditRec.Params;
        }
Example #5
0
 internal DictionaryPropertyDescriptor(Dictionary <KnowledgeBase.Record, object> dict, KnowledgeBase.Record key)
     : base(key.ReadableName, null)
 {
     Wrap = new KBPropertyWrapper <T>(dict, key);
 }
Example #6
0
 internal KBPropertyWrapper(Dictionary <KnowledgeBase.Record, object> dict, KnowledgeBase.Record key)
 {
     PropertyDict = dict;
     Record       = key;
 }