Jump to content

Running .Net application by App()


Recommended Posts

I assume you're talking about a WPF app.

WPF apps are normally launched via the static entry point App.Main() method, just like Windows Forms and Console apps (which by default specify a Main method in the arbitrarily named Program class).

The contents of this method is normally generated for you by the compiler, and typically creates an instance of the App class, calls it's InitializeComponent() method followed by the Run() method. The default implementation of the InitializeComponent() method is parse your App.xaml, determine the startup Window class (in your case, MainWindow.xaml) so that Run() method can startup the Dispatcher for the message loop  and load your window class.

Try calling the static Main() method in your assembly.

 

2020-08-07 12_11_31-Window.png

Link to comment
On 8/7/2020 at 6:30 PM, bartek618 said:

Thank you for response,

if I do it like this:
obraz.png.5591c8889f006576c22188aa4786b764.png

I get an error:
obraz.png.eb1ea022e35cef9d6d9f21e13ecf8f07.png

 

The method is static - you don't need a constructor node so try without that. 

The exception text isn't in a language I'm familiar with but I suspect it may be due to which thread is executing the clumps. Try also setting the VI execution properties for the enclosing VI to run in the UI thread only.

Link to comment
  • 2 weeks later...

I get an exception that Assembly.GetEntryAssembly() returns null. Vi execution is set to UI. Any idea what's going on?

 

Assembly.GetEntryAssembly() returns null. Set the Application.ResourceAssembly property or use the pack://application:,,,/assemblyname;component/
Edited by bartek618
Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.