Hi
i've recently moved to framework 2.0 and i need to port a 1.1 application to 2.0 and also write code compatible with compact framework.
Actually i've found a strange behaviuor about a couple of things.
The first is retrieving implemented interfaces and classes from an external assembly:
//get types inside the assembly
foreach(Type piType in pluginAssembly.GetTypes())
{
//search interfaces
foreach (Type ift in piType.GetInterfaces())
{
//is the one i'm interested?
//not working anymore: gets null result
//if (ift == Type.GetType("IUiOptmod"))
// {
//...
// }
//this works instead
if (ift == typeof(IUiOptmod))
{
Am i missing something? what's changed form 1.1 to 2.0?
The other problem is related to menu merging, since compact framework doesn't support mergemenu() i replaced it with e loop on the new menu menuitem collection:
//replaces rootMnu.MergeMenu(newRoot)
//option1:
//foreach (MenuItem it in newRoot.MenuItems)
//option2:
for (int ii = 0; ii < newRoot.MenuItems.Count;ii++ )
{
MenuItem temp = newRoot.MenuItems[ii];
//rootMnu.MenuItems.Add(it);option1
rootMnu.MenuItems.Add(temp);//option2
}
the weird thing is that when i add the menu to rootMnu, it gets removed from newRoot collection. Is that a known menuitem peculiarity i wasn't aware or there's something wrong in my code? obviously the count get changed and i've got wrong behaviour in best cases.
Thank in advance for any answer
sbit72
i've recently moved to framework 2.0 and i need to port a 1.1 application to 2.0 and also write code compatible with compact framework.
Actually i've found a strange behaviuor about a couple of things.
The first is retrieving implemented interfaces and classes from an external assembly:
//get types inside the assembly
foreach(Type piType in pluginAssembly.GetTypes())
{
//search interfaces
foreach (Type ift in piType.GetInterfaces())
{
//is the one i'm interested?
//not working anymore: gets null result
//if (ift == Type.GetType("IUiOptmod"))
// {
//...
// }
//this works instead
if (ift == typeof(IUiOptmod))
{
Am i missing something? what's changed form 1.1 to 2.0?
The other problem is related to menu merging, since compact framework doesn't support mergemenu() i replaced it with e loop on the new menu menuitem collection:
//replaces rootMnu.MergeMenu(newRoot)
//option1:
//foreach (MenuItem it in newRoot.MenuItems)
//option2:
for (int ii = 0; ii < newRoot.MenuItems.Count;ii++ )
{
MenuItem temp = newRoot.MenuItems[ii];
//rootMnu.MenuItems.Add(it);option1
rootMnu.MenuItems.Add(temp);//option2
}
the weird thing is that when i add the menu to rootMnu, it gets removed from newRoot collection. Is that a known menuitem peculiarity i wasn't aware or there's something wrong in my code? obviously the count get changed and i've got wrong behaviour in best cases.
Thank in advance for any answer
sbit72