示例#1
0
        public Home()
        {
            InitializeComponent();

            NavigationInTransition navigateInTransition = new NavigationInTransition();
            navigateInTransition.Backward = new SlideTransition { Mode = SlideTransitionMode.SlideRightFadeIn };
            navigateInTransition.Forward = new SlideTransition { Mode = SlideTransitionMode.SlideLeftFadeIn };

            NavigationOutTransition navigateOutTransition = new NavigationOutTransition();
            navigateOutTransition.Backward = new SlideTransition { Mode = SlideTransitionMode.SlideRightFadeOut };
            navigateOutTransition.Forward = new SlideTransition { Mode = SlideTransitionMode.SlideLeftFadeOut };
            TransitionService.SetNavigationInTransition(this, navigateInTransition);
            TransitionService.SetNavigationOutTransition(this, navigateOutTransition);

            ifc = FacadeController.getInstance();
            User loggedUser = ifc.getCurrentUser();

            profileNameTxtBlock.Text = loggedUser.FirstName + " " + loggedUser.LastName;
            profileCountryTxtBlock.Text = loggedUser.Country;
            profileEmailTextBlock.Text = loggedUser.Email;
            Uri uri = new Uri(loggedUser.ImageUrl, UriKind.Absolute);
            profileImage.Source = new BitmapImage(uri);

            this.initChallengesListBox();
            this.InitRankingListBox();
        }
        private void inicializar()
        {
            // OBTENEMOS LA INSTANCIA DEL DESAFIO.
            /* hay que prolijear esto con una factory */
            ifc = FacadeController.getInstance();
            this.currentChallenge = (ChallengeDetail1)ifc.getChallenge(1);

            timer = new DispatcherTimer();
            timer.Interval = new TimeSpan(0, 0, 1);
            timer.Tick += tickTemp;

            minTime = this.currentChallenge.Time;
            minSpeed = this.currentChallenge.MinSpeed;
            seconds = minTime;

            // INICIALIZAMOS LAS ETIQUETAS DEL DETALLE DEL DESAFIO
            this.ShowST.Text = this.currentChallenge.getDTChallenge().getStartTime().ToString(); // Ojo ver el tema de la fecha y hora (Cuando estamos en el limite de una ronda y la otra).
            this.ShowToBeat.Text = this.currentChallenge.State.getScore() + " pts";
            DateTime roundDate = new DateTime(2014, 9, 28, 22, 0, 0);
            this.ShowDuration.Text = getDurationString(roundDate);

            this.ShowTime.Text =  minTime.ToString();
            this.ShowSpeed.Text = "0.00";

            if (this.useEmulation)
            {
                speedEmulator = new GPS_SpeedEmulator();
                speedEmulator.SpeedChange += speedChanged;
            }
            else
            {
                StartRunningButton.IsEnabled = false;
                startRunningRec.Opacity = 0.5;

                this.gps = new GeoCoordinateWatcher(GeoPositionAccuracy.High);
                this.gps.MovementThreshold = 3;
                this.gps.PositionChanged += positionChanged;
                this.gps.StatusChanged += statusChanged;
                this.gps.Start();
                this.ShowToBeat.Text = this.currentChallenge.State.getScore() + " pts";
            }
        }