private void menuNuevoUsuario_Click(object sender, RoutedEventArgs e) { MainWindow _mw = new MainWindow(); _mw.InitializeComponent(); this.Close(); _mw.Show(); }
private void pingBaidu() { try { Ping p = new Ping(); PingReply pr = p.Send("www.baidu.com"); if (pr.Status == IPStatus.Success||true) { MainWindow mw = new MainWindow(); mw.Show(); this.Close(); } else { MessageBox.Show("本程序需要网络连接,请先配置好当前网络环境"); return; } } catch (Exception) { MessageBox.Show("本程序需要网络连接,请先配置好当前网络环境"); return; } }
protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); var mainViewModel = new MainViewModel(); var mainWindow = new MainWindow {DataContext = mainViewModel }; mainWindow.Show(); }