コード例 #1
0
 void movieDetailsList_FieldChanged(DatabaseTable obj, DBField field, object value)
 {
     movieDetailsList.RepopulateValues();
     if (FieldChanged != null) FieldChanged(obj, field, value);
 }
コード例 #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();
        }
コード例 #3
0
 private void OnFieldChanged(DatabaseTable obj, DBField field, object value)
 {
     if (FieldChanged != null) FieldChanged(obj, field, value);
 }
コード例 #4
0
        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();
            }
        }