Has more than one entry point defined error

后端 未结 2 845
情话喂你
情话喂你 2021-01-24 17:07

I have the following code:

namespace WpfApplication2
{
    /// 
    /// Interaction logic for MainWindow.xaml
    /// 
    public p         


        
2条回答
  •  北恋
    北恋 (楼主)
    2021-01-24 17:51

    You have two primary options to implement on start activities:

    Event handlers

    File App.xaml

    
    

    Define Startup="Application_Startup" and handle in file App.xaml.cs:

        private void Application_Startup(object sender, StartupEventArgs e)
        {
            // On start stuff here
        }
    

    Override method

    File App.xaml.cs

    public partial class App : Application
    {
        protected override void OnStartup(StartupEventArgs e)
        {
            // On start stuff here
            base.OnStartup(e);
    
            // Or here, where you find it more appropriate
        }
    }
    

提交回复
热议问题