2,854 questions
To execute a function at startup, add this attribute to App.xaml:
<Application
. . .
Startup="Application_Startup">
</Application>
Then define the function in App.xaml.cs:
public partial class App : Application
{
private void Application_Startup( object sender, StartupEventArgs e )
{
MessageBox.Show( "Hello!" );
}
}
Or use the events or constructor of the main window.
The .g.cs and .g.i.cs files are generated and overwritten by system and cannot be edited manually.