1.定义一个继承Application类的XMAL,手动添加一个带有字符串数组参数的Main方法(此方法我没试过)
2.在任何地方都可以调用System.Environment.GetCommandLineArgs();
3.在App.xmal重写OnStartup方法:
public partial class App : Application
{
protected override void OnStartup(StartupEventArgs e)
{
MainWindow window = new MainWindow();
Setting.UserNoid = e.Args[0];
Setting.UserName = e.Args[1];
Setting.NetDoor = e.Args[2];
window.Show();
}
}