示例#1
0
        public void PositionChanged(object sender, PositionEventArgs arg)
        {
            var conventer = new WorkoutConventer();

            //start
            if (RouteCoordinates.Count == 0)
            {
                //WorkoutData.NumberOfPoint++;
                WorkoutData.StartTime = new DateTime(DateTime.Now.Ticks); //new DateTime(arg.Position.Timestamp.LocalDateTime.Ticks);
                startWorkout          = new DateTime(DateTime.Now.Ticks);
                UpdateWorkFieldAndObj(null, arg.Position);
                RouteCoordinates.Add(new Plugin.Geolocator.Abstractions.Position(arg.Position));
            }
            else if (startWorkout.Ticks == 0)
            {       //after pause, new value
                if (arg.Position.Timestamp.Ticks != RouteCoordinates.Last().Timestamp.Ticks)
                {
                    startWorkout = new DateTime(DateTime.Now.Ticks);
                    //WorkoutData.NumberOfPoint++;
                    //UpdateWorkFieldAndObj(RouteCoordinates.Last(), arg.Position);
                    UpdateWorkFieldAndObj(null, arg.Position);
                    RouteCoordinates.Add(new Plugin.Geolocator.Abstractions.Position(arg.Position));
                }
                else
                {    //after pause, if value is same
                    startWorkout = new DateTime(DateTime.Now.Ticks);
                }    //new value
            }
            else if (arg.Position.Timestamp.Ticks != RouteCoordinates.Last().Timestamp.Ticks)
            {
                NumberOfPoint++;
                UpdateWorkFieldAndObj(RouteCoordinates.Last(), arg.Position);
                RouteCoordinates.Add(new Plugin.Geolocator.Abstractions.Position(arg.Position));
            }
        }
示例#2
0
        void UpdateWorkFieldAndObj(Plugin.Geolocator.Abstractions.Position oldValue, Plugin.Geolocator.Abstractions.Position newValue)
        {
            var conventer  = new WorkoutConventer();
            var surveyTime = (DateTime.Now.Ticks - startWorkout.Ticks + lastInterval.Ticks) / 10000000;//measurement approximate accuracy//seconds

            WorkoutData     = conventer.ValueObject(new MapPreparedData(WorkoutData), oldValue, newValue, NumberOfPoint, surveyTime);
            NewWorkoutPoint = newValue;
            RefreshWorkFieldAndObj(newValue);
        }
        private void FillFields(MapPreparedData data)
        {
            FieldDate.Text = data.StartTime.ToString("dd-MM-yyyy HH:mm:ss");

            TimeFild.Text     = data.Time.ToString("H:mm:ss");
            DistanceFild.Text = WorkoutConventer.ValueTypeAfter(TypeOfConvAfter.Distance, 0, data.RoadDistance).ToString("0.00").Replace(",", ".");
            MaxSpeedFild.Text = WorkoutConventer.ValueTypeAfter(TypeOfConvAfter.Speed, data.MaxSpeed, data.RoadDistance).ToString("0.00").Replace(",", ".");
            AvgSpeedFild.Text = WorkoutConventer.ValueTypeAfter(TypeOfConvAfter.Speed, data.MediumSpeed, data.RoadDistance).ToString("0.00").Replace(",", ".");

            MaxPaceFild.Text     = WorkoutConventer.ValueTypeAfter(TypeOfConvAfter.Tempo, data.MaxSpeed, data.RoadDistance).ToString("0.00").Replace(",", ".");
            AvgPaceFild.Text     = WorkoutConventer.ValueTypeAfter(TypeOfConvAfter.Tempo, data.MediumSpeed, data.RoadDistance).ToString("0.00").Replace(",", ".");
            MaxAltitudeFild.Text = WorkoutConventer.ValueTypeAfter(TypeOfConvAfter.Altitude, data.MaxAltitude, data.RoadDistance).ToString("0.00").Replace(",", ".");
            MinAltitudeFild.Text = WorkoutConventer.ValueTypeAfter(TypeOfConvAfter.Altitude, data.MinAltitude, data.RoadDistance).ToString("0.00").Replace(",", ".");
        }
示例#4
0
        public CounterFieldPage(Guid id)
        {
            InitializeComponent();

            CallObjId = id;

            Items = new ObservableCollection <TypeOfConventer>();

            foreach (TypeOfConventer val in WorkoutConventer.NrOfType())
            {
                Items.Add(val);
            }


            MyListView.ItemsSource = Items;
        }
示例#5
0
        void RefreshWorkFieldAndObj(Plugin.Geolocator.Abstractions.Position newValue)
        {
            MapPreparedData copyWorkoutData = new MapPreparedData(WorkoutData);

            for (int i = 0; i < WorkField.Count; i++)
            {
                if (WorkValue[i] != TypeOfConventer.Timer)
                {
                    var newVal = WorkoutConventer.ValueTypeIn(WorkValue[i], copyWorkoutData, newValue).ToString("0.00");
                    newVal = newVal.Replace(",", ".");
                    var useLabel = WorkField[i];

                    Device.BeginInvokeOnMainThread(() => {
                        useLabel.Text = newVal;
                    });
                }
            }
        }