WPF 中对启动参数的处理

 /// <summary>
    /// Interaction logic for App.xaml
    /// </summary>
    public partial class App : Application
    {
        Window1 window1;
        
        // 添加启动参数的处理
        protected override void OnStartup(StartupEventArgs e)
      
        {
            window1 = new Window1();
            if (e.Args.Length > 0)
                window1.ShowEx(e.Args[0]);
            else
                window1.Show();
        }
    }

你可能感兴趣的:(WPF)