public GameViewModel(CardDeck SelectedDeck) { _selectedDeck = SelectedDeck; Quit = new DelegateCommand(() => { #if !SILVERLIGHT Application.Current.Shutdown(); #endif }); Cancel = new DelegateCommand(() => { #if !WINDOWS_PHONE MainViewModel.Instance.CurrentView = MainViewModel.Instance.Decks; #else Microsoft.Phone.Controls.PhoneApplicationFrame frame = Application.Current.RootVisual as Microsoft.Phone.Controls.PhoneApplicationFrame; frame.GoBack(); #endif #if !SILVERLIGHT Taskbar.UpdateTaskBarStatus(0, SelectedDeck.Count / 2); #endif }); HelpCommand = new DelegateCommand(() => { #if !SILVERLIGHT MessageBox.Show((string)Application.Current.FindResource("Resource_MessageBox_ShowHelp")); #endif }); }
private void OnGameFinished() { IsFinished = true; RaisePropertyChanged(@string.of(() => IsFinished)); IsFinished = false; #if !SILVERLIGHT Taskbar.UpdateTaskBarStatus(1, 1); #endif }
private void ShuffleCards() { SetRowsAndColumns(); #if !SILVERLIGHT Taskbar.UpdateTaskBarStatus(0, SelectedDeck.Count / 2); #endif List <CardPair> cardpairs = Randomize <CardPair>(SelectedDeck.Collection.ToList()).Take(_countTotal / 2).ToList(); foreach (CardPair card in CardPairs) { card.SelectionChanged -= new EventHandler(card_SelectionChanged); } CardPairs.Clear(); Matches = 0; SlowCollectionAdd(cardpairs); }