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.

 

 




Click here to sign in and reply. You could earn money via our $500 contest just for being helpful.
  Article Discussion: Obfuscation and Packaging of .NET Applications via Compressed Embedded Assemblies - Peter Bromberg  11-Dec-07 7:12:18 AM
      target method to lauch the main windows in WPF - reg t  04-Jan-08 6:58:47 AM
          The sample uses a DLL embedded assembly - Peter Bromberg  04-Jan-08 7:23:36 AM
              how to launch the main windows in WPF ? - reg t  04-Jan-08 9:30:48 AM
                  It is reporting an error in your XAML file. - Peter Bromberg  04-Jan-08 11:00:49 AM
                      XAML and cs code - reg t  04-Jan-08 10:36:52 PM
                      now is ok - reg t  05-Jan-08 3:49:55 AM
                      Does it works with assemblies mixing unmanaged code ? - reg t  05-Jan-08 4:42:06 AM
                      assemblies mixing unmanaged code ? - - reg t  05-Jan-08 9:47:22 AM
      Loader stay running as a process after closing target application - reg t  04-Jan-08 11:38:56 PM
View Posts