| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101 |
- using CommunityToolkit.Mvvm.ComponentModel;
- using ivf_tl_Entity.DTO;
- using ivf_tl_Entity.GlobalEntitys;
- using ivf_tl_Entity.GlobalEnums;
- using ivf_tl_Services;
- using Newtonsoft.Json;
- using System;
- using System.Collections.Generic;
- using System.Diagnostics;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace ivf_tl_Operate.ViewModel
- {
- public partial class DetailPageViewModel : ObservableObject
- {
- public DishRecordViewModel ParentViewModel { get; set; } = null;
- private void ExLog(Exception ex, string name)
- {
- AppData.Instance.LogHelper.ExceptionLog(ex, $"DetailPageViewModel.{name}", LogEnum.RunException);
- }
- private void ErrorLog(string mess, LogEnum logEnum)
- {
- AppData.Instance.LogHelper.TLLog($"DetailPageViewModel.{mess}", logEnum);
- }
- private void DebugLog(string mess, LogEnum logEnum)
- {
- AppData.Instance.LogHelper.TLLog($"DetailPageViewModel.{mess}", logEnum);
- //Log4netHelper.WriteLog($"DetailPageViewModel.{mess}");
- }
- public DetailPageViewModel(ExHouse currentHouse, ExDish currentDish)
- {
- ExHouse = currentHouse;
- ExDish = currentDish;
- IsUpdata = true;
- }
- public void Init()
- {
- Stopwatch stopwatch = Stopwatch.StartNew();
- DebugLog($"{ExDish.houseSn}号舱室详情界面数据初始化开始,{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff")}", LogEnum.TakeTime);
- var time1 = stopwatch.Elapsed;
- QuickButtons = AppData.Instance.HttpHelper.GetQuickButtonsApi().Take(7).OrderBy(x => x.orderNum).ToList();
- var time2 = stopwatch.Elapsed;
- DebugLog($"读取快捷按钮完成,{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff")},耗时:{(time2 - time1).TotalMilliseconds}毫秒", LogEnum.TakeTime);
- var wellSn = ExDish.embryoList.Select(x => x.wellSn).ToList();
- if (wellSn != null && wellSn.Any())
- {
- DishPicAndVideoList = AppData.Instance.HttpHelper.GetRecordDetailApi(ExDish.tlSn, ExDish.houseSn, ExDish.id, ExDish.embryoList.Select(x => x.wellSn).ToList());
- time1 = stopwatch.Elapsed;
- DebugLog($"获取图片、视频信息完成,{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff")},耗时:{(time1 - time2).TotalMilliseconds}毫秒", LogEnum.TakeTime);
- }
- DebugLog($"{ExDish.houseSn}号舱室详情界面数据初始化完成,{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff")},总耗时:{stopwatch.Elapsed.TotalMilliseconds}毫秒", LogEnum.TakeTime);
- stopwatch.Stop();
- }
- [ObservableProperty]
- private ExHouse exHouse = null;
- [ObservableProperty]
- private ExDish exDish = null;
- [ObservableProperty]
- private ExEmbryo currentEmbryo = null;
- /// <summary>
- /// 视频总时长
- /// </summary>
- [ObservableProperty]
- private double videoAllTime = 1;
- /// <summary>
- /// 视频已播放时长
- /// </summary>
- [ObservableProperty]
- private double videoCurrentTime = 0;
- /// <summary>
- /// 当前图层
- /// </summary>
- [ObservableProperty]
- private int currentFocal = 0;
- [ObservableProperty]
- private bool isUpdata = false;
- [ObservableProperty]
- private List<ButtonEntity> quickButtons = new List<ButtonEntity>();
- public List<DishPicAndVideo> DishPicAndVideoList { get; set; } = new List<DishPicAndVideo>();
- public DishPicAndVideo CurrentWellDishPicAndVideo { get; set; } = null;
- public LayerPicAndVideo CurrentWellLayerPicAndVideo { get; set; } = null;
- public DetailPic CurrentPic { get; set; } = null;
- //public List<ButtonEntity> QuickButtons { get; set; } = null;
- public int MaxTotalLayer = -1;
- }
- }
|