Example #1
0
        public MainWindow()
        {
            InitializeComponent();

            Vache  paquet = new Vache();
            Random rng    = new Random();

            List <Vache> Deck = paquet.creerdeck();

            // ##############################################################################

            // Create Image Element
            Image myImage = new Image();

            myImage.Width = 200;

            // Create source
            BitmapImage myBitmapImage = new BitmapImage();

            // BitmapImage.UriSource must be in a BeginInit/EndInit block
            myBitmapImage.BeginInit();
            myBitmapImage.UriSource = new Uri(@"C:\Documents and Settings\All Users\Documents\My Pictures\Sample Pictures\Water fourmi.jpeg");

            // To save significant application memory, set the DecodePixelWidth or
            // DecodePixelHeight of the BitmapImage value of the image source to the desired
            // height or width of the rendered image. If you don't do this, the application will
            // cache the image as though it were rendered as its normal size rather then just
            // the size that is displayed.
            // Note: In order to preserve aspect ratio, set DecodePixelWidth
            // or DecodePixelHeight but not both.
            myBitmapImage.DecodePixelWidth = 200;
            myBitmapImage.EndInit();
            //set image source
            myImage.Source = myBitmapImage;


            // ##############################################################################

            int r = rng.Next(Deck.Count);

            label.Content = (Deck[r].Categorie.ToString()) +
                            ("\n") +
                            ("Valeur : ") + (Deck[r].Valeur.ToString()) +
                            ("\n") +
                            ("Nb mouche(s) : ") + (Deck[r].nb_mouches.ToString());

            //Le programme marche avec cette ligne merci

            Console.ReadLine();
        }
Example #2
0
        private void button_Click(object sender, RoutedEventArgs e)
        {
            Vache  paquet = new Vache();
            Random rng    = new Random();

            List <Vache> Deck = paquet.creerdeck();



            int r = rng.Next(Deck.Count);

            label.Content = (Deck[r].Categorie.ToString()) +
                            ("\n") +
                            ("Valeur : ") + (Deck[r].Valeur.ToString()) +
                            ("\n") +
                            ("Nb mouche(s) : ") + (Deck[r].nb_mouches.ToString());
        }
Example #3
0
 public virtual void RetirerCarte(Vache carte)
 {
     throw new System.NotImplementedException();
 }