Exemple #1
0
 public virtual object GetFormRegionIcon(object formRegionName, object lcid, object icon)
 {
     try
     {
         FormRegionAttribute attribute = FormRegionAttribute.GetAttribute(Type, (string)formRegionName, (int)lcid);
         if (null != attribute)
         {
             Enums.OlFormRegionIcon olIcon = (Enums.OlFormRegionIcon)icon;
             if (attribute.OlIconWildcard)
             {
                 var readIcon = Utils.Resource.ReadIcon(attribute.IconFile);
                 return(Utils.Image.ToPicture(readIcon));
             }
             if (attribute.OlIcon == olIcon)
             {
                 var readIcon = Utils.Resource.ReadIcon(attribute.IconFile);
                 return(Utils.Image.ToPicture(readIcon));
             }
             return(null);
         }
         else
         {
             return(null);
         }
     }
     catch (NetRuntimeSystem.Exception exception)
     {
         OnOutlookError(OutlookErrorMethodKind.GetFormRegionIcon, exception);
         return(null);
     }
 }
 /// <summary>
 /// Get FormRegion attributes
 /// </summary>
 /// <param name="type">type to analyze</param>
 /// <returns>attributes</returns>
 public static IEnumerable <FormRegionAttribute> GetAttributes(Type type)
 {
     object[] attributes          = type.GetCustomAttributes(typeof(FormRegionAttribute), true);
     FormRegionAttribute[] result = new FormRegionAttribute[attributes.Length];
     for (int i = 0; i < attributes.Length; i++)
     {
         result[i] = attributes[i] as FormRegionAttribute;
     }
     return(result);
 }
Exemple #3
0
 public virtual object GetFormRegionManifest([MarshalAs(19)][In] string FormRegionName, [In] int LCID)
 {
     try
     {
         FormRegionAttribute attribute = FormRegionAttribute.GetAttribute(Type, (string)FormRegionName, (int)LCID);
         if (null != attribute)
         {
             return(Utils.Resource.ReadString(CustomUIAttribute.BuildPath(attribute.ManifestFile, true, Type.Namespace)));
         }
         else
         {
             return(null);
         }
     }
     catch (NetRuntimeSystem.Exception exception)
     {
         OnOutlookError(OutlookErrorMethodKind.GetFormRegionManifest, exception);
         return(null);
     }
 }
Exemple #4
0
 public virtual object GetFormRegionStorage(object formRegionName, object item, object lcid, object formRegionMode, object formRegionSize)
 {
     try
     {
         FormRegionAttribute attribute = FormRegionAttribute.GetAttribute(Type, (string)formRegionName, (int)lcid);
         if (null != attribute)
         {
             return(Utils.Resource.ReadBytes(CustomUIAttribute.BuildPath(attribute.StorageFile, true, Type.Namespace)));
         }
         else
         {
             return(null);
         }
     }
     catch (NetRuntimeSystem.Exception exception)
     {
         OnOutlookError(OutlookErrorMethodKind.GetFormRegionStorage, exception);
         return(null);
     }
 }
Exemple #5
0
 private static void UnregisterHandleFormRegionAttribute(Type type)
 {
     try
     {
         var formAttributes = FormRegionAttribute.GetAttributes(type);
         foreach (var item in formAttributes)
         {
             RegistryLocationAttribute location = AttributeReflector.GetRegistryLocationAttribute(type);
             bool            isSystem           = location.IsMachineAddinTarget();
             ProgIdAttribute progId             = AttributeReflector.GetProgIDAttribute(type);
             FormRegionAttribute.TryDeleteKey(isSystem, _formRegionsOfficeRegistryKey, progId.Value, item.Category, item.Name);
         }
     }
     catch (System.Exception exception)
     {
         DebugConsole.Default.WriteException(exception);
         if (!RegisterErrorHandler.RaiseStaticErrorHandlerMethod(type, RegisterErrorMethodKind.Register, exception))
         {
             throw;
         }
     }
 }