void movieDetailsList_FieldChanged(DatabaseTable obj, DBField field, object value)
 {
     movieDetailsList.RepopulateValues();
     if (FieldChanged != null) FieldChanged(obj, field, value);
 }
Ejemplo n.º 2
0
        // Returns the list of DBFields for the given type. Developer should normally
        // directly use the properties of the class, but this allows for iteration.
        public static ReadOnlyCollection<DBField> GetFieldList(Type tableType)
        {
            if (tableType == null || !DatabaseManager.IsDatabaseTableType(tableType))
                return new List<DBField>().AsReadOnly();

            if (!fieldLists.ContainsKey(tableType)) {

                List<DBField> newFieldList = new List<DBField>();

                // loop through each property in the class
                PropertyInfo[] propertyArray = tableType.GetProperties();
                foreach (PropertyInfo currProperty in propertyArray) {
                    object[] customAttrArray = currProperty.GetCustomAttributes(true);
                    // for each property, loop through it's custom attributes
                    // if one of them is ours, store the property info for later use
                    foreach (object currAttr in customAttrArray) {
                        if (currAttr.GetType() == typeof(DBFieldAttribute)) {
                            DBField newField = new DBField(currProperty, (DBFieldAttribute)currAttr);
                            newFieldList.Add(newField);
                            break;
                        }
                    }
                }

                fieldLists[tableType] = newFieldList;
            }

            return fieldLists[tableType].AsReadOnly();
        }
Ejemplo n.º 3
0
 private void OnFieldChanged(DatabaseTable obj, DBField field, object value)
 {
     if (FieldChanged != null) FieldChanged(obj, field, value);
 }
        void movieDetailsSubPane_FieldChanged(DatabaseTable obj, DBField field, object value)
        {
            // reset title field as needed
            if (field == DBField.GetFieldByDBName(typeof(DBMovieInfo), "title"))
                listItems[obj as DBMovieInfo].Text = (obj as DBMovieInfo).Title;

            // resort as needed
            if (field == DBField.GetFieldByDBName(typeof(DBMovieInfo), "title") ||
                field == DBField.GetFieldByDBName(typeof(DBMovieInfo), "sortby")) {

                if (movieListBox != null) movieListBox.Sort();
            }
        }