Esempio n. 1
0
        private void CardSelected(object sender, SearchCardImageEventArgs e)
        {
            selection = e.Image;
            set_id    = e.SetId;

            var bim = new BitmapImage();

            bim.BeginInit();
            bim.CacheOption = BitmapCacheOption.OnLoad;

            try
            {
                bim.UriSource = e.Image != null?CardModel.GetPictureUri(Game, e.SetId, e.Image) : Game.GetCardBackUri();

                bim.EndInit();
            }
            catch (Exception ex)
            {
                System.Diagnostics.Trace.WriteLine("Error loading picture uri from game pack: " + ex.ToString());
                bim             = new BitmapImage();
                bim.CacheOption = BitmapCacheOption.OnLoad;
                bim.BeginInit();
                bim.UriSource = new Uri(@"pack://application:,,,/Octgn;component/Resources/Front.jpg");
                bim.EndInit();
            }
            cardImage.Source = bim;
        }
Esempio n. 2
0
        private void CardSelected(object sender, SearchCardImageEventArgs e)
        {
            if (e.Image == null)
            {
                return;
            }
            selection = e.Image;
            set_id    = e.SetId;
            var cardid = e.CardId;
            var set    = SetManager.Get().GetById(e.SetId);
            var card   = set.Cards.FirstOrDefault(x => x.Id == cardid);

            cardImageControl.Card.SetCard(card.Clone());
        }
Esempio n. 3
0
        private void CardSelected(object sender, SearchCardImageEventArgs e)
        {
            selection = e.Image;
            set_id    = e.SetId;
            var cardid = e.CardId;
            var bim    = new BitmapImage();

            bim.BeginInit();
            bim.CacheOption = BitmapCacheOption.OnLoad;

            try
            {
                var set  = SetManager.Get().GetById(e.SetId);
                var card = set.Cards.FirstOrDefault(x => x.Id == cardid);
                //var card = CardManager.Get().GetCardById(cardid);
                var uri = card.GetPicture();
                if (uri != null)
                {
                    bim.UriSource = new Uri(uri);
                }
                else
                {
                    bim.UriSource = Game.GetCardBackUri();
                }
                //bim.UriSource = e.Image != null ? new Uri(card.GetPicture()) : Game.GetCardBackUri();
                //bim.UriSource = e.Image != null ? CardModel.GetPictureUri(Game, e.SetId, e.Image) : Game.GetCardBackUri();
                bim.EndInit();
            }
            catch (Exception ex)
            {
                System.Diagnostics.Trace.WriteLine("Error loading picture uri from game pack: " + ex.ToString());
                bim             = new BitmapImage();
                bim.CacheOption = BitmapCacheOption.OnLoad;
                bim.BeginInit();
                bim.UriSource = new Uri(@"pack://application:,,,/Octgn;component/Resources/Front.jpg");
                bim.EndInit();
            }
            cardImage.Source = bim;
        }
Esempio n. 4
0
 private void CardSelected(object sender, SearchCardImageEventArgs e)
 {
     cardImage.Source = new BitmapImage(e.Image != null
                                            ? CardModel.GetPictureUri(Game, e.SetId, e.Image)
                                            : Game.GetCardBackUri());
 }
Esempio n. 5
0
        private void CardSelected(object sender, SearchCardImageEventArgs e)
        {
            selection = e.Image;
            set_id = e.SetId;

            var bim = new BitmapImage();
            bim.BeginInit();
            bim.CacheOption = BitmapCacheOption.OnLoad;

            try
            {
                bim.UriSource = e.Image != null ? CardModel.GetPictureUri(Game, e.SetId, e.Image) : Game.GetCardBackUri();
                bim.EndInit();
            }
            catch (Exception ex)
            {
                System.Diagnostics.Trace.WriteLine("Error loading picture uri from game pack: " + ex.ToString());
                bim = new BitmapImage();
                bim.CacheOption = BitmapCacheOption.OnLoad;
                bim.BeginInit();
                bim.UriSource = new Uri(@"pack://application:,,,/Octgn;component/Resources/Front.jpg");
                bim.EndInit();

            }
            cardImage.Source = bim;
        }
 private void CardSelected(object sender, SearchCardImageEventArgs e)
 {
     try
     {
         cardImage.Source = new BitmapImage(e.Image != null ?
             CardModel.GetPictureUri(Game, e.SetId, e.Image) :
             Game.GetCardBackUri());
     }
     catch (Exception er)
     {
         ErrorLog.WriteError(er, "DeckBuilderWindowError: " + Game.GetCardBackUri() + ":" + e.SetId.ToString() + ":" + e.Image + ":" + Game.Name, false);
     }
 }
Esempio n. 7
0
        private void CardSelected(object sender, SearchCardImageEventArgs e)
        {
            selection = e.Image;
            set_id = e.SetId;

            var bim = new BitmapImage();
            bim.BeginInit();
            bim.CacheOption = BitmapCacheOption.OnLoad;
            bim.UriSource = e.Image != null ? CardModel.GetPictureUri(Game, e.SetId, e.Image) : Game.GetCardBackUri();
            bim.EndInit();
            cardImage.Source = bim;
        }