| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106 |
- using ivf_tl_CustomControls;
- using ivf_tl_Entity.Entity;
- using ivf_tl_Entity.Entity.Mark;
- using ivf_tl_Entity.Enums;
- using ivf_tl_Manage.UserControls;
- using ivf_tl_Service.HttpProvider;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- 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.Media.TextFormatting;
- using System.Windows.Shapes;
- namespace ivf_tl_Manage.Win
- {
- /// <summary>
- /// ImageSourceWindow.xaml 的交互逻辑
- /// </summary>
- public partial class ImageSourceWindow : Window
- {
- PicProvider picProvider = null;
- //List<PictureEntity> picList = new List<PictureEntity>();
- public ImageSourceWindow(long embryoId, int houseSn, int pictureLayer, string tlSn)//List<PictureEntity> list,
- {
- try
- {
- InitializeComponent();
- this.Owner = AppData.Instance.MainWindow;
- picProvider = AppData.Instance.GetPicProvider();
- //picList = list;
- Loaded += (s, e) => init(embryoId, houseSn, pictureLayer, tlSn);
- this.Closed += (a, b) => AppData.Instance.MainWindow.Activate();
- Unloaded += (s, e) =>
- {
- _root_Canvas.Children.Clear();
- };
- }
- catch (Exception ex)
- {
- ExLog(ex, "ImageSourceWindow");
- }
- }
- private int CheckBoxImageNum = 1;
- private void init(long embryoId, int houseSn, int pictureLayer, string tlSn)
- {
- var list = picProvider.GetImageSourceApi(embryoId, houseSn, pictureLayer, tlSn);
- Task.Run(() =>
- {
- Dispatcher.Invoke(() =>
- {
- foreach (var item in list)
- {
- if (string.IsNullOrEmpty(item.sourceImageUrl)) continue;
- PicSourceUserControl checkBoxImage = new PicSourceUserControl()
- {
- ImageSourceUrl = AppData.Instance.StringToBitmapImage($"{AppData.Instance.BaseUrl}{item.sourceImageUrl.Replace(AppData.Instance.PicSuf, $"_180x180{AppData.Instance.PicSuf}")}?token={AppData.Instance.HttpServiceCall.GetToken()}"),
- ImageInfoString = $"{item.imageTime.ToString("MM-dd HH:mm")}",
- };
- if (checkBoxImage.ImageSourceUrl == null) continue;
- if (CheckBoxImageNum > 7)
- {
- if ((CheckBoxImageNum - 1) % 7 == 0) checkBoxImage.Margin = new Thickness(0, 10, 0, 0);
- else checkBoxImage.Margin = new Thickness(10, 10, 0, 0);
- }
- else
- {
- if (CheckBoxImageNum == 1) checkBoxImage.Margin = new Thickness(0);
- else checkBoxImage.Margin = new Thickness(10, 0, 0, 0);
- }
- CheckBoxImageNum++;
- _root_Canvas.Children.Add(checkBoxImage);
- }
- });
- });
- }
- private void ExLog(Exception ex, string name)
- {
- AppData.Instance.LogService.ExceptionLog(ex, $"MarkQucikWindow.{name}", LogEnum.RunException);
- }
- private void ErrorLog(string message, LogEnum logType)
- {
- AppData.Instance.LogService.TLLog($"MarkQucikWindow.{message}", logType);
- }
- private void Cancel_Click(object sender, RoutedEventArgs e)
- {
- this.DialogResult = false;
- return;
- }
- private void ScrollViewer_ManipulationBoundaryFeedback(object sender, ManipulationBoundaryFeedbackEventArgs e)
- {
- e.Handled = true;
- }
- }
- }
|