public ISegmentPair GetSegmentPair(string segmentId, string sourceText, string targetText) { var segmentPairProperties = _segmentBuilder.CreateSegmentPairProperties(); segmentPairProperties.Id = new SegmentId(segmentId); var sourceSegment = _segmentBuilder.CreateSegment(segmentPairProperties); sourceSegment.Properties = segmentPairProperties; sourceSegment.Add(_segmentBuilder.Text(sourceText)); var targetSegment = _segmentBuilder.CreateSegment(segmentPairProperties); targetSegment.Properties = segmentPairProperties; targetSegment.Add(_segmentBuilder.Text(targetText)); var segmentPair = _segmentBuilder.CreateSegmentPair(sourceSegment, targetSegment); return(segmentPair); }
private List <SoraSegment> GetWaitUserMessage(IList <PcrReservationModel> models) { if (models.Count == 0) { return(new List <SoraSegment>()); } var res = new List <SoraSegment> { SegmentBuilder.Text($"当前队列有{models.Count}位小伙伴,他们是:") }; int index = 1; foreach (var model in models.Where(m => !m.IsOnTree)) { var info = $"\n{index++}.[{model.ReserveTime.ToShortTimeString()}] {model.NickName}"; if (!string.IsNullOrWhiteSpace(model.Ps)) { info += $":{model.Ps}"; } res.Add(SegmentBuilder.Text(info)); } res.Add(SegmentBuilder.Text("\n在树上的:")); foreach (var model in models.Where(m => m.IsOnTree)) { var info = $"\n{index++}.[{(DateTime.Now - (model.TreeTime ?? model.ReserveTime)).TotalMinutes:0}分钟] {model.NickName}"; if (!string.IsNullOrWhiteSpace(model.Ps)) { info += $":{model.Ps}"; } res.Add(SegmentBuilder.Text(info)); } if (!models.Any(m => m.IsOnTree)) { res.Add(SegmentBuilder.Text("无")); } return(res); }