| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415 |
- using ivf_tl_CustomControls;
- using ivf_tl_Entity.Entity;
- using ivf_tl_Entity.Entity.balance;
- using ivf_tl_Entity.Entity.Mark;
- using ivf_tl_Entity.Enums;
- using ivf_tl_Entity.Response;
- using ivf_tl_Manage.Converts;
- using ivf_tl_Manage.ViewModels;
- using ivf_tl_Manage.Win;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading;
- using System.Threading.Tasks;
- using System.Timers;
- using System.Windows;
- using System.Windows.Controls;
- using System.Windows.Data;
- using System.Windows.Documents;
- using System.Windows.Input;
- using System.Windows.Media;
- using System.Windows.Media.Imaging;
- using System.Windows.Navigation;
- using System.Windows.Shapes;
- namespace ivf_tl_Manage.Views
- {
- /// <summary>
- /// MarkUseView.xaml 的交互逻辑
- /// </summary>
- public partial class MarkUseView : UserControl
- {
- string paiShe, peitai, shiping;
- private MarkUseViewModel vm = null;
- private Brush deaeatForeground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#4D75AC"));
- private Brush noEmbryoForeground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#9B9B9B"));
- private Brush noPicForeground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#4D4D4D"));
- private double centerX, centerY;
- private double angle;
- private double angleOffset = 90;
- private int ellipseCount = 16;
- private int backImageRadius = 50;
- private int backImageBigRadius = 248;
- private int imageRadius = 40;
- private int imageBigRadius = 248;
- private int textBigRadius = 193;
- private int operRaius = 13;
- private int operBigRadius = 288;
- private int selectedIndex;
- private List<TextBlock> TextBlockList = new List<TextBlock>();
- private List<Image> ImageList = new List<Image>();
- private List<Image> PicImageList = new List<Image>();
- private List<Image> OperImageList = new List<Image>();
- private bool IsCleanVideo = false;
- public MarkUseView()
- {
- InitializeComponent();
- paiShe = KeyToStringConvert.GetLanguageStringByKey("0509");
- shiping = KeyToStringConvert.GetLanguageStringByKey("0510");
- peitai = KeyToStringConvert.GetLanguageStringByKey("0511");
- //paiShe = "拍摄中,请耐心等待";
- //shiping = "暂无视频,请耐心等待";
- //peitai = "暂无胚胎";
- centerX = 710 / 2.0;
- centerY = 710 / 2.0;
- angle = 360.00 / 16;
- Loaded += MarkUseView_Loaded;
- Unloaded += (s, e) =>
- {
- PlayerDispose();
- Canvas_Root.Children.Clear();
- TextBlockList.Clear();
- ImageList.Clear();
- PicImageList.Clear();
- OperImageList.Clear();
- if (vm != null)
- {
- vm.DingWeiEvent -= QuickButton_Click;
- foreach (var item in vm.CurrentDish.embryoList)
- {
- item.AlarmChangedEvent -= EmbryoAlarmEvent;
- }
- }
- vm = null;
- DataContext = null;
- };
- }
- private async void MarkUseView_Loaded(object sender, RoutedEventArgs e)
- {
- vm = (MarkUseViewModel)this.DataContext;
- if (vm != null) InitNav();
- InitCustomNew();
- PlayerEvent(this.mediaElementPlayer);
- Task task = null;
- if (vm.isPdf)
- {
- task = Task.Factory.StartNew(() => vm.Initnew());
- }
- if (task != null) await task.WaitAsync(new TimeSpan(0, 0, 30));
- InitQuickButton();
- SetEmbryoPic();
- if (vm == null)
- {
- ChangeEmbryo(1);
- return;
- }
- else
- {
- if (vm.DishPicAndVideoList.Any())
- {
- var a = vm.DishPicAndVideoList.First();
- if (a.videos != null && a.videos.Any())
- {
- var b = a.videos.FirstOrDefault(x => x.pictureLayer == 0);
- if (b != null && b.videoUrl == AppData.Instance.CleanVideoString)
- {
- IsCleanVideo = true;
- }
- }
- }
- if (vm.DetailViewModel != null && vm.DetailViewModel.CurrentEmbryo != null)
- {
- ChangeEmbryo(vm.DetailViewModel.CurrentEmbryo.wellSn);
- SelectIndex(vm.DetailViewModel.CurrentEmbryo.wellSn - 1);
- }
- else
- {
- ChangeEmbryo(1);
- }
- vm.CurrentMarkModelType = null;
- if (vm.MarkModelTypeList != null)
- {
- vm.CurrentMarkModelType = vm.MarkModelTypeList.First();
- }
- }
- vm.DingWeiEvent -= QuickButton_Click;
- vm.DingWeiEvent += QuickButton_Click;
- foreach (var item in vm.CurrentDish.embryoList)
- {
- item.AlarmChangedEvent -= EmbryoAlarmEvent;
- item.AlarmChangedEvent += EmbryoAlarmEvent;
- }
- InitAlarm();
- Task.Run(async () =>
- {
- while (true)
- {
- await Task.Delay(10000);
- if (vm == null || vm.CurrentDish == null || AppData.Instance.CurrentTlInfo == null) return;
- //foreach (var item in vm.CurrentDish.embryoList)
- //{
- // if (item.alarm == 0) item.alarm = 1;
- // else item.alarm = 0;
- //}
- InitAlarm();
- }
- });
- }
- private void InitAlarm()
- {
- if (vm == null || vm.CurrentDish == null || AppData.Instance.CurrentTlInfo == null) return;
- HouseCropAlarmResponse houseCropAlarmResponse = new HouseCropAlarmResponse();
- HouseCropAlarmResult CurrentHouseCropAlarmResult = null;
- houseCropAlarmResponse.tlSn = AppData.Instance.CurrentTlInfo.tlSn;
- if (!houseCropAlarmResponse.houseList.Any())
- {
- houseCropAlarmResponse.houseList.Add(new HouseCropAlarmHouseResponse
- {
- houseSn = vm.CurrentDish.houseSn,
- startTime = vm.CurrentDish.startTime,
- });
- }
- CurrentHouseCropAlarmResult = vm.detailProvider.GetHouseCropAlarmApi(houseCropAlarmResponse).FirstOrDefault(x => x.houseSn == vm.CurrentDish.houseSn);
- foreach (var item in vm.CurrentDish.embryoList)
- {
- if (CurrentHouseCropAlarmResult == null)
- {
- item.alarm = 0;
- continue;
- }
- if (CurrentHouseCropAlarmResult.wellSn == null)
- {
- item.alarm = 0;
- continue;
- }
- if (CurrentHouseCropAlarmResult.wellSn.Contains(item.wellSn))
- {
- item.alarm = 1;
- }
- else
- {
- item.alarm = 0;
- }
- }
- }
- private void InitNav()
- {
- _nav_StackPanel.Children.Clear();
- for (int i = 0; i < vm.NavList.Count; i++)
- {
- var item = vm.NavList[i];
- if (i == vm.NavList.Count - 1)
- {
- TextBlock textBlock1 = new TextBlock();
- textBlock1.Margin = new Thickness(8, 0, 0, 0);
- textBlock1.FontWeight = FontWeights.Bold;
- textBlock1.Foreground = new SolidColorBrush(Colors.Black);
- textBlock1.FontSize = 32d;
- textBlock1.VerticalAlignment = VerticalAlignment.Center;
- textBlock1.Text = item.NavName;
- _nav_StackPanel.Children.Add(textBlock1);
- return;
- }
- Button button = new Button();
- button.Content = item.NavName;
- button.FontWeight = FontWeights.Bold;
- button.FontSize = 28d;
- button.BorderThickness = new Thickness(0);
- button.Background = new SolidColorBrush(Colors.Transparent);
- button.Style = App.Current.FindResource("ButtonStyle1") as Style;
- if (i == 0)
- {
- button.Margin = new Thickness(0, 0, 0, 0);
- }
- else
- {
- button.Margin = new Thickness(8, 0, 0, 0);
- }
- button.Click += (s, e) =>
- {
- PlayerDispose();
- if (vm != null) vm.NavList.Clear();
- if (item is PatientManageViewModel patient)
- {
- patient.SetTLInfo(AppData.Instance.CurrentTlInfo);
- AppData.Instance.MainWindowViewModel.CurrentViewModle = patient;
- return;
- }
- AppData.Instance.MainWindowViewModel.CurrentViewModle = item;
- };
- TextBlock textBlock = new TextBlock();
- textBlock.Margin = new Thickness(8, 0, 0, 0);
- textBlock.VerticalAlignment = VerticalAlignment.Center;
- textBlock.FontWeight = FontWeights.Bold;
- textBlock.FontSize = 28d;
- textBlock.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#9B9B9B"));
- textBlock.Text = ">";
- _nav_StackPanel.Children.Add(button);
- _nav_StackPanel.Children.Add(textBlock);
- }
- }
- public void MessageShow(string message)
- {
- new ToastMessageWindow(AppData.Instance.MainWindow, 1920, 65, message).Show();
- }
- private void Toast(bool success)
- {
- new ToastWindow(AppData.Instance.MainWindow, 1920, 65, success).Show();
- }
- private void ExLog(Exception ex, string name)
- {
- AppData.Instance.LogService.ExceptionLog(ex, $"MarkUseView.{name}", LogEnum.RunException);
- }
- private void ErrorLog(string message, LogEnum logType)
- {
- AppData.Instance.LogService.TLLog($"MarkUseView.{message}", logType);
- }
- #region 界面按钮
- private void Button_Click(object sender, RoutedEventArgs e)
- {
- PlayerDispose();
- AppData.Instance.MainWindowViewModel.CurrentViewModle = AppData.Instance.MainWindowViewModel.devManageViewModel;
- }
- private void Parien_Click(object sender, RoutedEventArgs e)
- {
- //PlayerDispose();
- //AppData.Instance.MainWindowViewModel.patientManageViewModel.SetTLInfo(vm.tLInfo);
- //AppData.Instance.MainWindowViewModel.CurrentViewModle = AppData.Instance.MainWindowViewModel.patientManageViewModel;
- }
- private void Parien1_Click(object sender, RoutedEventArgs e)
- {
- //AppData.Instance.MainWindowViewModel.detailViewModel.Init(null, vm.tLInfo, vm.CurrentDish);
- AppData.Instance.MainWindowViewModel.CurrentViewModle = vm.DetailViewModel;
- }
- private void RecordParien_Click(object sender, RoutedEventArgs e)
- {
- AppData.Instance.MainWindowViewModel.CurrentViewModle = vm.RecordViewModel;
- }
- private void RecordParien1_Click(object sender, RoutedEventArgs e)
- {
- AppData.Instance.MainWindowViewModel.CurrentViewModle = vm.DetailViewModel;
- }
- private void BigFocus_Click(object sender, RoutedEventArgs e)
- {
- PlayerPause();
- if (vm == null || vm.CurrentPic == null || vm.CurrentWellDishPicAndVideo == null) return;
- if (vm.CurrentEmbryo == null) return;
- if (vm.CurrentWellLayerPicAndVideo != null) ChangeFocalNoVideo(true);
- //if (vm.CurrentWellLayerPicAndVideo != null) if (!string.IsNullOrEmpty(vm.CurrentWellLayerPicAndVideo.videoUrl)) ChangeFocalNoVideo(true);
- // else ChangeImageFocal(true);
- }
- private void SmallFocus_Click(object sender, RoutedEventArgs e)
- {
- PlayerPause();
- if (vm == null || vm.CurrentPic == null || vm.CurrentWellDishPicAndVideo == null) return;
- if (vm.CurrentEmbryo == null) return;
- if (vm.CurrentWellLayerPicAndVideo != null) ChangeFocalNoVideo(false);
- //if (vm.CurrentWellLayerPicAndVideo != null) if (!string.IsNullOrEmpty(vm.CurrentWellLayerPicAndVideo.videoUrl)) ChangeFocalNoVideo(false);
- // else ChangeImageFocal(false);
- }
- private void PreviousFrame_Click(object sender, RoutedEventArgs e)
- {
- if (vm == null || vm.CurrentWellLayerPicAndVideo == null) return;
- if (PlayerState != PlayerStateEnum.Nothing && PlayerState != PlayerStateEnum.Error)
- {
- PlayerPause();
- PlayerLastFrame(vm.CurrentWellLayerPicAndVideo.fps);
- //this._preview.Visibility = Visibility.Hidden;
- this.Canvas_preview.Visibility = Visibility.Hidden;
- }
- }
- private void Video_Click(object sender, RoutedEventArgs e)
- {
- if (PlayerState != PlayerStateEnum.Nothing && PlayerState != PlayerStateEnum.Error)
- {
- if (PlayerState == PlayerStateEnum.Playing)
- {
- PlayerPause();
- }
- else
- {
- newCurrentTime = -1;
- if (PlayerPlay())
- {
- //this._preview.Visibility = Visibility.Hidden;
- this.Canvas_preview.Visibility = Visibility.Hidden;
- vm.CurrentFocal = 0;
- }
- else
- {
- SetPreviewNoVideo();
- }
- }
- }
- else
- {
- SetPreviewNoVideo();
- }
- }
- private void NextFrame_Click(object sender, RoutedEventArgs e)
- {
- if (vm == null || vm.CurrentWellLayerPicAndVideo == null) return;
- if (PlayerState != PlayerStateEnum.Nothing && PlayerState != PlayerStateEnum.Error)
- {
- PlayerPause();
- PlayerNextFrame(vm.CurrentWellLayerPicAndVideo.fps);
- //PlayerNextFrame(vm.CurrentVideoFps);
- //this._preview.Visibility = Visibility.Hidden;
- this.Canvas_preview.Visibility = Visibility.Hidden;
- }
- }
- private void Fps_MouseUp(object sender, MouseButtonEventArgs e)
- {
- if (this._fps_Popup.IsOpen) this._fps_Popup.IsOpen = false;
- else this._fps_Popup.IsOpen = true;
- }
- private void ListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
- {
- if (vm == null) return;
- PlayerSetSpeedRatio(vm.SelectedFps.Key);
- if (this._fps_Popup.IsOpen) this._fps_Popup.IsOpen = false;
- }
- private void QuickButton_Click(int minHour, int maxHour, string quickName)
- {
- try
- {
- PlayerPause();
- if (vm.CurrentWellLayerPicAndVideo == null || vm.CurrentWellLayerPicAndVideo.videoPictures == null || !vm.CurrentWellLayerPicAndVideo.videoPictures.Any())
- {
- //MessageShow($"当前胚胎还未发育到{quickName}阶段");
- //MessageShow($"{KeyToStringConvert.GetLanguageStringByKey("0316")}{quickName}{KeyToStringConvert.GetLanguageStringByKey("0264")}");
- MessageShow($"{KeyToStringConvert.GetLanguageStringByKey("0316")} {quickName}");
- return;
- }
- var lastPic = vm.CurrentWellLayerPicAndVideo.videoPictures.Last();
- if (minHour > lastPic.developTime)
- {
- //MessageShow($"当前胚胎还未发育到{quickName}阶段");
- //MessageShow($"{KeyToStringConvert.GetLanguageStringByKey("0316")}{quickName}{KeyToStringConvert.GetLanguageStringByKey("0264")}");
- MessageShow($"{KeyToStringConvert.GetLanguageStringByKey("0316")} {quickName}");
- return;
- }
- int picCount = vm.CurrentWellLayerPicAndVideo.videoPictures.Count;
- for (int i = 0; i < picCount; i++)
- {
- var item = vm.CurrentWellLayerPicAndVideo.videoPictures[i];
- if (item.developTime >= minHour)
- {
- if (IsCleanVideo)
- {
- this.Canvas_preview.Visibility = Visibility.Visible;
- vm.VideoCurrentTime = i + 1;
- this._preview.Source = AppData.Instance.StringToBitmapImage($"{AppData.Instance.BaseUrl}{item.imageUrl}?token={AppData.Instance.HttpServiceCall.GetToken()}");
- }
- else
- {
- if (PlayerState != PlayerStateEnum.Nothing && PlayerState != PlayerStateEnum.Error)
- {
- this.Canvas_preview.Visibility = Visibility.Hidden;
- //double pro = ((i + 1) / (double)picCount) * vm.VideoAllTime;
- double pro = (i * (1000.00 / vm.CurrentWellLayerPicAndVideo.fps));
- SetTimeProgressbarProgressValue(pro);
- SetPlayerPosition(pro);
- }
- else
- {
- this.Canvas_preview.Visibility = Visibility.Visible;
- vm.VideoCurrentTime = i + 1;
- this._preview.Source = AppData.Instance.StringToBitmapImage($"{AppData.Instance.BaseUrl}{item.imageUrl}?token={AppData.Instance.HttpServiceCall.GetToken()}");
- }
- }
- break;
- }
- }
- }
- catch (Exception ex)
- {
- ExLog(ex, $"QuickButton_Click");
- }
- //try
- //{
- // PlayerPause();
- // if (vm.CurrentVideoData == null || vm.CurrentVideoData.videoPictures == null || !vm.CurrentVideoData.videoPictures.Any())
- // {
- // MessageShow($"当前胚胎还未发育到{quickName}阶段");
- // return;
- // }
- // var lastPic = vm.CurrentVideoData.videoPictures.Last();
- // if (minHour > lastPic.developTime)
- // {
- // MessageShow($"当前胚胎还未发育到{quickName}阶段");
- // return;
- // }
- // int picCount = vm.CurrentVideoData.videoPictures.Count;
- // for (int i = 0; i < picCount; i++)
- // {
- // var item = vm.CurrentVideoData.videoPictures[i];
- // if (item.developTime > minHour)
- // {
- // this._preview.Visibility = Visibility.Hidden;
- // double pro = ((i + 1) / (double)picCount) * vm.VideoAllTime;
- // SetTimeProgressbarProgressValue(pro);
- // SetPlayerPosition(pro);
- // break;
- // }
- // }
- //}
- //catch (Exception ex)
- //{
- // ExLog(ex, $"QuickButton_Click");
- //}
- }
- private void Ok_Click(object sender, RoutedEventArgs e)
- {
- }
- private void Cancel_Click(object sender, RoutedEventArgs e)
- {
- }
- private void ListBox_ManipulationBoundaryFeedback(object sender, ManipulationBoundaryFeedbackEventArgs e)
- {
- e.Handled = true;
- }
- private void MarkDetailUserControl_SaveMarkEvent(ivf_tl_Entity.Entity.Mark.MarkEntity obj)
- {
- vm.SaveMark(obj);
- }
- #endregion
- #region 标记
- string s1 = KeyToStringConvert.GetLanguageStringByKey("0521");
- string s2 = KeyToStringConvert.GetLanguageStringByKey("0522");
- string s3 = KeyToStringConvert.GetLanguageStringByKey("0523");
- string s4 = KeyToStringConvert.GetLanguageStringByKey("0524");
- string s5 = KeyToStringConvert.GetLanguageStringByKey("0525");
- string s6 = KeyToStringConvert.GetLanguageStringByKey("0526");
- string spaceString = KeyToStringConvert.GetLanguageStringByKey("0636");
- string haoString = KeyToStringConvert.GetLanguageStringByKey("0635");
- private void EmbryoMove_Click(object sender, RoutedEventArgs e)
- {
- PlayerPause();
- if (vm.CurrentEmbryo == null) return;
- string tag = KeyToStringConvert.GetLanguageStringByKey("0041");
- string messInfo = GetMessageInfo(tag);
- int iconType = 2;
- if (vm.CurrentEmbryo.state != (int)EmbryoState.None && vm.CurrentEmbryo.state != (int)EmbryoState.End)
- {
- tag = "完成";
- switch (vm.CurrentEmbryo.state)
- {
- case (int)EmbryoState.Freezing:
- messInfo = GetMarkMessage(KeyToStringConvert.GetLanguageStringByKey("0040"));
- iconType = 1;
- break;
- case (int)EmbryoState.Transplant:
- messInfo = GetCancelMarkMessage();
- tag = "取消";
- break;
- case (int)EmbryoState.Cancellation:
- messInfo = GetMarkMessage(KeyToStringConvert.GetLanguageStringByKey("0042"));
- iconType = 3;
- break;
- case (int)EmbryoState.Delete:
- messInfo = GetMarkMessage(KeyToStringConvert.GetLanguageStringByKey("0043"));
- iconType = 4;
- break;
- }
- }
- EmbryoOp(tag, messInfo, iconType);
- return;
- }
- private void EmbryoFree_Click(object sender, RoutedEventArgs e)
- {
- PlayerPause();
- if (vm.CurrentEmbryo == null) return;
- int iconType = 1;
- string tag = KeyToStringConvert.GetLanguageStringByKey("0040");
- string messInfo = GetMessageInfo(tag);
- if (vm.CurrentEmbryo.state != (int)EmbryoState.None && vm.CurrentEmbryo.state != (int)EmbryoState.End)
- {
- tag = "完成";
- switch (vm.CurrentEmbryo.state)
- {
- case (int)EmbryoState.Freezing:
- messInfo = GetCancelMarkMessage();
- tag = "取消";
- break;
- case (int)EmbryoState.Transplant:
- messInfo = GetMarkMessage(KeyToStringConvert.GetLanguageStringByKey("0041"));
- iconType = 2;
- break;
- case (int)EmbryoState.Cancellation:
- messInfo = GetMarkMessage(KeyToStringConvert.GetLanguageStringByKey("0042"));
- iconType = 3;
- break;
- case (int)EmbryoState.Delete:
- messInfo = GetMarkMessage(KeyToStringConvert.GetLanguageStringByKey("0043"));
- iconType = 4;
- break;
- }
- }
- EmbryoOp(tag, messInfo, iconType);
- return;
- }
- private void EmbryoInv_Click(object sender, RoutedEventArgs e)
- {
- PlayerPause();
- if (vm.CurrentEmbryo == null) return;
- int iconType = 3;
- string tag = KeyToStringConvert.GetLanguageStringByKey("0042");
- string messInfo = GetMessageInfo(tag);
- if (vm.CurrentEmbryo.state != (int)EmbryoState.None && vm.CurrentEmbryo.state != (int)EmbryoState.End)
- {
- tag = "完成";
- switch (vm.CurrentEmbryo.state)
- {
- case (int)EmbryoState.Freezing:
- messInfo = GetMarkMessage(KeyToStringConvert.GetLanguageStringByKey("0040"));
- iconType = 1;
- break;
- case (int)EmbryoState.Transplant:
- messInfo = GetMarkMessage(KeyToStringConvert.GetLanguageStringByKey("0041"));
- iconType = 2;
- break;
- case (int)EmbryoState.Cancellation:
- messInfo = GetCancelMarkMessage();
- tag = "取消";
- break;
- case (int)EmbryoState.Delete:
- messInfo = GetMarkMessage(KeyToStringConvert.GetLanguageStringByKey("0043"));
- iconType = 4;
- break;
- }
- }
- EmbryoOp(tag, messInfo, iconType);
- return;
- }
- private void EmbryoDel_Click(object sender, RoutedEventArgs e)
- {
- PlayerPause();
- if (vm.CurrentEmbryo == null) return;
- int iconType = 4;
- string tag = KeyToStringConvert.GetLanguageStringByKey("0043");
- string messInfo = GetMessageInfo(tag);
- if (vm.CurrentEmbryo.state != (int)EmbryoState.None && vm.CurrentEmbryo.state != (int)EmbryoState.End)
- {
- tag = "完成";
- switch (vm.CurrentEmbryo.state)
- {
- case (int)EmbryoState.Freezing:
- messInfo = GetMarkMessage(KeyToStringConvert.GetLanguageStringByKey("0040"));
- iconType = 1;
- break;
- case (int)EmbryoState.Transplant:
- messInfo = GetMarkMessage(KeyToStringConvert.GetLanguageStringByKey("0041"));
- iconType = 2;
- break;
- case (int)EmbryoState.Cancellation:
- messInfo = GetMarkMessage(KeyToStringConvert.GetLanguageStringByKey("0042"));
- iconType = 3;
- break;
- case (int)EmbryoState.Delete:
- messInfo = GetCancelMarkMessage();
- tag = "取消";
- break;
- }
- }
- EmbryoOp(tag, messInfo, iconType);
- return;
- }
- private void EmbryoOp(string tag, string infoString, int type)
- {
- if (tag == "完成")
- {
- AppData.Instance.MainWindowViewModel.MaskVisibility = true;
- new MessagePrompt().ShowEmbryoOper(tag, infoString, type);
- AppData.Instance.MainWindowViewModel.MaskVisibility = false;
- return;
- }
- AppData.Instance.MainWindowViewModel.MaskVisibility = true;
- var rs = new MessagePrompt().ShowEmbryoOper(tag, infoString, type);
- AppData.Instance.MainWindowViewModel.MaskVisibility = false;
- if (rs != true) return;
- if (vm != null && vm.PdfParentViewModel != null) vm.PdfParentViewModel.IsUpdateAi = true;
- if (tag == "取消")
- {
- EmbryoMark((int)EmbryoState.None);
- return;
- }
- switch (type)
- {
- case 1:
- EmbryoMark((int)EmbryoState.Freezing);
- break;
- case 3:
- EmbryoMark((int)EmbryoState.Cancellation);
- break;
- case 2:
- EmbryoMark((int)EmbryoState.Transplant);
- break;
- case 4:
- EmbryoMark((int)EmbryoState.Delete);
- break;
- default:
- break;
- }
- }
- private void EmbryoMark(int embryoState)
- {
- try
- {
- //SetEmbryoState(vm.CurrentEmbryo.wellSn, embryoState, vm.CurrentEmbryo.alarm);
- //return;
- if (!vm.MarkEmbryo(embryoState))
- {
- MessageShow(KeyToStringConvert.GetLanguageStringByKey("0319"));
- return;
- }
- DateTime ct = DateTime.Now;
- vm.CurrentEmbryo.state = embryoState;
- vm.CurrentEmbryo.stateTime = ct.ToString("yyyy-MM-dd HH:mm:ss");
- SetEmbryoState(vm.CurrentEmbryo.wellSn, vm.CurrentEmbryo.state, vm.CurrentEmbryo.alarm);
- Toast(true);
- }
- catch (Exception ex)
- {
- ExLog(ex, "EmbryoMark");
- }
- }
- private string GetMessageInfo(string stateString)
- {
- return $"{s1}{spaceString}{stateString}{spaceString}{s2}{vm.CurrentEmbryo.wellSn}{haoString}?";
- }
- private string GetMarkMessage(string stateString)
- {
- return $"{s5}{vm.CurrentEmbryo.wellSn}{spaceString}{s6}{spaceString}{stateString}";
- }
- private string GetCancelMarkMessage()
- {
- return $"{s3}{spaceString}{vm.CurrentEmbryo.wellSn}{haoString}?";
- }
- private void SetEmbryoState(int well, int embryoState, int alarm)
- {
- var item = OperImageList[(well - 1)];
- var backItme = ImageList[(well - 1)];
- EmbryoState state = (EmbryoState)embryoState;
- item.Visibility = Visibility.Visible;
- backItme.Tag = 3;
- switch (state)
- {
- case EmbryoState.Freezing://冷冻
- item.Source = new BitmapImage(new Uri("pack://application:,,,/ivf_tl_Manage;component/Resources/Images/EmbryoState1Icon.png", UriKind.Absolute));
- backItme.Source = new BitmapImage(new Uri("pack://application:,,,/ivf_tl_Manage;component/Resources/Images/DetailEmbryoState1Icon.png", UriKind.Absolute));
- break;
- case EmbryoState.Transplant://移植
- item.Source = new BitmapImage(new Uri("pack://application:,,,/ivf_tl_Manage;component/Resources/Images/EmbryoState2Icon.png", UriKind.Absolute));
- backItme.Source = new BitmapImage(new Uri("pack://application:,,,/ivf_tl_Manage;component/Resources/Images/DetailEmbryoState2Icon.png", UriKind.Absolute));
- break;
- case EmbryoState.Cancellation://作废
- item.Source = new BitmapImage(new Uri("pack://application:,,,/ivf_tl_Manage;component/Resources/Images/EmbryoState3Icon.png", UriKind.Absolute));
- backItme.Source = new BitmapImage(new Uri("pack://application:,,,/ivf_tl_Manage;component/Resources/Images/DetailEmbryoState3Icon.png", UriKind.Absolute));
- break;
- case EmbryoState.Delete://删除
- item.Source = new BitmapImage(new Uri("pack://application:,,,/ivf_tl_Manage;component/Resources/Images/EmbryoState4Icon.png", UriKind.Absolute));
- backItme.Source = new BitmapImage(new Uri("pack://application:,,,/ivf_tl_Manage;component/Resources/Images/DetailEmbryoState4Icon.png", UriKind.Absolute));
- break;
- default:
- item.Visibility = Visibility.Hidden;
- if (alarm == 0)
- {
- backItme.Source = new BitmapImage(new Uri("pack://application:,,,/ivf_tl_Manage;component/Resources/Images/DetailEmbryoSelectedIcon.png", UriKind.Absolute));
- }
- else
- {
- backItme.Source = new BitmapImage(new Uri("pack://application:,,,/ivf_tl_Manage;component/Resources/Images/DetailEmbryoState3Icon.png", UriKind.Absolute));
- }
- backItme.Tag = 2;
- break;
- }
- }
- private void ButtonBottomImage_Click(object sender, RoutedEventArgs e)
- {
- AppData.Instance.MainWindowViewModel.CurrentViewModle = new MarkDetailViewModel(vm, vm.CurrentDish.id);
- }
- bool isMax = false;
- double maxWidth = 610;
- double maxLeft = 50;
- double minWidth = 330;
- double minLeft = 190;
- private void PreviewMouseDownEvent(object sender, MouseButtonEventArgs e)
- {
- if (e.ChangedButton == MouseButton.Left && e.ClickCount == 2)
- {
- if (isMax == false)
- {
- _mask.Width = maxWidth;
- _mask.Height = maxWidth;
- mediaElementPlayer.Width = maxWidth;
- mediaElementPlayer.Height = maxWidth;
- canvas1.Width = maxWidth;
- canvas1.Height = maxWidth;
- isMax = true;
- Canvas.SetLeft(mediaElementPlayer, maxLeft);
- Canvas.SetTop(mediaElementPlayer, maxLeft);
- Canvas.SetLeft(_mask, maxLeft);
- Canvas.SetTop(_mask, maxLeft);
- Canvas.SetLeft(canvas1, maxLeft);
- Canvas.SetTop(canvas1, maxLeft);
- Panel.SetZIndex(mediaElementPlayer, 16);
- Panel.SetZIndex(canvas1, 18);
- }
- else
- {
- _mask.Width = minWidth;
- _mask.Height = minWidth;
- mediaElementPlayer.Width = minWidth;
- mediaElementPlayer.Height = minWidth;
- canvas1.Width = minWidth;
- canvas1.Height = minWidth;
- isMax = false;
- Canvas.SetLeft(mediaElementPlayer, minLeft);
- Canvas.SetTop(mediaElementPlayer, minLeft);
- Canvas.SetLeft(_mask, minLeft);
- Canvas.SetTop(_mask, minLeft);
- Canvas.SetLeft(canvas1, minLeft);
- Canvas.SetTop(canvas1, minLeft);
- Panel.SetZIndex(mediaElementPlayer, 8);
- Panel.SetZIndex(canvas1, 10);
- }
- SetLoad(isMax);
- SetPreView(isMax);
- }
- e.Handled = true;
- return;
- }
- private void SetLoad(bool isMax)
- {
- if (isMax)
- {
- Image_Load.Width = maxWidth;
- Image_Load.Height = maxWidth;
- Canvas_Load.Width = maxWidth;
- Canvas_Load.Height = maxWidth;
- TextBlock_Load.Width = maxWidth;
- TextBlock_Load.FontSize = 38;
- Canvas.SetTop(TextBlock_Load, 361);
- Canvas.SetLeft(Canvas_Load, maxLeft);
- Canvas.SetTop(Canvas_Load, maxLeft);
- Panel.SetZIndex(Canvas_Load, 15);
- }
- else
- {
- Image_Load.Width = minWidth;
- Image_Load.Height = minWidth;
- Canvas_Load.Width = minWidth;
- Canvas_Load.Height = minWidth;
- TextBlock_Load.Width = minWidth;
- TextBlock_Load.FontSize = 20;
- Canvas.SetTop(TextBlock_Load, 198);
- Canvas.SetLeft(Canvas_Load, minLeft);
- Canvas.SetTop(Canvas_Load, minLeft);
- Panel.SetZIndex(Canvas_Load, 7);
- }
- }
- private void SetPreView(bool isMax)
- {
- if (isMax)
- {
- _preview.Width = maxWidth;
- _preview.Height = maxWidth;
- Canvas_preview.Width = maxWidth;
- Canvas_preview.Height = maxWidth;
- TextBlock_preview.Width = maxWidth;
- TextBlock_preview.FontSize = 38;
- Canvas.SetTop(TextBlock_preview, 361);
- Canvas.SetLeft(Canvas_preview, maxLeft);
- Canvas.SetTop(Canvas_preview, maxLeft);
- Panel.SetZIndex(Canvas_preview, 17);
- }
- else
- {
- _preview.Width = minWidth;
- _preview.Height = minWidth;
- Canvas_preview.Width = minWidth;
- Canvas_preview.Height = minWidth;
- TextBlock_preview.Width = minWidth;
- TextBlock_preview.FontSize = 20;
- Canvas.SetTop(TextBlock_preview, 198);
- Canvas.SetLeft(Canvas_preview, minLeft);
- Canvas.SetTop(Canvas_preview, minLeft);
- Panel.SetZIndex(Canvas_preview, 9);
- }
- }
- #endregion
- #region 进度条事件
- private void ProgressbarUserControl_AfterInteractionEvent(double obj)
- {
- if (PlayerState != PlayerStateEnum.Nothing && PlayerState != PlayerStateEnum.Error)
- {
- currentMediaElement.LoadedBehavior = MediaState.Manual;
- SetPlayerPosition(obj);
- }
- else
- {
- if (vm.CurrentWellLayerPicAndVideo != null && vm.CurrentWellLayerPicAndVideo.videoPictures.Any())
- {
- this._preview.Source = AppData.Instance.StringToBitmapImage($"{AppData.Instance.BaseUrl}{vm.CurrentWellLayerPicAndVideo.videoPictures[ProToImageIndex()].imageUrl}?token={AppData.Instance.HttpServiceCall.GetToken()}");
- this.TextBlock_preview.Text = "";
- }
- }
- }
- private void ProgressbarUserControl_BeforeInteractionEvent()
- {
- PlayerPause();
- if (PlayerState != PlayerStateEnum.Nothing && PlayerState != PlayerStateEnum.Error)
- {
- //this._preview.Visibility = Visibility.Hidden;
- this.Canvas_preview.Visibility = Visibility.Hidden;
- }
- }
- List<PictureEntity> PicList = null;
- int picCount = 0;
- int picIndex = 0;
- private string ProgressbarUserControl_LengthDevelopmentEvent(double arg)
- {
- try
- {
- if (vm == null || vm.CurrentWellLayerPicAndVideo == null)
- {
- vm.CurrentPic = null;
- return "00h:00m";
- }
- if (vm.CurrentWellLayerPicAndVideo == null || vm.CurrentWellLayerPicAndVideo.videoPictures == null || !vm.CurrentWellLayerPicAndVideo.videoPictures.Any())
- {
- vm.CurrentPic = null;
- return "00h:00m";
- }
- if (string.IsNullOrEmpty(vm.CurrentWellLayerPicAndVideo.videoUrl) || vm.CurrentWellLayerPicAndVideo.videoUrl == AppData.Instance.CleanVideoString)
- {
- picIndex = ProToImageIndex();
- vm.CurrentPic = vm.CurrentWellLayerPicAndVideo.videoPictures[picIndex];
- //Debug.WriteLine($"proLength {picIndex} ->{vm.CurrentWellLayerPicAndVideo.videoPictures.Count}");
- return $"{(vm.CurrentPic.developTime / 60).ToString("D2")}h:{(vm.CurrentPic.developTime % 60).ToString("D2")}m";
- }
- else
- {
- picCount = vm.CurrentWellLayerPicAndVideo.videoPictures.Count;
- picIndex = VideoProToImageIndex();
- if (picIndex < 0) picIndex = 0;
- if (picIndex > (picCount - 1)) picIndex = picCount - 1;
- vm.CurrentPic = vm.CurrentWellLayerPicAndVideo.videoPictures[picIndex];
- return $"{(vm.CurrentPic.developTime / 60).ToString("D2")}h:{(vm.CurrentPic.developTime % 60).ToString("D2")}m";
- }
- }
- catch (Exception ex)
- {
- vm.CurrentPic = null;
- ExLog(ex, "获取当前帧发育时长");
- return "00h:00m";
- }
- //try
- //{
- // if (vm == null || vm.CurrentVideoData == null) return "00h:00m";
- // PicList = vm.CurrentVideoData.videoPictures;
- // if (PicList == null || !PicList.Any()) return "00h:00m";
- // picCount = PicList.Count;
- // picIndex = VideoProToImageIndex();
- // if (picIndex < 0) picIndex = 0;
- // if (picIndex > (picCount - 1)) picIndex = picCount - 1;
- // vm.CurrentPicZhen = PicList[picIndex];
- // return $"{(vm.CurrentPicZhen.developTime / 60).ToString("D2")}h:{(vm.CurrentPicZhen.developTime % 60).ToString("D2")}m";
- //}
- //catch (Exception ex)
- //{
- // if (vm != null) vm.CurrentPicZhen = null;
- // ExLog(ex, "获取当前帧发育时长");
- // return "00h:00m";
- //}
- }
- private void ProgressbarUserControl_ProChangendEvent(double obj)
- {
- if (PlayerState != PlayerStateEnum.Nothing || PlayerState != PlayerStateEnum.Error) SetPlayerPosition(obj);
- }
- public int VideoProToImageIndex()
- {
- try
- {
- if (vm == null || vm.CurrentWellLayerPicAndVideo == null) return 0;
- return (int)(vm.VideoCurrentTime / (1000.00 / vm.CurrentWellLayerPicAndVideo.fps));
- }
- catch (Exception ex)
- {
- ExLog(ex, "VideoProToImageIndex");
- return 0;
- }
- //try
- //{
- // return (int)(vm.VideoCurrentTime / (1000.00 / vm.CurrentVideoFps));
- //}
- //catch (Exception ex)
- //{
- // ExLog(ex, "VideoProToImageIndex");
- // return 0;
- //}
- }
- /// <summary>
- /// 进度条换算图片下标
- /// </summary>
- /// <returns></returns>
- public int ProToImageIndex()
- {
- try
- {
- if (vm == null || vm.CurrentWellLayerPicAndVideo == null || !vm.CurrentWellLayerPicAndVideo.videoPictures.Any()) return 0;
- var imageIndex = ((int)vm.VideoCurrentTime - 1);
- if (imageIndex < 0) imageIndex = 0;
- if (imageIndex >= vm.CurrentWellLayerPicAndVideo.videoPictures.Count) imageIndex = vm.CurrentWellLayerPicAndVideo.videoPictures.Count - 1;
- return imageIndex;
- }
- catch (Exception ex)
- {
- ExLog(ex, "ProToImageIndex");
- return 0;
- }
- }
- #endregion
- #region 初始化
- private void InitQuickButton()
- {
- this._quick_StackPanel.Children.Clear();
- //if (vm == null || vm.QuickButtons == null || !vm.QuickButtons.Any())
- //{
- // this._quickT.Visibility = Visibility.Hidden;
- // return;
- //}
- //this._quickT.Visibility = Visibility.Visible;
- bool isFirst = true;
- var newList = vm.QuickButtons.OrderBy(x => x.orderNum).Take(7);
- foreach (var item in newList)
- {
- ButtonLeftImage buttonLeftImage = new ButtonLeftImage()
- {
- IconWidth = 40,
- IconHeight = 40,
- IconMargin = new Thickness(0, 0, 5, 0),
- Content = item.buttonName,
- FontWeight = FontWeights.Medium,
- FontSize = 24,
- Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#9B9B9B")),
- MouseOverForeground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#4D4D4D")),
- IconSource = new BitmapImage(new Uri("pack://application:,,,/ivf_tl_Manage;component/Resources/Images/DetailQuickIcon.png", UriKind.Absolute)),
- MouseOverIconSource = new BitmapImage(new Uri("pack://application:,,,/ivf_tl_Manage;component/Resources/Images/DetailQuickMouseOverIcon.png", UriKind.Absolute)),
- };
- if (!isFirst) buttonLeftImage.Margin = new Thickness(20, 0, 0, 0);
- if (isFirst) isFirst = false;
- buttonLeftImage.Click += (sender, args) =>
- {
- QuickButton_Click(item.minHour * 60, item.maxHour * 60, item.buttonName);
- };
- this._quick_StackPanel.Children.Add(buttonLeftImage);
- }
- }
- private void InitMark()
- {
- }
- private void InitCustom()
- {
- try
- {
- EllipseGeometry ellipseGeometry = new EllipseGeometry(new Point(imageRadius, imageRadius), imageRadius, imageRadius);
- Embryo itemEmbryo = null;
- for (int i = 0; i < ellipseCount; i++)
- {
- TextBlock textBlock = new TextBlock();
- Image border = new Image();
- Image image = new Image();
- Image opImage = new Image();
- this._canvas.Children.Add(textBlock);
- this._canvas.Children.Add(border);
- this._canvas.Children.Add(image);
- this._canvas.Children.Add(opImage);
- Panel.SetZIndex(textBlock, 11);
- Panel.SetZIndex(border, 12);
- Panel.SetZIndex(image, 13);
- Panel.SetZIndex(opImage, 14);
- textBlock.FontWeight = FontWeights.Medium;
- textBlock.Foreground = deaeatForeground;
- textBlock.FontSize = 14;
- textBlock.Width = 16;
- textBlock.Height = 22;
- textBlock.Text = $"{i + 1}";
- textBlock.TextAlignment = TextAlignment.Center;
- textBlock.SetValue(Canvas.LeftProperty, centerX + Math.Cos(((angle * i + angleOffset) * (Math.PI)) / 180) * textBigRadius - 7);
- textBlock.SetValue(Canvas.TopProperty, centerY + Math.Sin(((angle * i + angleOffset) * (Math.PI)) / 180) * textBigRadius - 11);
- TextBlockList.Add(textBlock);
- ImageList.Add(border);
- PicImageList.Add(image);
- border.Width = backImageRadius * 2;
- border.Height = backImageRadius * 2;
- border.SetValue(Canvas.LeftProperty, centerX + Math.Cos(((angle * i + angleOffset) * (Math.PI)) / 180) * backImageBigRadius - backImageRadius);
- border.SetValue(Canvas.TopProperty, centerY + Math.Sin(((angle * i + angleOffset) * (Math.PI)) / 180) * backImageBigRadius - backImageRadius);
- opImage.Width = operRaius * 2;
- opImage.Height = operRaius * 2;
- opImage.SetValue(Canvas.LeftProperty, centerX + Math.Cos(((angle * i + angleOffset) * (Math.PI)) / 180) * operBigRadius - operRaius);
- opImage.SetValue(Canvas.TopProperty, centerY + Math.Sin(((angle * i + angleOffset) * (Math.PI)) / 180) * operBigRadius - operRaius);
- opImage.Source = new BitmapImage(new Uri("pack://application:,,,/ivf_tl_Manage;component/Resources/Images/EmbryoState1Icon.png", UriKind.Absolute));
- OperImageList.Add(opImage);
- image.Width = imageRadius * 2;
- image.Height = imageRadius * 2;
- image.SetValue(Canvas.LeftProperty, centerX + Math.Cos(((angle * i + angleOffset) * (Math.PI)) / 180) * imageBigRadius - imageRadius);
- image.SetValue(Canvas.TopProperty, centerY + Math.Sin(((angle * i + angleOffset) * (Math.PI)) / 180) * imageBigRadius - imageRadius);
- image.SetValue(Image.ClipProperty, ellipseGeometry);
- image.Source = new BitmapImage(new Uri("pack://application:,,,/ivf_tl_Manage;component/Resources/Images/DetailEmbryoBackground.png", UriKind.Absolute));
- image.Tag = i;
- image.MouseUp += (s, e) =>
- {
- if (!(s is Image source)) return;
- int index = (int)source.Tag;
- if (selectedIndex == index) return;
- SelectIndex(index);
- PlayerPause();
- ChangeEmbryo(index + 1);
- };
- var aa = vm.CurrentDish;
- itemEmbryo = vm.CurrentDish.embryoList.FirstOrDefault(x => x.wellSn == i + 1);
- if (itemEmbryo == null)//无胚胎
- {
- opImage.Visibility = Visibility.Hidden;
- textBlock.Tag = 0;
- textBlock.Foreground = noEmbryoForeground;
- border.Tag = 0;
- border.Source = new BitmapImage(new Uri("pack://application:,,,/ivf_tl_Manage;component/Resources/Images/DetailNoEmbryoBackground.png", UriKind.Absolute));
- continue;
- }
- switch ((EmbryoState)itemEmbryo.state)
- {
- case EmbryoState.Freezing: //冷冻
- opImage.Source = new BitmapImage(new Uri("pack://application:,,,/ivf_tl_Manage;component/Resources/Images/EmbryoState1Icon.png", UriKind.Absolute));
- break;
- case EmbryoState.Transplant://移植
- opImage.Source = new BitmapImage(new Uri("pack://application:,,,/ivf_tl_Manage;component/Resources/Images/EmbryoState2Icon.png", UriKind.Absolute));
- break;
- case EmbryoState.Cancellation://作废
- opImage.Source = new BitmapImage(new Uri("pack://application:,,,/ivf_tl_Manage;component/Resources/Images/EmbryoState3Icon.png", UriKind.Absolute));
- break;
- case EmbryoState.Delete://删除
- opImage.Source = new BitmapImage(new Uri("pack://application:,,,/ivf_tl_Manage;component/Resources/Images/EmbryoState4Icon.png", UriKind.Absolute));
- break;
- default:
- opImage.Visibility = Visibility.Hidden;
- break;
- }
- var currentData = vm.DishPicAndVideoList.FirstOrDefault(x => x.wellSn == itemEmbryo.wellSn);
- if (currentData == null || string.IsNullOrEmpty(currentData.lastPicture))//无图片
- {
- textBlock.Tag = 1;
- textBlock.Foreground = noPicForeground;
- border.Tag = 1;
- border.Source = new BitmapImage(new Uri("pack://application:,,,/ivf_tl_Manage;component/Resources/Images/DetailEmbryoBackground.png", UriKind.Absolute));
- continue;
- }
- string borderSource = "pack://application:,,,/ivf_tl_Manage;component/Resources/Images/DetailEmbryoBackground.png";
- int borderTag = 3;
- switch ((EmbryoState)itemEmbryo.state)
- {
- case EmbryoState.None:
- borderTag = 2;
- borderSource = "pack://application:,,,/ivf_tl_Manage;component/Resources/Images/DetailEmbryoBackground.png";
- break;
- case EmbryoState.Freezing: //冷冻
- borderSource = "pack://application:,,,/ivf_tl_Manage;component/Resources/Images/DetailEmbryoState1Icon.png";
- break;
- case EmbryoState.Transplant://移植
- borderSource = "pack://application:,,,/ivf_tl_Manage;component/Resources/Images/DetailEmbryoState2Icon.png";
- break;
- case EmbryoState.Cancellation://作废
- borderSource = "pack://application:,,,/ivf_tl_Manage;component/Resources/Images/DetailEmbryoState3Icon.png";
- break;
- case EmbryoState.Delete://删除
- borderSource = "pack://application:,,,/ivf_tl_Manage;component/Resources/Images/DetailEmbryoState4Icon.png";
- break;
- }
- textBlock.Tag = 2;
- textBlock.Foreground = deaeatForeground;
- border.Tag = borderTag;
- border.Source = new BitmapImage(new Uri(borderSource, UriKind.Absolute));
- }
- SelectIndex(0);
- }
- catch (Exception)
- {
- throw;
- }
- }
- private void InitCustomNew()
- {
- try
- {
- EllipseGeometry ellipseGeometry = new EllipseGeometry(new Point(imageRadius, imageRadius), imageRadius, imageRadius);
- Embryo itemEmbryo = null;
- for (int i = 0; i < ellipseCount; i++)
- {
- TextBlock textBlock = new TextBlock();
- Image border = new Image();
- Image image = new Image();
- Image opImage = new Image();
- this._canvas.Children.Add(textBlock);
- this._canvas.Children.Add(border);
- this._canvas.Children.Add(image);
- this._canvas.Children.Add(opImage);
- Panel.SetZIndex(textBlock, 11);
- Panel.SetZIndex(border, 12);
- Panel.SetZIndex(image, 13);
- Panel.SetZIndex(opImage, 14);
- textBlock.FontWeight = FontWeights.Medium;
- textBlock.Foreground = deaeatForeground;
- textBlock.FontSize = 14;
- textBlock.Width = 16;
- textBlock.Height = 22;
- textBlock.Text = $"{i + 1}";
- textBlock.TextAlignment = TextAlignment.Center;
- textBlock.SetValue(Canvas.LeftProperty, centerX + Math.Cos(((angle * i + angleOffset) * (Math.PI)) / 180) * textBigRadius - 7);
- textBlock.SetValue(Canvas.TopProperty, centerY + Math.Sin(((angle * i + angleOffset) * (Math.PI)) / 180) * textBigRadius - 11);
- TextBlockList.Add(textBlock);
- ImageList.Add(border);
- PicImageList.Add(image);
- border.Width = backImageRadius * 2;
- border.Height = backImageRadius * 2;
- border.SetValue(Canvas.LeftProperty, centerX + Math.Cos(((angle * i + angleOffset) * (Math.PI)) / 180) * backImageBigRadius - backImageRadius);
- border.SetValue(Canvas.TopProperty, centerY + Math.Sin(((angle * i + angleOffset) * (Math.PI)) / 180) * backImageBigRadius - backImageRadius);
- opImage.Width = operRaius * 2;
- opImage.Height = operRaius * 2;
- opImage.SetValue(Canvas.LeftProperty, centerX + Math.Cos(((angle * i + angleOffset) * (Math.PI)) / 180) * operBigRadius - operRaius);
- opImage.SetValue(Canvas.TopProperty, centerY + Math.Sin(((angle * i + angleOffset) * (Math.PI)) / 180) * operBigRadius - operRaius);
- //opImage.Source = new BitmapImage(new Uri("pack://application:,,,/ivf_tl_Manage;component/Resources/Images/EmbryoState1Icon.png", UriKind.Absolute));
- OperImageList.Add(opImage);
- image.Width = imageRadius * 2;
- image.Height = imageRadius * 2;
- image.SetValue(Canvas.LeftProperty, centerX + Math.Cos(((angle * i + angleOffset) * (Math.PI)) / 180) * imageBigRadius - imageRadius);
- image.SetValue(Canvas.TopProperty, centerY + Math.Sin(((angle * i + angleOffset) * (Math.PI)) / 180) * imageBigRadius - imageRadius);
- image.SetValue(Image.ClipProperty, ellipseGeometry);
- if (vm.CurrentDish == null)
- {
- border.Source = new BitmapImage(new Uri("pack://application:,,,/ivf_tl_Manage;component/Resources/Images/DetailNoEmbryoBackground.png", UriKind.Absolute));
- }
- else
- {
- itemEmbryo = SetWellImage(i, 0);
- if (itemEmbryo == null)
- {
- textBlock.Tag = 0;
- textBlock.Foreground = noEmbryoForeground;
- image.Source = new BitmapImage(new Uri("pack://application:,,,/ivf_tl_Manage;component/Resources/Images/DetailNoEmbryo.png", UriKind.Absolute));
- }
- else
- {
- textBlock.Tag = 2;
- textBlock.Foreground = deaeatForeground;
- image.Source = new BitmapImage(new Uri("pack://application:,,,/ivf_tl_Manage;component/Resources/Images/DetailNoEmbryo1.png", UriKind.Absolute));
- switch ((EmbryoState)itemEmbryo.state)
- {
- case EmbryoState.Freezing: //冷冻
- opImage.Source = new BitmapImage(new Uri("pack://application:,,,/ivf_tl_Manage;component/Resources/Images/EmbryoState1Icon.png", UriKind.Absolute));
- break;
- case EmbryoState.Transplant://移植
- opImage.Source = new BitmapImage(new Uri("pack://application:,,,/ivf_tl_Manage;component/Resources/Images/EmbryoState2Icon.png", UriKind.Absolute));
- break;
- case EmbryoState.Cancellation://作废
- opImage.Source = new BitmapImage(new Uri("pack://application:,,,/ivf_tl_Manage;component/Resources/Images/EmbryoState3Icon.png", UriKind.Absolute));
- break;
- case EmbryoState.Delete://删除
- opImage.Source = new BitmapImage(new Uri("pack://application:,,,/ivf_tl_Manage;component/Resources/Images/EmbryoState4Icon.png", UriKind.Absolute));
- break;
- default:
- opImage.Visibility = Visibility.Hidden;
- break;
- }
- }
- }
- if (i == 0) textBlock.Foreground = new SolidColorBrush(Colors.White);
- int index = i;
- image.MouseUp += (s, e) =>
- {
- if (!this.IsLoaded) return;
- if (selectedIndex == index) return;
- SelectIndex(index);
- PlayerPause();
- ChangeEmbryo(index + 1);
- };
- }
- }
- catch (Exception ex)
- {
- ExLog(ex, "InitCustomNew");
- }
- }
- private object lock1 = new object();
- private Embryo SetWellImage(int index, int oldIndex)
- {
- lock (lock1)
- {
- if (vm == null || vm.CurrentDish == null) return null;
- Image imageBorder = ImageList[index];
- var itemEmbryo = vm.CurrentDish.embryoList.FirstOrDefault(x => x.wellSn == index + 1);
- if (itemEmbryo == null)
- {
- if (index == oldIndex)
- {
- imageBorder.Source = new BitmapImage(new Uri("pack://application:,,,/ivf_tl_Manage;component/Resources/Images/DetailEmbryoSelectedIcon.png", UriKind.Absolute));
- }
- else
- {
- imageBorder.Source = new BitmapImage(new Uri("pack://application:,,,/ivf_tl_Manage;component/Resources/Images/DetailNoEmbryoBackground.png", UriKind.Absolute));
- }
- return itemEmbryo;
- }
- string borderSource = null;
- switch ((EmbryoState)itemEmbryo.state)
- {
- case EmbryoState.End:
- case EmbryoState.None:
- if (itemEmbryo.alarm == 1)
- {
- borderSource = "pack://application:,,,/ivf_tl_Manage;component/Resources/Images/DetailEmbryoState3Icon.png";
- }
- else
- {
- if (index == oldIndex)
- {
- borderSource = "pack://application:,,,/ivf_tl_Manage;component/Resources/Images/DetailEmbryoSelectedIcon.png";
- }
- else
- {
- borderSource = "pack://application:,,,/ivf_tl_Manage;component/Resources/Images/DetailEmbryoBackground.png";
- }
- }
- break;
- case EmbryoState.Freezing: //冷冻
- borderSource = "pack://application:,,,/ivf_tl_Manage;component/Resources/Images/DetailEmbryoState1Icon.png";
- break;
- case EmbryoState.Transplant://移植
- borderSource = "pack://application:,,,/ivf_tl_Manage;component/Resources/Images/DetailEmbryoState2Icon.png";
- break;
- case EmbryoState.Cancellation://作废
- borderSource = "pack://application:,,,/ivf_tl_Manage;component/Resources/Images/DetailEmbryoState3Icon.png";
- break;
- case EmbryoState.Delete://删除
- borderSource = "pack://application:,,,/ivf_tl_Manage;component/Resources/Images/DetailEmbryoState4Icon.png";
- break;
- }
- imageBorder.Source = new BitmapImage(new Uri(borderSource, UriKind.Absolute));
- return itemEmbryo;
- }
- }
- private void EmbryoAlarmEvent(int wellsn, int stateAlarm)
- {
- try
- {
- Dispatcher.Invoke(() => { SetWellImage(wellsn - 1, selectedIndex); });
- }
- catch (Exception)
- {
- }
- }
- /// <summary>
- /// 切换well
- /// </summary>
- /// <param name="well"></param>
- public void ChangeEmbryo(int well)
- {
- //try
- //{
- // this._bigFocal_Button.IsEnabled = true;
- // this._smallFocal_Button.IsEnabled = true;
- // SetVideoButtonState(false);
- // vm.CurrentFocal = 0;
- // vm.CurrentPicZhen = null;
- // vm.CurrentEmbryo = null;
- // vm.CurrentVideoData = null;
- // vm.VideoAllTime = 1;
- // vm.VideoCurrentTime = 0;
- // if (vm.CurrentDish != null && vm.CurrentDish.id > 0) vm.CurrentEmbryo = vm.CurrentDish.embryoList.FirstOrDefault(x => x.wellSn == well);
- // vm.CurrentVideoData = vm.AllEmbryoPicAndVideo.FirstOrDefault(x => x.wellSn == well);
- // SetPreview(well);
- // SetVideo(vm.CurrentFocal, true);
- //}
- //catch (Exception ex)
- //{
- // ExLog(ex, "ChangeEmbryo");
- //}
- try
- {
- PlayerDispose();
- if (vm == null) return;
- vm.CurrentEmbryo = null;
- vm.CurrentWellDishPicAndVideo = null;
- vm.CurrentWellLayerPicAndVideo = null;
- SetVideoButtonState(false);
- vm.CurrentFocal = 0;
- this._bigFocal_Button.IsEnabled = true;
- this._smallFocal_Button.IsEnabled = true;
- if (vm.CurrentDish != null && vm.CurrentDish.id > 0) vm.CurrentEmbryo = vm.CurrentDish.embryoList.FirstOrDefault(x => x.wellSn == well);
- if (vm.CurrentEmbryo == null)
- {
- vm.VideoAllTime = 1;
- vm.VideoCurrentTime = 0;
- }
- if (vm.CurrentEmbryo != null) vm.CurrentWellDishPicAndVideo = vm.DishPicAndVideoList.FirstOrDefault(x => x.wellSn == vm.CurrentEmbryo.wellSn);
- if (vm.CurrentWellDishPicAndVideo != null) vm.CurrentWellLayerPicAndVideo = vm.CurrentWellDishPicAndVideo.videos.FirstOrDefault(x => x.pictureLayer == 0);
- SetPreview(well);
- SetVideo(vm.CurrentFocal, true);
- if (vm.CurrentWellLayerPicAndVideo != null && vm.CurrentWellLayerPicAndVideo.videoPictures.Any())
- {
- this._bigFocal_Button.IsEnabled = true;
- this._smallFocal_Button.IsEnabled = true;
- if (string.IsNullOrEmpty(vm.CurrentWellLayerPicAndVideo.videoUrl) || vm.CurrentWellLayerPicAndVideo.videoUrl == AppData.Instance.CleanVideoString)
- {
- vm.VideoAllTime = 1;
- vm.VideoCurrentTime = 0;
- vm.VideoAllTime = vm.CurrentWellLayerPicAndVideo.videoPictures.Count;
- vm.VideoCurrentTime = vm.VideoAllTime;
- }
- }
- else
- {
- this._bigFocal_Button.IsEnabled = false;
- this._smallFocal_Button.IsEnabled = false;
- }
- }
- catch (Exception ex)
- {
- ExLog(ex, "ChangeEmbryo");
- }
- }
- /// <summary>
- /// 设置视频
- /// </summary>
- private bool SetVideo(int focal, bool isUpdate)
- {
- PlayerDispose();
- if (vm.CurrentWellLayerPicAndVideo != null && !string.IsNullOrEmpty(vm.CurrentWellLayerPicAndVideo.videoUrl) && vm.CurrentWellLayerPicAndVideo.videoUrl != AppData.Instance.CleanVideoString)
- if (PlayerSetSource($"{AppData.Instance.BaseUrl}{vm.CurrentWellLayerPicAndVideo.videoUrl}?token={AppData.Instance.HttpServiceCall.GetToken()}")) return true;
- if (!isUpdate) return false;
- vm.VideoAllTime = 1;
- vm.VideoCurrentTime = 0;
- return true;
- }
- /// <summary>
- /// 设置选中状态
- /// </summary>
- /// <param name="index"></param>
- private void SelectIndex(int index)
- {
- switch (TextBlockList[selectedIndex].Tag.ToString())
- {
- case "0":
- TextBlockList[selectedIndex].Foreground = noEmbryoForeground;
- break;
- case "1":
- TextBlockList[selectedIndex].Foreground = noPicForeground;
- break;
- case "2":
- TextBlockList[selectedIndex].Foreground = deaeatForeground;
- break;
- }
- SetWellImage(selectedIndex, -1);
- selectedIndex = index;
- TextBlockList[selectedIndex].Foreground = new SolidColorBrush(Colors.White);
- var itemEmbryo = vm.CurrentDish.embryoList.FirstOrDefault(x => x.wellSn == selectedIndex + 1);
- if (itemEmbryo == null)
- {
- ImageList[selectedIndex].Source = new BitmapImage(new Uri("pack://application:,,,/ivf_tl_Manage;component/Resources/Images/DetailEmbryoSelectedIcon.png", UriKind.Absolute));
- }
- else
- {
- if ((itemEmbryo.state == (int)EmbryoState.End || itemEmbryo.state == (int)EmbryoState.None) && itemEmbryo.alarm == 0)
- {
- ImageList[selectedIndex].Source = new BitmapImage(new Uri("pack://application:,,,/ivf_tl_Manage;component/Resources/Images/DetailEmbryoSelectedIcon.png", UriKind.Absolute));
- }
- }
- RotateTransform rotateTransform = this._sx.RenderTransform as RotateTransform;
- rotateTransform.Angle = angle * selectedIndex;
- }
- private void SelectIndexold(int index)
- {
- switch (TextBlockList[selectedIndex].Tag.ToString())
- {
- case "0":
- TextBlockList[selectedIndex].Foreground = noEmbryoForeground;
- break;
- case "1":
- TextBlockList[selectedIndex].Foreground = noPicForeground;
- break;
- case "2":
- TextBlockList[selectedIndex].Foreground = deaeatForeground;
- break;
- }
- switch (ImageList[selectedIndex].Tag.ToString())
- {
- case "0":
- ImageList[selectedIndex].Source = new BitmapImage(new Uri("pack://application:,,,/ivf_tl_Manage;component/Resources/Images/DetailNoEmbryoBackground.png", UriKind.Absolute));
- break;
- case "1":
- case "2":
- ImageList[selectedIndex].Source = new BitmapImage(new Uri("pack://application:,,,/ivf_tl_Manage;component/Resources/Images/DetailEmbryoBackground.png", UriKind.Absolute));
- break;
- }
- selectedIndex = index;
- TextBlockList[selectedIndex].Foreground = new SolidColorBrush(Colors.White);
- switch (ImageList[selectedIndex].Tag.ToString())
- {
- case "0":
- case "1":
- case "2":
- ImageList[selectedIndex].Source = new BitmapImage(new Uri("pack://application:,,,/ivf_tl_Manage;component/Resources/Images/DetailEmbryoSelectedIcon.png", UriKind.Absolute));
- break;
- }
- RotateTransform rotateTransform = this._sx.RenderTransform as RotateTransform;
- rotateTransform.Angle = angle * selectedIndex;
- }
- /// <summary>
- /// 设置封面
- /// </summary>
- /// <param name="well"></param>
- private void SetPreview(int well)
- {
- vm.SelectedFps = new KeyValuePair<double, string>(1d, "1.0x");
- currentMediaElement.SpeedRatio = 1d;
- //this._preview.Visibility = Visibility.Visible;
- this.Canvas_preview.Visibility = Visibility.Visible;
- if (vm.CurrentEmbryo == null)
- {
- //this._preview.Source = new BitmapImage(new Uri("pack://application:,,,/ivf_tl_Manage;component/Resources/Images/DetailNoEmbryoBigPic.png", UriKind.Absolute));
- AppData.Instance.SetImageSource(this._preview, LogoEnum.Circle);
- this.TextBlock_preview.Text = peitai;
- return;
- }
- if (vm.CurrentWellDishPicAndVideo == null || string.IsNullOrEmpty(vm.CurrentWellDishPicAndVideo.lastPicture))
- {
- this._preview.Source = new BitmapImage(new Uri("pack://application:,,,/ivf_tl_Manage;component/Resources/Images/DetailNoPicBigPic.png", UriKind.Absolute));
- this.TextBlock_preview.Text = paiShe;
- return;
- }
- this._preview.Source = AppData.Instance.StringToBitmapImage($"{AppData.Instance.BaseUrl}{vm.CurrentWellDishPicAndVideo.lastPicture}?token={AppData.Instance.HttpServiceCall.GetToken()}");
- this.TextBlock_preview.Text = "";
- }
- /// <summary>
- /// 设置封面为无视频
- /// </summary>
- /// <param name="well"></param>
- private void SetPreviewNoVideo()
- {
- //this._preview.Visibility = Visibility.Visible;
- this.Canvas_preview.Visibility = Visibility.Visible;
- this._preview.Source = new BitmapImage(new Uri("pack://application:,,,/ivf_tl_Manage;component/Resources/Images/DetailNoVideoPic.png", UriKind.Absolute));
- this.TextBlock_preview.Text = shiping;
- }
- /// <summary>
- /// 设置缩略图
- /// </summary>
- /// <param name="datas"></param>
- private void SetEmbryoPic()
- {
- Image item = null;
- for (int i = 0; i < 16; i++)
- {
- item = PicImageList[i];
- var embryo = vm.CurrentDish.embryoList.FirstOrDefault(x => x.wellSn == i + 1);
- if (embryo == null)
- {
- item.Source = new BitmapImage(new Uri("pack://application:,,,/ivf_tl_Manage;component/Resources/Images/DetailNoEmbryo.png", UriKind.Absolute));
- continue;
- }
- //var currentData = vm.AllEmbryoPicAndVideo.FirstOrDefault(x => x.wellSn == embryo.wellSn);
- var currentData = vm.DishPicAndVideoList.FirstOrDefault(x => x.wellSn == embryo.wellSn);
- if (currentData == null || currentData.lastPicture == null)
- {
- item.Source = new BitmapImage(new Uri("pack://application:,,,/ivf_tl_Manage;component/Resources/Images/DetailEmbryoNoPic.png", UriKind.Absolute));
- }
- else
- {
- item.Source = AppData.Instance.StringToBitmapImage($"{AppData.Instance.BaseUrl}{currentData.lastPicture.Replace(AppData.Instance.PicSuf, $"_80x80{AppData.Instance.PicSuf}")}?token={AppData.Instance.HttpServiceCall.GetToken()}");
- }
- }
- }
- /// <summary>
- /// 切换图层
- /// </summary>
- /// <param name="isMax"></param>
- private void ChangeFocal(bool isMax)
- {
- try
- {
- PlayerPause();
- int newCurrentFocal = vm.CurrentFocal;
- int maxFocal = (vm.CurrentPic.totalLayer - 1) / 2;
- int minFocal = -maxFocal;
- if (isMax) newCurrentFocal++;
- else newCurrentFocal--;
- if (newCurrentFocal < maxFocal) this._bigFocal_Button.IsEnabled = true;
- else this._bigFocal_Button.IsEnabled = false;
- if (newCurrentFocal > minFocal) this._smallFocal_Button.IsEnabled = true;
- else this._smallFocal_Button.IsEnabled = false;
- if (newCurrentFocal < minFocal || newCurrentFocal > maxFocal) return;
- //this._preview.Visibility = Visibility.Hidden;
- this.Canvas_preview.Visibility = Visibility.Hidden;
- Task.Run(() =>
- {
- Dispatcher.Invoke(() =>
- {
- var a = AppData.Instance.StringToBitmapImage($"{AppData.Instance.BaseUrl}{vm.detailProvider.GetImageUrlApi(vm.CurrentEmbryo.tlSn, vm.CurrentEmbryo.houseSn, vm.CurrentEmbryo.id, newCurrentFocal, vm.CurrentPic.developTime)}?token={AppData.Instance.HttpServiceCall.GetToken()}");
- if (a != null)
- {
- //this._preview.Visibility = Visibility.Visible;
- this.Canvas_preview.Visibility = Visibility.Visible;
- this._preview.Source = a;
- this.TextBlock_preview.Text = "";
- }
- });
- });
- newCurrentTime = 0;
- vm.CurrentFocal = newCurrentFocal;
- SetVideoButtonState(false);
- if (vm.CurrentWellDishPicAndVideo == null) return;
- vm.CurrentWellLayerPicAndVideo = vm.CurrentWellDishPicAndVideo.videos.FirstOrDefault(x => x.pictureLayer == vm.CurrentFocal);
- SetVideo(vm.CurrentFocal, false);
- if (vm.CurrentWellLayerPicAndVideo.videoPictures == null || !vm.CurrentWellLayerPicAndVideo.videoPictures.Any())
- {
- vm.CurrentWellLayerPicAndVideo.videoPictures = vm.detailProvider.GetVideoTimeLineApi(vm.CurrentEmbryo.tlSn, vm.CurrentEmbryo.houseSn, vm.CurrentEmbryo.id, vm.CurrentFocal);
- }
- if (vm.CurrentWellLayerPicAndVideo.videoPictures == null || !vm.CurrentWellLayerPicAndVideo.videoPictures.Any() || vm.CurrentPic == null) return;
- int i = 0;
- foreach (var item in vm.CurrentWellLayerPicAndVideo.videoPictures)
- {
- if (item.developTime >= vm.CurrentPic.developTime) break;
- i++;
- }
- newCurrentTime = i * (1000.00 / vm.CurrentWellLayerPicAndVideo.fps);
- //if (i == 0) newCurrentTime = 0;
- //else newCurrentTime = (i + 1) * (1000.00 / vm.CurrentWellLayerPicAndVideo.fps);
- }
- catch (Exception ex)
- {
- ExLog(ex, "ChangeFocal");
- }
- }
- /// <summary>
- /// 切换图层
- /// </summary>
- /// <param name="isMax"></param>
- private void ChangeImageFocal(bool isMax)
- {
- try
- {
- int maxFocal = (vm.CurrentPic.totalLayer - 1) / 2;
- int minFocal = -maxFocal;
- int newCurrentFocal = vm.CurrentFocal;
- if (isMax) newCurrentFocal++;
- else newCurrentFocal--;
- if (newCurrentFocal < maxFocal) this._bigFocal_Button.IsEnabled = true;
- else this._bigFocal_Button.IsEnabled = false;
- if (newCurrentFocal > minFocal) this._smallFocal_Button.IsEnabled = true;
- else this._smallFocal_Button.IsEnabled = false;
- if (newCurrentFocal < minFocal || newCurrentFocal > maxFocal) return;
- var newCurrentWellLayerPicAndVideo = vm.CurrentWellDishPicAndVideo.videos.FirstOrDefault(x => x.pictureLayer == newCurrentFocal);
- newCurrentWellLayerPicAndVideo = vm.CurrentWellDishPicAndVideo.videos.FirstOrDefault(x => x.pictureLayer == newCurrentFocal);
- if (newCurrentWellLayerPicAndVideo == null) return;
- if (!newCurrentWellLayerPicAndVideo.videoPictures.Any()) return;
- vm.CurrentWellLayerPicAndVideo = newCurrentWellLayerPicAndVideo;
- //this._preview.Visibility = Visibility.Visible;
- this.Canvas_preview.Visibility = Visibility.Visible;
- var oldDevelopTime = vm.CurrentPic.developTime;
- vm.CurrentFocal = newCurrentFocal;
- vm.VideoAllTime = vm.CurrentWellLayerPicAndVideo.videoPictures.Count;
- int i = 0;
- foreach (var item in vm.CurrentWellLayerPicAndVideo.videoPictures)
- {
- if (item.developTime >= oldDevelopTime) break;
- i++;
- }
- //Debug.WriteLine($"{vm.CurrentWellLayerPicAndVideo.videoPictures[163].developTime} -> {oldDevelopTime}");
- //Debug.WriteLine($"focal:{i} -》 {vm.CurrentWellLayerPicAndVideo.videoPictures.Count}");
- //vm.VideoCurrentTime = vm.VideoAllTime;
- this._preview.Source = AppData.Instance.StringToBitmapImage($"{AppData.Instance.BaseUrl}{vm.CurrentWellLayerPicAndVideo.videoPictures[i].imageUrl}?token={AppData.Instance.HttpServiceCall.GetToken()}");
- this.TextBlock_preview.Text = "";
- vm.VideoCurrentTime = 0;
- vm.VideoCurrentTime = i + 1;
- return;
- }
- catch (Exception ex)
- {
- ExLog(ex, "ChangeImageFocal");
- }
- }
- private void ChangeFocalNoVideo(bool isMax)
- {
- try
- {
- int maxFocal = (vm.CurrentPic.totalLayer - 1) / 2;
- int minFocal = -maxFocal;
- int newCurrentFocal = vm.CurrentFocal;
- CC:
- if (isMax) newCurrentFocal++;
- else newCurrentFocal--;
- if (newCurrentFocal < maxFocal) this._bigFocal_Button.IsEnabled = true;
- else this._bigFocal_Button.IsEnabled = false;
- if (newCurrentFocal > minFocal) this._smallFocal_Button.IsEnabled = true;
- else this._smallFocal_Button.IsEnabled = false;
- if (newCurrentFocal < minFocal || newCurrentFocal > maxFocal) return;
- var aa = vm.CurrentWellDishPicAndVideo.videos.FirstOrDefault(x => x.pictureLayer == newCurrentFocal);
- if (aa == null) goto CC;
- if (aa.videoPictures == null || !aa.videoPictures.Any())
- {
- aa.videoPictures = vm.detailProvider.GetVideoTimeLineApi(vm.CurrentEmbryo.tlSn, vm.CurrentEmbryo.houseSn, vm.CurrentEmbryo.id, newCurrentFocal);
- }
- if (aa.videoPictures == null || !aa.videoPictures.Any()) goto CC;
- bool b = false;
- string imageUrl = null;
- foreach (var item in aa.videoPictures)
- {
- if (item.developTime == vm.CurrentPic.developTime)
- {
- b = true;
- imageUrl = item.imageUrl;
- break;
- }
- }
- if (!b) goto CC;
- Task.Run(() =>
- {
- if (string.IsNullOrEmpty(imageUrl)) imageUrl = vm.detailProvider.GetImageUrlApi(vm.CurrentEmbryo.tlSn, vm.CurrentEmbryo.houseSn, vm.CurrentEmbryo.id, newCurrentFocal, vm.CurrentPic.developTime);
- Dispatcher.Invoke(() =>
- {
- var a = AppData.Instance.StringToBitmapImage($"{AppData.Instance.BaseUrl}{imageUrl}?token={AppData.Instance.HttpServiceCall.GetToken()}");
- if (a != null)
- {
- this.Canvas_preview.Visibility = Visibility.Visible;
- this._preview.Source = a;
- }
- });
- });
- vm.CurrentFocal = newCurrentFocal;
- }
- catch (Exception ex)
- {
- ExLog(ex, "ChangeFocalNoVideo");
- }
- }
- private void SetFocal(int newFocal, int newDevelopTime)
- {
- try
- {
- int maxFocal = (vm.CurrentPic.totalLayer - 1) / 2;
- int minFocal = -maxFocal;
- int newCurrentFocal = newFocal;
- if (newCurrentFocal < maxFocal) this._bigFocal_Button.IsEnabled = true;
- else this._bigFocal_Button.IsEnabled = false;
- if (newCurrentFocal > minFocal) this._smallFocal_Button.IsEnabled = true;
- else this._smallFocal_Button.IsEnabled = false;
- if (newCurrentFocal < minFocal || newCurrentFocal > maxFocal)
- {
- MessageShow($"标记图层{newCurrentFocal}超出范围{minFocal}-{maxFocal}");
- return;
- }
- var aa = vm.CurrentWellDishPicAndVideo.videos.FirstOrDefault(x => x.pictureLayer == newCurrentFocal);
- if (aa == null)
- {
- MessageShow($"没有对应图层:{newCurrentFocal}");
- return;
- }
- if (aa.videoPictures == null || !aa.videoPictures.Any())
- {
- aa.videoPictures = vm.detailProvider.GetVideoTimeLineApi(vm.CurrentEmbryo.tlSn, vm.CurrentEmbryo.houseSn, vm.CurrentEmbryo.id, newCurrentFocal);
- }
- if (aa.videoPictures == null || !aa.videoPictures.Any())
- {
- MessageShow($"目标图层没有图片:{newCurrentFocal}");
- return;
- }
- bool b = false;
- string imageUrl = null;
- foreach (var item in aa.videoPictures)
- {
- if (item.developTime == newDevelopTime)
- {
- b = true;
- imageUrl = item.imageUrl;
- break;
- }
- }
- if (!b)
- {
- MessageShow($"{newCurrentFocal}层没有发育时长为{newDevelopTime}分钟的图片");
- return;
- }
- Task.Run(() =>
- {
- if (string.IsNullOrEmpty(imageUrl)) imageUrl = vm.detailProvider.GetImageUrlApi(vm.CurrentEmbryo.tlSn, vm.CurrentEmbryo.houseSn, vm.CurrentEmbryo.id, newCurrentFocal, newDevelopTime);
- Dispatcher.Invoke(() =>
- {
- var a = AppData.Instance.StringToBitmapImage($"{AppData.Instance.BaseUrl}{imageUrl}?token={AppData.Instance.HttpServiceCall.GetToken()}");
- if (a != null)
- {
- this.Canvas_preview.Visibility = Visibility.Visible;
- this._preview.Source = a;
- }
- });
- });
- vm.CurrentFocal = newCurrentFocal;
- }
- catch (Exception ex)
- {
- ExLog(ex, "SetFocal");
- }
- }
- #endregion
- #region 视频基础操作
- double newCurrentTime = -1;
- double beilv = 1;
- MediaElement currentMediaElement = null;
- /// <summary>
- /// 定时器
- /// </summary>
- public System.Timers.Timer dispatcherTimer = new System.Timers.Timer();
- /// <summary>
- /// 视频状态
- /// </summary>
- public PlayerStateEnum PlayerState { get; set; } = PlayerStateEnum.Nothing;
- /// <summary>
- /// 播放器事件初始化
- /// </summary>
- public void PlayerEvent(MediaElement mediaElement)
- {
- try
- {
- currentMediaElement = mediaElement;
- currentMediaElement.MediaEnded -= MediaEndedEvent;
- currentMediaElement.MediaOpened -= MediaOpenedEvent;
- currentMediaElement.MediaFailed -= MediaFailedEvent;
- currentMediaElement.MediaEnded += MediaEndedEvent;
- currentMediaElement.MediaOpened += MediaOpenedEvent;
- currentMediaElement.MediaFailed += MediaFailedEvent;
- dispatcherTimer.Interval = 25;
- dispatcherTimer.Elapsed -= dispatcherTimer_Elapsed;
- dispatcherTimer.Elapsed += dispatcherTimer_Elapsed;
- }
- catch (Exception ex)
- {
- ExLog(ex, $"播放器事件初始化");
- }
- }
- /// <summary>
- /// 设置播放源
- /// </summary>
- /// <param name="FileName"></param>
- public bool PlayerSetSource(string FileName)
- {
- try
- {
- PlayerDispose();
- currentMediaElement.LoadedBehavior = MediaState.Manual;
- //指定媒体文件地址
- currentMediaElement.Source = new Uri(FileName, UriKind.RelativeOrAbsolute);
- currentMediaElement.ScrubbingEnabled = true;
- currentMediaElement.SpeedRatio = 1;
- currentMediaElement.Play();
- currentMediaElement.Pause();
- return true;
- }
- catch (Exception ex)
- {
- ExLog(ex, $"设置播放源");
- return false;
- }
- }
- /// <summary>
- /// 播放器加载视频完成事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void MediaOpenedEvent(object sender, RoutedEventArgs e)
- {
- try
- {
- //bool isWhile = true;
- //while (isWhile)
- //{
- // isWhile = !(currentMediaElement.DownloadProgress == 1);
- // Thread.Sleep(20);
- //}
- //isWhile = true;
- //while (isWhile)
- //{
- // isWhile = !(currentMediaElement.BufferingProgress == 1);
- // Thread.Sleep(20);
- //}
- currentMediaElement.ScrubbingEnabled = false;
- vm.VideoAllTime = 1;
- vm.VideoCurrentTime = 0;
- if (currentMediaElement.NaturalDuration.HasTimeSpan)
- {
- currentMediaElement.LoadedBehavior = MediaState.Manual;
- PlayerState = PlayerStateEnum.Paused;
- vm.VideoAllTime = currentMediaElement.NaturalDuration.TimeSpan.TotalMilliseconds;
- currentMediaElement.ScrubbingEnabled = true;
- currentMediaElement.Play();
- currentMediaElement.Pause();
- if (newCurrentTime != -1)
- {
- if (newCurrentTime < 0) newCurrentTime = 0;
- if (newCurrentTime > vm.VideoAllTime) newCurrentTime = vm.VideoAllTime;
- SetTimeProgressbarProgressValue(newCurrentTime);
- SetPlayerPosition(vm.VideoCurrentTime);
- newCurrentTime = -1;
- }
- else
- {
- SetTimeProgressbarProgressValue(vm.VideoAllTime);
- SetPlayerPosition(vm.VideoCurrentTime);
- }
- SetVideoButtonState(true);
- }
- else
- {
- PlayerState = PlayerStateEnum.Nothing;
- }
- }
- catch (Exception ex)
- {
- PlayerState = PlayerStateEnum.Error;
- ExLog(ex, $"播放器加载视频完成事件");
- }
- }
- /// <summary>
- /// 播放完成事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void MediaEndedEvent(object sender, RoutedEventArgs e)
- {
- try
- {
- PlayerState = PlayerStateEnum.Paused;
- dispatcherTimer_Stop();
- //currentMediaElement.Stop();
- currentMediaElement.Play();
- currentMediaElement.Pause();
- SetTimeProgressbarProgressValue(vm.VideoAllTime);
- SetPlayerPosition(vm.VideoAllTime);
- SetPlayButton(false);
- }
- catch (Exception ex)
- {
- ExLog(ex, $"播放完成事件");
- }
- }
- /// <summary>
- /// 播放器错误事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- /// <exception cref="NotImplementedException"></exception>
- private void MediaFailedEvent(object? sender, ExceptionRoutedEventArgs e)
- {
- try
- {
- PlayerState = PlayerStateEnum.Error;
- vm.VideoAllTime = 1;
- vm.VideoCurrentTime = 0;
- SetPlayButton(false);
- string ss = "";
- MediaElement med = sender as MediaElement;
- if (med != null)
- {
- ss = med.Source.ToString();
- ErrorLog($"{ss},视频遇到错误", LogEnum.RunError);
- }
- dispatcherTimer_Stop();
- ExLog(e.ErrorException, $"MediaFailedEvent:{ss}");
- }
- catch (Exception ex)
- {
- ExLog(ex, $"播放器错误事件");
- }
- }
- /// <summary>
- /// 播放按钮图标设置
- /// </summary>
- private void SetPlayButton(bool isPlaying)
- {
- if (isPlaying)//正在播放,设置为暂停按钮
- {
- this._playButton.IconSource = new BitmapImage(new Uri("pack://application:,,,/ivf_tl_Manage;component/Resources/Images/DetailPauseVideoButtonIcon.png", UriKind.Absolute));
- this._playButton.MouseOverIconSource = new BitmapImage(new Uri("pack://application:,,,/ivf_tl_Manage;component/Resources/Images/DetailPauseVideoButtonMouseIcon.png", UriKind.Absolute));
- }
- else//未播放,设置为播放按钮
- {
- this._playButton.IconSource = new BitmapImage(new Uri("pack://application:,,,/ivf_tl_Manage;component/Resources/Images/DetailStartVideoButtonIcon.png", UriKind.Absolute));
- this._playButton.MouseOverIconSource = new BitmapImage(new Uri("pack://application:,,,/ivf_tl_Manage;component/Resources/Images/DetailStartVideoButtonMouseIcon.png", UriKind.Absolute));
- }
- }
- /// <summary>
- /// 定时器事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void dispatcherTimer_Elapsed(object? sender, ElapsedEventArgs e)
- {
- try
- {
- Dispatcher.Invoke(() =>
- {
- SetTimeProgressbarProgressValue(currentMediaElement.Position.TotalMilliseconds);
- });
- if (PlayerState != PlayerStateEnum.Playing)
- {
- dispatcherTimer_Stop();
- }
- }
- catch (Exception ex)
- {
- ExLog(ex, $"定时器事件");
- }
- }
- /// <summary>
- /// 停止定时器
- /// </summary>
- public void dispatcherTimer_Stop()
- {
- try
- {
- if (dispatcherTimer.Enabled)
- {
- dispatcherTimer.Enabled = false;
- dispatcherTimer.Stop();
- }
- }
- catch (Exception ex)
- {
- ExLog(ex, $"停止定时器");
- }
- }
- /// <summary>
- ///设置视频进度
- /// </summary>
- /// <param name="progressValue"></param>
- public void SetPlayerPosition(double currentTime)
- {
- try
- {
- if (PlayerState != PlayerStateEnum.Nothing && PlayerState != PlayerStateEnum.Error)
- {
- currentMediaElement.Position = TimeSpan.FromMilliseconds(currentTime);
- }
- }
- catch (Exception ex)
- {
- ExLog(ex, $"进度条变换以后设置视频进度");
- }
- }
- /// <summary>
- /// 设置进度条
- /// </summary>
- public void SetTimeProgressbarProgressValue(double newTime)
- {
- try
- {
- vm.VideoCurrentTime = newTime;
- }
- catch (Exception ex)
- {
- ExLog(ex, $"视频进度变换以后设置进度条");
- }
- }
- /// <summary>
- /// 释放播放器
- /// </summary>
- public void PlayerDispose()
- {
- try
- {
- dispatcherTimer_Stop();
- if (PlayerState != PlayerStateEnum.Nothing)
- {
- currentMediaElement.LoadedBehavior = MediaState.Close;
- PlayerState = PlayerStateEnum.Nothing;
- }
- }
- catch (Exception ex)
- {
- ExLog(ex, $"释放播放器");
- }
- }
- /// <summary>
- /// 设置倍率
- /// </summary>
- /// <param name="newSpeedRatio"></param>
- public void PlayerSetSpeedRatio(double newSpeedRatio)
- {
- try
- {
- beilv = newSpeedRatio;
- if (PlayerState != PlayerStateEnum.Nothing && PlayerState != PlayerStateEnum.Error)
- {
- currentMediaElement.LoadedBehavior = MediaState.Manual;
- currentMediaElement.SpeedRatio = newSpeedRatio;
- }
- }
- catch (Exception ex)
- {
- ExLog(ex, $"设置倍率");
- }
- }
- /// <summary>
- /// 播放操作
- /// </summary>
- public bool PlayerPlay()
- {
- try
- {
- bool isPlay = false;
- switch (PlayerState)
- {
- case PlayerStateEnum.Error:
- break;
- case PlayerStateEnum.Nothing:
- break;
- case PlayerStateEnum.Opened:
- isPlay = true;
- break;
- case PlayerStateEnum.Paused:
- isPlay = true;
- break;
- case PlayerStateEnum.Playing:
- break;
- case PlayerStateEnum.Stopped:
- currentMediaElement.Stop();
- isPlay = true;
- break;
- }
- if (isPlay)
- {
- PlayerState = PlayerStateEnum.Playing;
- if (vm.VideoCurrentTime == vm.VideoAllTime)
- {
- SetPlayerPosition(0);
- }
- if (!dispatcherTimer.Enabled)
- {
- dispatcherTimer.Start();
- }
- PlayerSetSpeedRatio(beilv);
- currentMediaElement.Play();
- SetPlayButton(true);
- return true;
- }
- return false;
- }
- catch (Exception ex)
- {
- ExLog(ex, $"播放操作");
- return false;
- }
- }
- /// <summary>
- /// 暂停操作
- /// </summary>
- /// <param name="isSetState"></param>
- public bool PlayerPause()
- {
- try
- {
- bool isPause = false;
- switch (PlayerState)
- {
- case PlayerStateEnum.Error:
- break;
- case PlayerStateEnum.Nothing:
- break;
- case PlayerStateEnum.Opened:
- break;
- case PlayerStateEnum.Paused:
- break;
- case PlayerStateEnum.Playing:
- isPause = true;
- break;
- case PlayerStateEnum.Stopped:
- break;
- }
- if (isPause)
- {
- PlayerState = PlayerStateEnum.Paused;
- currentMediaElement.Pause();
- dispatcherTimer_Stop();
- SetPlayButton(false);
- return true;
- }
- return false;
- }
- catch (Exception ex)
- {
- ExLog(ex, $"暂停操作");
- return false;
- }
- }
-
- /// <summary>
- /// 上一帧
- /// </summary>
- public void PlayerLastFrame(int zhenshu)
- {
- try
- {
- bool isOK = false;
- bool isStop = false;
- switch (PlayerState)
- {
- case PlayerStateEnum.Error:
- break;
- case PlayerStateEnum.Nothing:
- break;
- case PlayerStateEnum.Opened:
- isOK = true;
- break;
- case PlayerStateEnum.Paused:
- isOK = true;
- break;
- case PlayerStateEnum.Playing:
- break;
- case PlayerStateEnum.Stopped:
- isOK = true;
- break;
- }
- if (isOK)
- {
- var zhen = (1000d / zhenshu);
- var currentPositionTime = currentMediaElement.Position.TotalMilliseconds;
- if (currentPositionTime == 0)
- {
- return;
- }
- if (currentPositionTime < zhen)
- {
- SetPlayerPosition(0);
- SetTimeProgressbarProgressValue(0);
- return;
- }
- var c = currentPositionTime - zhen;
- SetPlayerPosition(c);
- SetTimeProgressbarProgressValue(c);
- return;
- }
- else
- {
- }
- }
- catch (Exception ex)
- {
- ExLog(ex, $"上一帧");
- }
- }
- /// <summary>
- /// 下一帧
- /// </summary>
- public void PlayerNextFrame(int zhenshu)
- {
- try
- {
- bool isOK = false;
- bool isStop = false;
- switch (PlayerState)
- {
- case PlayerStateEnum.Error:
- break;
- case PlayerStateEnum.Nothing:
- break;
- case PlayerStateEnum.Opened:
- isOK = true;
- break;
- case PlayerStateEnum.Paused:
- isOK = true;
- break;
- case PlayerStateEnum.Playing:
- break;
- case PlayerStateEnum.Stopped:
- isOK = true;
- break;
- }
- if (isOK)
- {
- var newpos = currentMediaElement.Position.TotalMilliseconds + (1000d / zhenshu);
- if (newpos > vm.VideoAllTime)
- {
- newpos = vm.VideoAllTime;
- }
- SetPlayerPosition(newpos);
- SetTimeProgressbarProgressValue(newpos);
- return;
- }
- else
- {
- }
- if (isStop)
- {
- return;
- }
- }
- catch (Exception ex)
- {
- ExLog(ex, $"下一帧");
- }
- }
- private void Canvas_MouseDown(object sender, MouseButtonEventArgs e)
- {
- if (vm == null) return;
- if (!(sender is Canvas canvas)) return;
- if (!(canvas.Tag is MarkEntity value)) return;
- if (value.maxTime != 0)
- {
- QuickButton_Click(value.maxTime, value.maxTime, value.name);
- if (value.pictureLayer != vm.CurrentFocal) SetFocal(value.pictureLayer, value.maxTime);
- }
- }
- private void SetVideoButtonState(bool IsEnabledVideo)
- {
- Task.Run(() =>
- {
- Dispatcher.Invoke(() =>
- {
- this._lastButton.IsEnabled = IsEnabledVideo;
- this._playButton.IsEnabled = IsEnabledVideo;
- this._nextButton.IsEnabled = IsEnabledVideo;
- });
- });
- }
- #endregion
- }
- }
|