private void btnPlay_Click(object sender, RoutedEventArgs e) { if (btnPlay.IsEnabled) // daca butonul este vizibil { User user_selectat = lista_useri.SelectedItem as User; Pairs_game newPairsGame = new Pairs_game(); newPairsGame.Show(); Pairs_game.PairsGame.Dispatcher.Invoke(new Action(delegate() { Pairs_game.PairsGame.lblUserName.Text = user_selectat.UserName; }));//apeleaza Fisier_utilizatoriTXT() din MainWindow pentu a actualiza ListView=lista_useri Pairs_game.PairsGame.Dispatcher.Invoke(new Action(delegate() { Pairs_game.PairsGame.lblUserNameImg.Source = poza.Source; })); this.Close(); } }
public Pairs_game() { InitializeComponent(); PairsGame = this; //ca sa primeasca update de la MainWindow lblOptionsScor.Text = "0"; // reseteaza scorul lblCowntDownTimerText.Visibility = System.Windows.Visibility.Hidden; // la inceput nu este selectat Timp deci nu este vizibil in taskbar lblCowntDownTimer.Visibility = System.Windows.Visibility.Hidden; //porneste timerul doar ca sa-l initializeze pentru a putea fi oprit cand NewGame, SaveGame, OpenGame sau Exit timp = TimeSpan.FromSeconds(0); timer = new DispatcherTimer(new TimeSpan(0, 0, 1), DispatcherPriority.Normal, delegate { }, Application.Current.Dispatcher); timer.Start(); //Console.WriteLine("Timer start"); timer.Stop(); //Console.WriteLine("Timer stop"); }