public Login() { InitializeComponent(); config = new ConfigMethods(); View = new ViewManagment(); win = Application.Current.Windows.OfType <MainWindow>().First(); NamePlayer.Text = config.GetPlayerName().Length > 0 ? config.GetPlayerName() : String.Empty; }
private void SetName(object sender, RoutedEventArgs e) { if (NamePlayer.Text.Length == 0) { return; } config.SetPlayerName(NamePlayer.Text); win.EnableTimer = (Boolean)EnableTimer.IsChecked; switch (config.GetLevel()) { case "1": View.RedirectUrl("FirstLevel.xaml"); break; case "2": View.RedirectUrl("SecondLevel.xaml"); break; case "3": View.RedirectUrl("ThirdLevel.xaml"); break; default: break; } var w = Application.Current.Windows.OfType <MainWindow>().First(); w.Player.Text += config.GetPlayerName(); }