Пример #1
0
 public CardRun(CardIdentity id)
     : base(id.ToString())
 {
     this.card = id.model;
     if (id.model == null)
         id.Revealed += new CardIdentityNamer() { Target = this }.Rename;
 }
Пример #2
0
        private void CreateClicked(object sender, RoutedEventArgs e)
        {
            e.Handled = true;

            // A double-click can only select a marker in its own list
            // (Little bug here: double-clicking in the empty zone of a list with a selected marker adds it)
            if (sender is ListBox && ((ListBox)sender).SelectedIndex == -1) return;

            if (recentList.SelectedIndex != -1) result = (Data.CardModel)recentList.SelectedItem;
            if (allList.SelectedIndex != -1) result = (Data.CardModel)allList.SelectedItem;

            if (result == null) return;

            int qty;
            if (!int.TryParse(quantityBox.Text, out qty) || qty < 1)
            {
                var anim = new ColorAnimation(Colors.Red, new Duration(TimeSpan.FromMilliseconds(800))) { AutoReverse = true };
                validationBrush.BeginAnimation(SolidColorBrush.ColorProperty, anim, HandoffBehavior.Compose);
                return;
            }

            Program.Game.AddRecentCard(result);
            DialogResult = true;
        }
Пример #3
0
 public void SetCardModel(Data.CardModel model)
 {
     System.Diagnostics.Debug.Assert(card == null, "Cannot set the CardModel of a CardRun if it is already defined");
     card = model;
     Text = model.Name;
 }
Пример #4
0
 public CardRun(Data.CardModel model)
     : base(model.Name)
 {
     this.card = model;
 }
Пример #5
0
 public CardModelEventArgs(Data.CardModel model, RoutedEvent routedEvent, object source)
     : base(routedEvent, source)
 {
     CardModel = model;
 }