Esempio n. 1
0
        void displayImage(DogModelClass dog, int id)
        {
            if (winflag)
            {
                timer.Stop();
                return;
            }


            Image image  = dog.image;
            long  dogPos = Convert.ToInt64(image.GetValue(Canvas.LeftProperty)); //calculating the dog postion with respect to left property

            if (dogPos >= RaceTrack.Width - image.Width)                         //800 is the width of the panel
            {
                timer.Stop();
                if (!winflag)
                {
                    MessageBox.Show($"Dog {id} has won!!!");
                    CheckForWinner(id);
                    winflag = true;
                    InitializeDogModelPosition();
                    PunterList.Items.Refresh();
                }
            }
            else
            {
                int pace = DogGeneratorClass.GenerateSteps(dog as DogBaseClass);
                Canvas.SetLeft(image, dogPos + pace);
            }
        }
Esempio n. 2
0
        //
        public DogModelClass(DogBaseClass dog)
        {
            image        = new Image();
            image.Width  = 65;
            image.Height = 25;
            image.Source = new BitmapImage(new System.Uri(@"/dog.png", UriKind.Relative));

            ID         = DogGeneratorClass.GenerateID();
            Breed_Type = dog.Breed_Type;
            Breed      = dog.Breed;
            Steps      = dog.Steps;
            Origin     = dog.Origin;
            Size       = dog.Size;
        }
Esempio n. 3
0
        private void CreateDogModel()
        {
            DogBaseClass dog = DogGeneratorClass.FactoryMethod(DogGeneratorClass.BEAGLE, "Be");

            CreateDogModel(3, 7, dog);

            dog = DogGeneratorClass.FactoryMethod(DogGeneratorClass.BULLDOG, "Bull");
            CreateDogModel(45, 7, dog);

            dog = DogGeneratorClass.FactoryMethod(DogGeneratorClass.GERMAN_SHEPHARD, "GS");
            CreateDogModel(90, 7, dog);
            //

            dog = DogGeneratorClass.FactoryMethod(DogGeneratorClass.GREAT_PYTENEES, "BIG");
            CreateDogModel(130, 7, dog);
        }