public void PlayTour(Tour tour)
        {
            this.Hide();
            NavigatorAdult form = previousForm as NavigatorAdult;

            form.PlayTour(tour);
        }
        protected void CloseTour(object sender, EventArgs e)
        {
            NavigatorAdult form = this.Parent as NavigatorAdult;

            form.CloseTour();
            StepCount = 99;
        }
        protected void PlayStep(object sender, EventArgs e)
        {
            NavigatorAdult form = this.Parent as NavigatorAdult;

            if (form.actualTour._id == tour._id && StepCount != 99)
            {
                playStepInTheSameUrl(tour, StepCount);
            }
        }
        protected void GoOneStepForward(object sender, EventArgs e)
        {
            NavigatorAdult form = this.Parent as NavigatorAdult;

            if (form.actualTour._id == tour._id && StepCount < tour.steps.Count && StepCount != 99)
            {
                StepCount++;
                this.SetStep(StepCount);
                playStepInTheSameUrl(tour, StepCount);
            }
        }
        protected void GoOneStepBack(object sender, EventArgs e)
        {
            NavigatorAdult form = this.Parent as NavigatorAdult;

            if (form.actualTour._id == tour._id && StepCount > 0 && StepCount != 99)
            {
                StepCount--;
                this.SetStep(StepCount);
                playStepInTheSameUrl(tour, StepCount);
            }

            if (StepCount == 0)
            {
                StepBackButton.Enabled = false;
            }
        }
        private void playStepInTheSameUrl(Tour tour, int positionStep)
        {
            var step      = tour.steps.Find(s => s.order == positionStep);
            var audioPath = "";

            if (step.audio != null)
            {
                audioPath = Constants.audioPath + "/Audio " + tour._id + step._id + ".wav";
            }

            NavigatorAdult form = this.Parent as NavigatorAdult;
            var            doc  = form.initDocument(step, positionStep);

            doc.InvokeScript("init" + step.order);

            form.playAudio(audioPath);
            form.countLoad = positionStep + 1;
        }
        protected void Asistime(object sender, EventArgs e)
        {
            NavigatorAdult control = this.previousForm as NavigatorAdult;

            control.Asistime();
        }
예제 #8
0
        protected void LogUser(object sender, EventArgs e)
        {
            if (userTextBox.TextName != string.Empty)
            {
                if (passwrdTextBox.TextName != string.Empty)
                {
                    var userController = new UserController();
                    var user           = new User();
                    user.email    = userTextBox.TextName;
                    user.password = passwrdTextBox.TextName;

                    loadingForm = new LoadingForm();
                    loadingForm.Show();

                    var token = userController.LoginAsync(user).Result;

                    if (token != null)
                    {
                        Constants.token = token.access_token;
                        Constants.user  = new User();
                        Constants.user  = token.user;

                        // Obtengo los tours

                        var tourController = new TourController();
                        Constants.tours = tourController.GetAllToursAsync().Result;

                        loadingForm.Close();

                        new PopupNotification("App Asistime!", "Bienvenido " + token.user.name);

                        if (token.user.rol == "Adulto")
                        {
                            ////Active notifications of new tours
                            Thread threadNewTour = new Thread(NewTourThread.DoWork);
                            threadNewTour.IsBackground = true;
                            threadNewTour.Start();

                            NavigatorAdult mod = new NavigatorAdult();
                            mod.Show();
                            this.WindowState   = FormWindowState.Minimized;
                            this.ShowInTaskbar = false;
                        }
                        else if (token.user.rol == "Responsable")
                        {
                            ////Active notifications
                            Thread threadNotification = new Thread(NotificationThread.DoWork);
                            threadNotification.IsBackground = true;
                            threadNotification.Start();

                            NavigatorAssistant mod = new NavigatorAssistant();
                            mod.Show();
                            this.WindowState   = FormWindowState.Minimized;
                            this.ShowInTaskbar = false;
                        }
                    }
                    else
                    {
                        loadingForm.Close();
                        new PopupNotification("Error Login", "Usuario o contraseña incorrecta.");
                        userTextBox.TextName    = "";
                        passwrdTextBox.TextName = "";
                    }
                }
            }
            else
            {
                new PopupNotification("Error Login", "Todos los campos deben tenes un valor.");
            }
        }