Exemplo n.º 1
0
        private void writeLog(MeasurementData md)

        {
            Writer writer = new Writer();

            writer.clearFile();

            JObject o = (JObject)JToken.FromObject(md);

            writer.writeData(o);
        }
Exemplo n.º 2
0
        void dt_Tick(object sender, EventArgs e)
        {
            if (AstrandWatch.IsRunning)
            {
                TimeSpan ts = AstrandWatch.Elapsed;
                currentTime = String.Format("{0:00}:{1:00}",
                                            ts.Minutes, ts.Seconds);
                timelbl.Content = $"Session Time: {currentTime} ";


                int elapsedTime = (int)AstrandWatch.Elapsed.TotalSeconds;
                if (elapsedTime < 120)
                {
                    Statuslbl.Content = $"Warming up: {120 - elapsedTime}";
                }
                else if (elapsedTime > 120 && elapsedTime < 360)
                {
                    if (this.spin < 50)
                    {
                        Statuslbl.Content = $"You have to go Faster!!";
                    }
                    else if (this.spin > 60)
                    {
                        Statuslbl.Content = $"Slowdown!!";
                    }
                    else
                    {
                        Statuslbl.Content = $"Your doing great!";
                    }
                }
                else if (elapsedTime > 360 && elapsedTime < 420)
                {
                    MeasurementData data = new MeasurementData(timestart, time, this.name, this.sex, this.age, this.weight, this.spin, this.speedcycle, this.HeartRate, this.voltage);
                    if (this.sex.Equals("man"))
                    {
                        Statuslbl.Content = "Your vo2 score is: " + data.maleVo2();
                    }
                    else if (this.sex.Equals("women"))
                    {
                        Statuslbl.Content = "Your vo2 score is: " + data.femaleVo2();
                    }

                    SendFilebtn.IsEnabled = true;
                    writeLog(new MeasurementData(timestart, time, this.name, this.sex, this.age, this.weight, this.spin, this.speedcycle, this.HeartRate, this.voltage));
                    Statuslbl.Content = $"Cool down: {420 - elapsedTime}";
                }
                else
                {
                    Statuslbl.Content = "You can stop now";
                }
            }
        }