|
As part of my app, i've used reflection to load an assembly.
Assembly.LoadFrom(filename);
This works great. But I don't want the assembly to be bound any longer. I wish to modify/move/delete the assembly from the app. but now its bound and can't be modified.
Is there a way to 'unbind' an assembly?
"If you just say porn then you get all manner of chaff and low grade stuff." - Paul Watson, Lounge 25 Mar 03 "If a man is standing in the middle of the forest speaking and there is no woman around to hear him, is he still wrong?" - Anon
Jonathan 'nonny' Newman
Homepage [www.nonny.com] [^]
|
|
|
|
|
You would have to load it in a separate AppDomain. Then when you unload the AppDomain, it'll unload the Assembly.
Hawaian shirts and shorts work too in Summer.
People assume you're either a complete nut (in which case not a worthy target) or so damn good you don't need to worry about camouflage...
-Anna-Jayne Metcalfe on Paintballing
|
|
|
|
|
Right, firstly thanks for replying, it seems like the right was of doing it and after a bit of MSDNing, i've come up with some AppDomain code.
AppDomain appd = AppDomain.CreateDomain("Plugins");
foreach(Plugin File.....)
{
Assembly a = appd.Load(fileName);
}
OK this isn't all the code but its the only code that is failing. Basically the appdomain isn't loading the files. It throws the following:
File or assembly name <path>\plugins\Plugin.dll, or one of its dependencies, was not found.
For each of the plugin files I try to load. Now when it was trying to load the files in the main appdomain, it loads them fine, but now after trying what you said, I can't get it to load them. They are not bound anywhere else and the full path is given to the appd.Load() method.
Any ideas?
"If you just say porn then you get all manner of chaff and low grade stuff." - Paul Watson, Lounge 25 Mar 03 "If a man is standing in the middle of the forest speaking and there is no woman around to hear him, is he still wrong?" - Anon
Jonathan 'nonny' Newman
Homepage [www.nonny.com] [^]
|
|
|
|
|
Look at my article on Plugin Automation, it will generate the necesary wrapper classes and Management classes for loading/unloading (note: not too handy when a plugin contains a form).
It will probably do exactly what you want to do
Hey leppie! Your "proof" seems brilliant and absurd at the same time. - Vikram Punathambekar 28 Apr '03
|
|
|
|
|
leppie wrote:
(note: not too handy when a plugin contains a form).
His plugins contain forms.
Hawaian shirts and shorts work too in Summer.
People assume you're either a complete nut (in which case not a worthy target) or so damn good you don't need to worry about camouflage...
-Anna-Jayne Metcalfe on Paintballing
|
|
|
|
|
Is there any equivalent to the GetTextMetrics function in the .NET framework? I'm trying to find the height of a font (I know I can use the Height property of a Font object) including the leading, which the height property doesn't give. If there is no equivalent could someone post an example of how to use GetTextMetrics in C#.
Thanks all!
- monrobot13
|
|
|
|
|
|
David Stone wrote:
System.Drawing.Graphics.MeasureString()
Thanks, but that doesn't work. It gives the exact same value as using the Height property of the font. I think I'm going to have to end up using GetTextMetrics, but I don't know how to create the TEXTMETRICS structure that it needs in C#.
Any help is much appreciated.
|
|
|
|
|
I have the class MyText devived from RichTextEdit and I have inside and an other structure (System.Collection.ArrayList).
In the main form I open a TabControl and like pages I use this class .
In the new class I draw ellipses .When the TabPage lose the focus the draw disapear . I override OnPaint , where I redraw everything , but this override is not doing what is meent to do .
Hwo I make the drawing to be seen on screen (ClientRectangle).
|
|
|
|
|
Save it as a picture in the richedit box?
jhaga
|
|
|
|
|
I cant do that because My project consist in a nomber unknown the ellipses
and the I whant to add others .
Thanks
|
|
|
|
|
tried using tapPage.Hide() but it has no effect, tab page still displays... I'm wanting to show a tabPage2 only when there are processing errors on tabPag1. Is there another way, or a way to dynamically add a tab page to a tab control...???
thanks,
vince
|
|
|
|
|
If the TabControl is named "tabControl" , the code for closing is :
// verify if the TabPages exist
// if we try to close a non-open tab will have error's
if (this.tabControl.TabPages.Count != 0)
this.tabControl.TabPages.Remove(this.tabControl.SelectedTab);
//SelectedTab is the selected tab tabControl.TabPages[<number>] is the
//<number> tab , if you whant other tab
|
|
|
|
|
thanks for the reply, but that's not quite what I'm looking for... I need to have either a hidden tab page that can be unhidden, or the ability to create a tab page with a listbox containing error strings...
Don't need to remove a tab page...
thanks for any further suggestions..
|
|
|
|
|
vlusardi wrote:
or a way to dynamically add a tab page to a tab control...???
Sure, try something like this, it works:
for(int i = 0; i < 5;i++)
{
TabPage tbpage = new TabPage("test" + i);
this.tabControl1.TabPages.Add(tbpage);
}
-Nick Parker
|
|
|
|
|
I'm building a set of custom controls. I would like the controls to act as parents for controls dropped on them in the forms editor. I could use .Panel as the parent type but that would preclude visual editing in the IDE ( why ? ).
Looking at UserControl in the object browser I see that it is indeed a container and implements the IContainer interface somewhere down in the inheritance diagram. However, if I drop a UserControl into a form then drop another UserControl on top of it the forms editor will make the form the parent of both. This is different than if I drop the second UserControl on a panel or groupbox.
How do I make my controls act like a panel/groupbox in this respect ?
Duncan Meech
dmeech@riverdeep.net
|
|
|
|
|
Answering myself.....add this class to your controls base class.
///
/// Provides Base class designer support.
///
public class YourBaseClassControlDesigner : System.Windows.Forms.Design.ParentControlDesigner
{
// add whatever filters you like to determine the types of controls you can parent
public override bool CanParent(Control c)
{
return true;
}
public override bool CanParent(ControlDesigner cd)
{
return true;
}
}
then add these attributes to your actual control...
[Designer(typeof (YourBaseClassControlDesigner))]
public class YourBaseClassControl : System.Windows.Forms.UserControl ...
Duncan Meech
dmeech@riverdeep.net
|
|
|
|
|
Hi everyone,
I would like to create a control able to reproduce the navigation bar of Windows XP. I do not want to simulate what the original control does, I would like to exploit what Windows XP does (as I can do with every common controls). What kind of control is the original navigation bar?
Thanks in advance for your attention
Marco Losavio
|
|
|
|
|
I'd heard that vs2003 was going to bring significant changes, but aside from compact framework i dont see anything.
wasnt there supposed to be new tools supporting events?
wasnt there supposed to be C# templates or new typesafe tools?
am i missing something?
thanks!
|
|
|
|
|
I haven't seen VS 2003. But it's largely a bug-fix release.
C# templates won't appear until at least .NET 2
Kevin
|
|
|
|
|
|
Well, hopefully they'll be rather more timely with service packs going forward, unlike for VS 2002!
Kevin
|
|
|
|
|
Kevin McFarlane wrote:
Well, hopefully they'll be rather more timely with service packs going forward, unlike for VS 2002!
Hmm... I don't think so. My impression is that starting with VS.NET 2002 they stopped "losing time" supporting the IDE by itself, and were working only on VS 2003. They did support the framework, but the IDE fixes were only be available if you upgrade (ok, it's cheap). I think that will be the case when Whidbey comes out: there will be one or two SP for .NET Fx 1.1, but not for the IDE.
Specially because it will be tightly integrated with Yukon, this would be a great push for the new SQL Server.
My latest article: GBVB - Converting VB.NET code to C#
|
|
|
|
|
Daniel Turini wrote:
but the IDE fixes were only be available if you upgrade (ok, it's cheap)
According to the original roadmap MS will release an SP for VS.NET 2002 for those who choose not to upgrade.
James
"It is self repeating, of unknown pattern"
Data - Star Trek: The Next Generation
|
|
|
|
|
The beef is in the Visual C++.NET side of things. Windows Forms editor, 97% ISO Compliance, etc.
Hawaian shirts and shorts work too in Summer.
People assume you're either a complete nut (in which case not a worthy target) or so damn good you don't need to worry about camouflage...
-Anna-Jayne Metcalfe on Paintballing
|
|
|
|