public MainViewModel()
        {
            if (!ViewModelBase.IsInDesignModeStatic)
            {
                this.error_count = 0;
                Messenger.Default.Register<Parser>(this, process_fill);
                Messenger.Default.Register<string>("MEDIA_ENDED", process_random);

                Messenger.Default.Register<string>("NEXT_CLICKED", process_next);
                Messenger.Default.Register<string>("GOT_URI", process_play);
                Messenger.Default.Register<string>("EXCEPTION", process_exception);
                Messenger.Default.Register<Video>(this, process_video_changed);

                Messenger.Default.Register<string>("APPOINTMENT_CLICKED", process_appointment);
                Messenger.Default.Register<string>("APPOINTMENT_SUCCESS", process_appointment_failed);
                Messenger.Default.Register<string>("APPOINTMENT_FAILED", process_appointment_success);

                _appointmentDate = System.DateTime.Now;
                _appointmentEmail = "";
                _appointmentName = "";
                _appointmentPhoneNumber = "";

                theParser = new Parser(1);

                // DispatcherHelper.CheckBeginInvokeOnUI(() => { item.next();  });
                // WelcomeTitle = item.currentPet.pet_currentVideo.video_url;
            }
            else
            {
                AppointmentDate = System.DateTime.Now;
            }
        }
        public void parserRandomCreationTest()
        {
            Parser parser = new Parser();
            parser.random();

            Assert.IsTrue(parser.error_encountered == false);
        }
        void process_fill(Parser _parser)
        {
            if (!theParser.error_encountered)
            {

                ReinitializeAppointment();
                thePet = theParser.currentPet;
                PetNextCounts = Convert.ToString(thePet.pet_nextCounts);
                PetName = thePet.pet_name;
                PetDescription = thePet.pet_description;
                PetRace = thePet.pet_race;
                PetSpecie = thePet.pet_specie;
                PetBirthDate = thePet.pet_birthDate.ToShortDateString();
                AnounceCreationDate = thePet.pet_createdDate.ToShortDateString();
                AnounceExpirationDate = thePet.pet_availableUntilDate.ToShortDateString();
                Videos = new videoCollection(thePet).Videos;

                ShelterAddress = thePet.shelter_adress;
                ShelterEmail = thePet.shelter_email;
                ShelterName = thePet.shelter_name;
                ShelterPhoneNumber = thePet.shelter_phoneNumber;

                bool error = false;
                int i = 0;
                do
                {
                    try
                    {
                        thePet.pet_currentVideo.getVideoUri();
                        error = false;
                    }
                    catch (Exception e)
                    {
                        System.Diagnostics.Debug.WriteLine("EXCEPTION !" + e.Message);
                        i++;
                        error = true;
                    }
                }
                while (error == true && i < 5);
            }
            else
            {
                this.error_count++;
                DispatcherHelper.CheckBeginInvokeOnUI(() =>
                {
                    if (error_count >= 3)
                    {
                        MessageBox.Show(NetworkErrorMessage);
                        error_count = 0;
                    }
                    else
                        Messenger.Default.Send<string>("MEDIA_ENDED");
                });
            }
        }