示例#1
0
 protected void WriteProperty <T>(string category, string page, string property, T value)
 {
     try
     {
         var prop = AddIn.TextDocument.DTE.get_Properties(category, page);
         prop.Item(property).Value = value;
     }
     catch (Exception ex)
     {
         AddIn.Error(String.Format("Failed to WriteProperty('{0}', '{1}', '{2}')", category, page, property), ex);
     }
 }
示例#2
0
 protected T ReadProperty <T>(string category, string page, string property, T defaultValue)
 {
     try
     {
         var prop = AddIn.TextDocument.DTE.get_Properties(category, page);
         return(( T )prop.Item(property).Value);
     }
     catch (Exception ex)
     {
         AddIn.Error(String.Format("Failed to ReadProperty('{0}', '{1}', '{2}')", category, page, property), ex);
         return(defaultValue);
     }
 }