Link to home
Start Free TrialLog in
Avatar of Unimatrix_001
Unimatrix_001Flag for United Kingdom of Great Britain and Northern Ireland

asked on

Capturing the App_Startup event

Hi,

I've got a generated WPF program and in the app.g.cs file I've got the first block of code and in App.cs I've got the second block of code. How can I capture the startup event in app.cs - I can't really modify app.g.cs because it is auto-generated.

Thanks,
Uni
/************************************************************************************************
namespace MyApp{
  
    /// <summary>
    /// App
    /// </summary>
    public partial class App : System.Windows.Application {
        
        /// <summary>
        /// Application Entry Point.
        /// </summary>
        [System.STAThreadAttribute()]
        [System.Diagnostics.DebuggerNonUserCodeAttribute()]
        public static void Main() {
            MyApp.App app = new MyApp.App();
            app.Run();
        }
    }
}
************************************************************************************************/
 
/************************************************************************************************
namespace MyApp
{
    public partial class App : Application
    {
        void App_Startup(object sender, StartupEventArgs e)
        {
                //Stuff here...
        }
    }
}
************************************************************************************************/

Open in new window

Avatar of Juan_Barrera
Juan_Barrera
Flag of New Zealand image

Hi Unimatrix,

As those classes are declared partial, you can decalre a public class of the same name to complement it.

Have a look at this link for more information: http://msdn.microsoft.com/en-us/library/wa80x488.aspx

I hope this helps



Avatar of Unimatrix_001

ASKER

Hi Juan,

I'm aware of how partial classes work, but I don't understand the relevance to the problem?

Thanks,
Uni
ASKER CERTIFIED SOLUTION
Avatar of Unimatrix_001
Unimatrix_001
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial