how to launch the main windows in WPF ? |
| reg t replied to Peter Bromberg at 04-Jan-08 09:30 |
Its works fine when I use this:
string shortName = "WpfApplication1";
string mainClass = "WpfApplication1.Window1";
string mainMethod = "kk"; // public kk() { Show(); } but modifiying the target applicationsource code!
But it crash when I try for example this:
Assembly assembly = loadAssembly("WpfApplication1");
Type t = assembly.GetType("WpfApplication1.App");
MethodInfo mymethod = t.GetMethod("Main"); // it resolved the method (mymethod != null)
Object obj = Activator.CreateInstance(t); // crash here! creating the obj instance
mymethod.Invoke(obj, null);
Cannot create instance of 'Window1' defined in assembly 'AppLoader, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. Exception has been thrown by the target of an invocation. Error in markup file 'Window1.xaml' Line 1 Position 9.
|
|