Apollo Software Normal layoutMedium LayoutLarge Layout    Normal TextLarge Text
Home | DotNetNuke | About ... | Downloads | Forum | Blog
United States Netherlands
Register | Login

Forum Tags

 
boolean   error   file   help   just   language   menu   mlhtml   module   modules   need   object   page   pagelocalization   problem   site   skin   string   version   work  

  

Need live support?

Please feel free to add my support e-mail address to your MSN contacts. If you catch me online, I'll be able to solve your problems faster than through this forum. Please appreciate that I only give free support on our own modules!

My msn account: support@apollo-software.nl. Alternatively, you can click the botton below, it will open up a Live Messenger window (Windows Live ID required)

  

Solution for Post: "New Module with Localization API"
Last Post 2009-01-19 16:26:54 by erikvb. 2 Replies.
AddThis - Bookmarking and Sharing Button Printer Friendly
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages Resolved
ddweirdt
New Member
New Member
Posts:2

--
2008-01-29 07:12:01  

Hi,

I have found the solution myself. Hereby i want to share the code:

        private TabInfo GetLocalizedTab(TabInfo tabInfo)
        {
            TabInfo result = tabInfo;
            try
            {
                object o = System.Activator.CreateInstance("Apollo.LocalizationApi", "Apollo.DNN_Localization.LocalizeTab").Unwrap();
                if (o != null)
                {
                    Type t = o.GetType();
                    MethodInfo m = t.GetMethod("getLocalizedTab", BindingFlags.Static | BindingFlags.Public | BindingFlags.FlattenHierarchy, null, new Type[] { typeof(TabInfo) }, new ParameterModifier[0]);
                    if (m != null)
                        result = (TabInfo)m.Invoke(null, new object[] { tabInfo });
                }
            }
            catch { }
            return result;
        }

This code uses reflextion because the posibility excists that the user doesn't have the Apollo.LocalizationApi.dll file.

PS: Sorry I started a new treat! it was ment to be a reply.

Dieter

Jelle Ossewaarde
New Member
New Member
Posts:8

--
2009-01-18 21:05:12  
Hi,

Thank you for sharing!

What is the difference in performance between including the dll and using reflection?

If there is a great penalty, can it be solved?

J.
erikvb
Advanced Member
Advanced Member
Posts:713
Avatar

--
2009-01-19 16:26:54  
if you can just reference the dll, thats certainly faster....

btw.. this is the code in VB:

Private Function LocalizeTab(ByVal tabInfo As TabInfo) As TabInfo
Dim result As TabInfo = tabInfo
Try
Dim o As Object = System.Activator.CreateInstance("Apollo.LocalizationApi", "Apollo.DNN_Localization.LocalizeTab").Unwrap()
If Not (o Is Nothing) Then
Dim t As Type = o.GetType()
Dim m As MethodInfo = t.GetMethod("getLocalizedTab", BindingFlags.Static Or BindingFlags.Public Or BindingFlags.FlattenHierarchy, Nothing, New Type() {GetType(TabInfo)}, New ParameterModifier(0) {})
If Not (m Is Nothing) Then
result = CType(m.Invoke(Nothing, New Object() {tabInfo}), TabInfo)
End If
End If
Catch
End Try
Return result
End Function
Erik van Ballegoij,
a view from my attic, my personal blog

The personal blog of Erik van Ballegoij

You are not authorized to post a reply.

Active Forums 4.1
NOT LICENSED FOR PRODUCTION USE
www.activemodules.com
  

Copyright 2002-2007 Apollo Software
Terms Of Use  |  Privacy Statement
Page generated in 1.3128948 seconds.