示例#1
0
        /// <summary>
        /// Adds a button to the settings menu
        /// </summary>
        /// <param name="methodName">The name of the method to call when the button is pressed</param>
        /// <returns>The UIElement that has been added to the panel</returns>
        public UIElement AddButtonElement(string methodName)
        {
            var method = GetType().GetMethod(methodName, BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static);

            if (method == null)
            {
                throw new Exception("The method " + methodName + " does not exist on the type " + GetType().FullName);
            }
            return(AddButtonElement(method, SettingsScreen.GetDisplayNameOfMember(method), SettingsScreen.GetDescriptionOfMember(method)));
        }
示例#2
0
        /// <summary>
        /// Adds a UI element to the panel for displaying the property in the settings menu.
        ///
        /// Returns null if the Settings Menu isn't open or the property is not compatible
        /// </summary>
        /// <param name="propertyName">The name of the property to display</param>
        /// <returns>The UIElement that has been added to the panel</returns>
        public UIElement AddPropertyElement(string propertyName)
        {
            var property = GetType().GetProperty(propertyName, BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance);

            if (property == null)
            {
                throw new Exception("The property " + propertyName + " does not exit on the type " + GetType().FullName);
            }
            return(AddPropertyElement(property, SettingsScreen.GetDisplayNameOfMember(property), SettingsScreen.GetDescriptionOfMember(property)));
        }
示例#3
0
        /// <summary>
        /// Adds a UI element to the panel for displaying the field in the settings menu.
        ///
        /// Returns null if the Settings Menu isn't open or the field is not compatible
        /// </summary>
        /// <param name="fieldName">The name of the field to display</param>
        /// <returns>The UIElement that has been added to the panel</returns>
        public UIElement AddFieldElement(string fieldName)
        {
            var field = GetType().GetField(fieldName, BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance);

            if (field == null)
            {
                throw new Exception("The field " + fieldName + " does not exit on the type " + GetType().FullName);
            }
            return(AddFieldElement(field, SettingsScreen.GetDisplayNameOfMember(field), SettingsScreen.GetDescriptionOfMember(field)));
        }
示例#4
0
 /// <summary>
 /// Adds a button to the settings menu
 /// </summary>
 /// <param name="methodInfo">The method to call when the button is pressed</param>
 /// <returns>The UIElement that has been added to the panel</returns>
 public UIElement AddButtonElement(MethodInfo methodInfo)
 {
     return(AddButtonElement(methodInfo, SettingsScreen.GetDisplayNameOfMember(methodInfo), SettingsScreen.GetDescriptionOfMember(methodInfo)));
 }
示例#5
0
 /// <summary>
 /// Adds a UI element to the panel for displaying the property in the settings menu.
 ///
 /// Returns null if the Settings Menu isn't open or the property is not compatible
 /// </summary>
 /// <param name="property">The property to display</param>
 /// <returns>The UIElement that has been added to the panel</returns>
 public UIElement AddPropertyElement(PropertyInfo property)
 {
     return(AddPropertyElement(property, SettingsScreen.GetDisplayNameOfMember(property), SettingsScreen.GetDescriptionOfMember(property)));
 }
示例#6
0
 /// <summary>
 /// Adds a UI element to the panel for displaying the field in the settings menu.
 ///
 /// Returns null if the Settings Menu isn't open or the field is not compatible
 /// </summary>
 /// <param name="field">The field to display</param>
 /// <returns>The UIElement that has been added to the panel</returns>
 public UIElement AddFieldElement(FieldInfo field)
 {
     return(AddFieldElement(field, SettingsScreen.GetDisplayNameOfMember(field), SettingsScreen.GetDescriptionOfMember(field)));
 }