Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
08/29/13 11:43:55 (11 years ago)
Author:
ascheibe
Message:

#2100 added a help button to View which opens and displays help texts if a help resource path is specified in the view attribute

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.MainForm/3.3/ViewAttribute.cs

    r9456 r9915  
    2828    public ViewAttribute(string name) {
    2929      this.name = name;
     30      this.helpResourcePath = string.Empty;
     31    }
     32
     33    public ViewAttribute(string name, string helpResourcePath) {
     34      this.name = name;
     35      this.helpResourcePath = helpResourcePath;
    3036    }
    3137
     
    3440      get { return this.name; }
    3541      set { this.name = value; }
     42    }
     43
     44    private string helpResourcePath;
     45    public string HelpResourcePath {
     46      get { return this.helpResourcePath; }
     47      set { this.helpResourcePath = value; }
    3648    }
    3749
     
    4759      return viewType.Name;
    4860    }
     61
     62    public static string GetHelpResourcePath(MemberInfo viewType) {
     63      ViewAttribute[] attributes = (ViewAttribute[])viewType.GetCustomAttributes(typeof(ViewAttribute), false);
     64      if (attributes.Length == 1)
     65        return attributes[0].helpResourcePath;
     66      return string.Empty;
     67    }
     68
     69    public static bool HasHelpResourcePath(MemberInfo viewType) {
     70      ViewAttribute[] attributes = (ViewAttribute[])viewType.GetCustomAttributes(typeof(ViewAttribute), false);
     71      if (attributes.Length == 1)
     72        return attributes[0].helpResourcePath != string.Empty;
     73      return false;
     74    }
    4975  }
    5076}
Note: See TracChangeset for help on using the changeset viewer.