public void CreatePaceFromMinSec_SUCCESS() { var pace = new Pace("01:23"); pace.Minutes.Should().Be(1); pace.Seconds.Should().Be(23); pace.ToString(@"mm\:ss").Should().Be("01:23"); }
public void CreatePaceFromMinSecMil_SUCCESS() { var pace = new Pace("1:23.456"); pace.Minutes.Should().Be(1); pace.Seconds.Should().Be(23); pace.Milliseconds.Should().Be(456); pace.ToString(@"mm\:ss\.fff").Should().Be("01:23.456"); }
/** * TODO * Equipment * Powers * Hindrances * * Later: * Injuries **/ public override string ToString() { StringBuilder retval = new StringBuilder(""); retval.AppendLine("Name:" + Name); retval.AppendLine("Charisma:" + Charisma.ToString()); retval.AppendLine("Pace:" + Pace.ToString()); retval.AppendLine("Parry:" + Parry.ToString()); retval.AppendLine("Toughness:" + Toughness.ToString()); retval.AppendLine("Agility:" + Agility.ToString()); retval.AppendLine("Smarts:" + Smarts.ToString()); retval.AppendLine("Strength:" + Strength.ToString()); retval.AppendLine("Spirit:" + Spirit.ToString()); retval.AppendLine("Vigor:" + Vigor.ToString()); return(retval.ToString()); }
public void addWorkout(int numOfReps, double repDistance, Units repUnits, Pace repPace, double repCoolDistance, Units repCoolUnits, Pace repCoolPace) { this.repDistance.Add(repDistance); this.repDistanceUnits.Add(repUnits); this.repPace.Add(repPace); this.repCoolDistance.Add(repCoolDistance); this.repCoolDistanceUnits.Add(repCoolUnits); this.repCoolPace.Add(repCoolPace); this.numberOfReps.Add(numOfReps); calculateTotalMileage(); calculateEasyMileage(); calculateWorkoutMileage(); //determine number of reps based on list length }
public void GetRange() { var exch = new ComExchange(portName); using (var pace = new Pace(exch)) { pace.Connect(); int range = (int)pace.GetRange(out double lo, out double hi); int range2 = (int)pace.GetRange(out double lo2, out double hi2, 1); Debug.WriteLine($"Диапазон 1-го модуля {range} Па"); Debug.WriteLine($"Лимит источника + 1-го модуля {hi} Па"); Debug.WriteLine($"Лимит источника - 1-го модуля {lo} Па"); Debug.WriteLine($"Диапазон 2-го модуля {range2} Па"); Debug.WriteLine($"Лимит источника + 2-го модуля {hi2} Па"); Debug.WriteLine($"Лимит источника - 2-го модуля {lo2} Па"); } }
private object convert(object value, Type targetType) { if (targetType == typeof(string)) { if (value is Pace pace) { return(pace.ToString()); } return(value?.ToString()); } if (targetType == typeof(Pace)) { if (value is string s) { try { return(Pace.Parse(s)); } catch { return(new Pace()); } } if (value is double d) { return(new Pace(d)); } if (value is float f) { return(new Pace(f)); } if (value is int i) { return(new Pace(i)); } if (value is decimal dc) { return(new Pace((double)dc)); } return(new Pace()); } return(null); }
public bool CreatePace(long appraisalHeaderId, Pace pace, Transaction transaction) { try { if (pace != null) { if (paceDb.InsertPace(pace.Id, pace.PaceAreaId, appraisalHeaderId, pace.Weight, pace.Score, pace.Justification, transaction)) { return(true); } } return(false); } catch (Exception ex) { throw ex; } }
public bool ModifyPace(Pace pace, Transaction transaction) { try { if (pace != null) { if (paceDb.UpdatePaceByPaceId(pace.Id, pace.PaceAreaId, pace.AppraisalHeaderId, pace.Weight, pace.Score, pace.Justification, transaction)) { return(true); } } return(false); } catch (Exception ex) { throw ex; } }
public void clearData() { numberOfReps = new List <int>(); warmupDistance = 0; warmupDistanceUnits = Units.Miles; warmupPace = Pace.Easy; repDistance = new List <double>(); repDistanceUnits = new List <Units>(); repPace = new List <Pace>(); repCoolDistance = new List <double>(); repCoolDistanceUnits = new List <Units>(); repCoolPace = new List <Pace>(); coolDistance = 0; coolDistanceUnits = Units.Miles; coolPace = Pace.Easy; }
public IActionResult Get(string pace) { if (string.IsNullOrEmpty(pace)) { return(BadRequest("Pace is incorrect. Format mm-ss")); } var input = pace.Split('-'); var p = new Pace(Convert.ToInt32(input[0]), Convert.ToInt32(input[1])); var paces = new Dictionary <string, string> { { "half", p.GetFinishTime(21.097) }, { "marathon", p.GetFinishTime(42.195) } }; for (var i = 1; i < 43; i++) { paces.Add($"{i}", p.GetFinishTime(i)); } return(new ObjectResult(paces)); }
protected override void AddContentToMessage(List <byte> payload) { String _Duration = Duration.ToString(@"mm\:ss"); String _Distance = string.Format("{0:f2}", Distance); String _Pace = Pace.ToString(@"mm\:ss"); payload.Add(0x01); payload.AddRange(new byte[] { 0xff, 0x4d, 0xab, 0x81, 0xa6, 0xd2, 0xfc, 0x45, 0x8a, 0x99, 0x2c, 0x7a, 0x1f, 0x3b, 0x96, 0xa9 }); //guid app payload.AddRange(new byte[] { 0x70, 0x05, 0x00, 0x00, 0x00, 0x00, 0x01 }); AddInteger2Payload(payload, _Duration.Length + 1); AddStringOnly2Payload(payload, _Duration); payload.AddRange(new byte[] { 0x00, 0x01, 0x00, 0x00, 0x00, 0x01 }); AddInteger2Payload(payload, _Distance.Length + 1); AddStringOnly2Payload(payload, _Distance); payload.AddRange(new byte[] { 0x00, 0x02, 0x00, 0x00, 0x00, 0x01 }); if (Pace.TotalMinutes > 45) { _Pace = "-"; } if (Pace.TotalMilliseconds == 0) { _Pace = "-"; } AddInteger2Payload(payload, _Pace.Length + 1); AddStringOnly2Payload(payload, _Pace); payload.AddRange(new byte[] { 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x01, 0x00 }); payload.Add(MetricSystem ? (byte)0x01 : (byte)0x00); payload.AddRange(new byte[] { 0x05, 0x00, 0x00, 0x00, 0x02, 0x01, 0x00, 0x01 }); }
/** * TODO: faire une fonction qui fait le job, pour l'instant ça lance une rotation donc change direction du perso public void LookAt(Vector3 target) { Vector3 direction = (target - transform.position).normalized; direction.y = 0.0f; RotateTowards(direction); } **/ public void SetPace(Pace pace) { movePace = pace; }
public void Idle() { movePace = Pace.Idle; }
public Plan(string name, ActivityLevel activityLevel, Goal goal, decimal target, Pace pace, int duration = 0) { Name = name; ActivityLevel = activityLevel; Goal = goal; Target = target; Pace = pace; Duration = duration; Status = Status.Inactive; }