| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656 |
- using ivf_tl_CustomControls;
- using ivf_tl_Entity.Entity;
- using ivf_tl_Entity.Entity.balance;
- using ivf_tl_Entity.Enums;
- using ivf_tl_Entity.Pic;
- using ivf_tl_Manage.UserControls;
- using ivf_tl_Manage.ViewModels;
- using ivf_tl_Manage.Win;
- using ivf_tl_Service;
- using ivf_tl_Service.HttpProvider;
- using System;
- using System.Collections.Generic;
- using System.Diagnostics;
- using System.Linq;
- using System.Reflection;
- 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.Navigation;
- using System.Windows.Shapes;
- namespace ivf_tl_Manage.Views
- {
- /// <summary>
- /// DetailPicView.xaml 的交互逻辑
- /// </summary>
- public partial class DetailPicView : UserControl
- {
- private DetailPicViewModel vm = null;
- private int CheckBoxImageNum = 1;
- private int CheckBoxNum = 1;
- private List<PicUserControl> CheckBoxImageList = new List<PicUserControl>();
- private DetailProvider DetailProvider = null;
- public DetailPicView()
- {
- InitializeComponent();
- this._photoBox0.Tag = new PhotoBoxSetting() { MinHour = 0, MaxHour = 24 * 60 };
- this._photoBox1.Tag = new PhotoBoxSetting() { MinHour = 24 * 60, MaxHour = 48 * 60 };
- this._photoBox2.Tag = new PhotoBoxSetting() { MinHour = 48 * 60, MaxHour = 72 * 60 };
- this._photoBox3.Tag = new PhotoBoxSetting() { MinHour = 72 * 60, MaxHour = 96 * 60 };
- this._photoBox4.Tag = new PhotoBoxSetting() { MinHour = 96 * 60, MaxHour = 120 * 60 };
- this._photoBox5.Tag = new PhotoBoxSetting() { MinHour = 120 * 60, MaxHour = 144 * 60 };
- this._photoBox6.Tag = new PhotoBoxSetting() { MinHour = 18 * 60, MaxHour = 20 * 60 };
- this._photoBox7.Tag = new PhotoBoxSetting() { MinHour = 25 * 60, MaxHour = 26 * 60 };
- this._photoBox8.Tag = new PhotoBoxSetting() { MinHour = 42 * 60, MaxHour = 44 * 60 };
- this._photoBox9.Tag = new PhotoBoxSetting() { MinHour = 62 * 60, MaxHour = 68 * 60 };
- DetailProvider = AppData.Instance.GetDetailProvider();
- var a = DetailProvider.GetPicTimeButtonsApi();
- foreach (var item in a)
- {
- if (item.type == "COMMON_BUTTON")
- {
- var b = item.button.Take(7).ToList();
- for (int i = 0; i < b.Count; i++)
- {
- var item1 = b[i];
- switch (i)
- {
- case 0:
- this._photoBox0.Content = item1.buttonName;
- this._photoBox0.Tag = new PhotoBoxSetting() { MinHour = item1.minHour * 60, MaxHour = item1.maxHour * 60 };
- break;
- case 1:
- this._photoBox1.Content = item1.buttonName;
- this._photoBox1.Tag = new PhotoBoxSetting() { MinHour = item1.minHour * 60, MaxHour = item1.maxHour * 60 };
- break;
- case 2:
- this._photoBox2.Content = item1.buttonName;
- this._photoBox2.Tag = new PhotoBoxSetting() { MinHour = item1.minHour * 60, MaxHour = item1.maxHour * 60 };
- break;
- case 3:
- this._photoBox3.Content = item1.buttonName;
- this._photoBox3.Tag = new PhotoBoxSetting() { MinHour = item1.minHour * 60, MaxHour = item1.maxHour * 60 };
- break;
- case 4:
- this._photoBox4.Content = item1.buttonName;
- this._photoBox4.Tag = new PhotoBoxSetting() { MinHour = item1.minHour * 60, MaxHour = item1.maxHour * 60 };
- break;
- case 5:
- this._photoBox5.Content = item1.buttonName;
- this._photoBox5.Tag = new PhotoBoxSetting() { MinHour = item1.minHour * 60, MaxHour = item1.maxHour * 60 };
- break;
- case 6:
- this._photoBox5_1.Content = item1.buttonName;
- this._photoBox5_1.Tag = new PhotoBoxSetting() { MinHour = item1.minHour * 60, MaxHour = item1.maxHour * 60 };
- break;
- }
- }
- }
- else if (item.type == "KEY_BUTTON")
- {
- var b = item.button.Take(7).ToList();
- for (int i = 0; i < b.Count; i++)
- {
- var item1 = b[i];
- switch (i)
- {
- case 0:
- this._photoBox6.Content = item1.buttonName;
- this._photoBox6.Tag = new PhotoBoxSetting() { MinHour = item1.minHour * 60, MaxHour = item1.maxHour * 60 };
- break;
- case 1:
- this._photoBox7.Content = item1.buttonName;
- this._photoBox7.Tag = new PhotoBoxSetting() { MinHour = item1.minHour * 60, MaxHour = item1.maxHour * 60 };
- break;
- case 2:
- this._photoBox8.Content = item1.buttonName;
- this._photoBox8.Tag = new PhotoBoxSetting() { MinHour = item1.minHour * 60, MaxHour = item1.maxHour * 60 };
- break;
- case 3:
- this._photoBox9.Content = item1.buttonName;
- this._photoBox9.Tag = new PhotoBoxSetting() { MinHour = item1.minHour * 60, MaxHour = item1.maxHour * 60 };
- break;
- case 4:
- this._photoBox9_1.Content = item1.buttonName;
- this._photoBox9_1.Tag = new PhotoBoxSetting() { MinHour = item1.minHour * 60, MaxHour = item1.maxHour * 60 };
- break;
- case 5:
- this._photoBox9_2.Content = item1.buttonName;
- this._photoBox9_2.Tag = new PhotoBoxSetting() { MinHour = item1.minHour * 60, MaxHour = item1.maxHour * 60 };
- break;
- case 6:
- this._photoBox9_3.Content = item1.buttonName;
- this._photoBox9_3.Tag = new PhotoBoxSetting() { MinHour = item1.minHour * 60, MaxHour = item1.maxHour * 60 };
- break;
- }
- }
- }
- }
- Loaded += DetailPicView_Loaded;
- Unloaded += (s, e) =>
- {
- Canvas_Root.Children.Clear();
- vm = null;
- DataContext = null;
- };
- }
- private void DetailPicView_Loaded(object sender, RoutedEventArgs e)
- {
- vm = (DetailPicViewModel)this.DataContext;
- if (vm == null) return;
- InitNav();
- if (vm.ShowPictureList == null || vm.ViewCheckBoxImageList.Any()) return;
- Task.Run(() =>
- {
- this.Dispatcher.Invoke(() =>
- {
- _root_Canvas.Children.Clear();
- CheckBoxImageList.Clear();
- this._allCheck.IsChecked = false;
- vm.ViewCheckBoxImageList.Clear();
- var list = vm.ShowPictureList.Take(vm.PicPageSize);
- CheckBoxImageNum = 1;
- foreach (var item in list)
- {
- if (string.IsNullOrEmpty(item.imageUrl)) continue;
- PicUserControl checkBoxImage = new PicUserControl()
- {
- //ImageSourceUrl = AppData.Instance.StringToBitmapImage($"{AppData.Instance.BaseUrl}{item.imageUrl}?token={AppData.Instance.HttpServiceCall.GetToken()}"),
- ImageSourceUrl = AppData.Instance.StringToBitmapImage($"{AppData.Instance.BaseUrl}{item.imageUrl.Replace(AppData.Instance.PicSuf, $"_240x240{AppData.Instance.PicSuf}")}?token={AppData.Instance.HttpServiceCall.GetToken()}"),
- ImageInfoString = $"{item.imageTime.ToString("MM-dd HH:mm")}",
- Tag = item.id,
- };
- if (checkBoxImage.ImageSourceUrl == null) continue;
- if (CheckBoxImageNum > 6)
- {
- if ((CheckBoxImageNum - 1) % 6 == 0) checkBoxImage.Margin = new Thickness(40, 18, 0, 0);
- else checkBoxImage.Margin = new Thickness(18, 18, 0, 0);
- }
- else
- {
- if (CheckBoxImageNum == 1) checkBoxImage.Margin = new Thickness(40, 0, 0, 0);
- else checkBoxImage.Margin = new Thickness(18, 0, 0, 0);
- }
- CheckBoxImageNum++;
- checkBoxImage.MouseDown += CheckBoxImage_MouseDown;
- checkBoxImage.SelectedPropertyChangedEevent += CheckBoxImage_SelectedPropertyChangedEevent;
- //checkBoxImage.Checked += CheckBoxImage_Checked;
- //checkBoxImage.Unchecked += CheckBoxImage_Unchecked;
- vm.ViewCheckBoxImageList.Add(checkBoxImage);
- _root_Canvas.Children.Add(checkBoxImage);
- }
- });
- });
- }
- 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) =>
- {
- 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);
- }
- }
- private void ExLog(Exception ex, string name)
- {
- AppData.Instance.LogService.ExceptionLog(ex, $"DetailPicView.{name}", LogEnum.RunException);
- }
- private void ErrorLog(string message, LogEnum logType)
- {
- AppData.Instance.LogService.TLLog($"DetailPicView.{message}", logType);
- }
- private void Toast(bool success)
- {
- new ToastWindow(AppData.Instance.MainWindow, 1920, 65, success).Show();
- }
- /// <summary>
- /// 设备管理
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void Button_Click(object sender, RoutedEventArgs e)
- {
- AppData.Instance.MainWindowViewModel.CurrentViewModle = AppData.Instance.MainWindowViewModel.devManageViewModel;
- }
- /// <summary>
- /// 患者管理
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void Parien_Click(object sender, RoutedEventArgs e)
- {
- AppData.Instance.MainWindowViewModel.patientManageViewModel.SetTLInfo(vm.tLInfo);
- AppData.Instance.MainWindowViewModel.CurrentViewModle = AppData.Instance.MainWindowViewModel.patientManageViewModel;
- }
- /// <summary>
- /// 详情界面
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void Detail_Click(object sender, RoutedEventArgs e)
- {
- //AppData.Instance.MainWindowViewModel.detailViewModel.Init(null, vm.tLInfo, vm.CurrentDish);
- //AppData.Instance.MainWindowViewModel.CurrentViewModle = vm.DetailViewModel;
- }
- private void RecordDetail_Click(object sender, RoutedEventArgs e)
- {
- //AppData.Instance.MainWindowViewModel.CurrentViewModle = vm.DetailViewModel;
- }
- private void RecordParien_Click(object sender, RoutedEventArgs e)
- {
- //AppData.Instance.MainWindowViewModel.CurrentViewModle = vm.RecordViewModel;
- }
- private void SmallFocus_Click(object sender, RoutedEventArgs e)
- {
- ChangeFocal(false);
- }
- private void BigFocus_Click(object sender, RoutedEventArgs e)
- {
- ChangeFocal(true);
- }
- /// <summary>
- /// 切换图层
- /// </summary>
- /// <param name="isMax"></param>
- private void ChangeFocal(bool isMax)
- {
- try
- {
- int newCurrentFocal = vm.CurrentFocal;
- if (isMax)
- {
- newCurrentFocal++;
- }
- else
- {
- newCurrentFocal--;
- }
- if (newCurrentFocal < vm.MaxFocal) this._bigFocal_Button.IsEnabled = true;
- else this._bigFocal_Button.IsEnabled = false;
- if (newCurrentFocal > vm.MinFocal) this._smallFocal_Button.IsEnabled = true;
- else this._smallFocal_Button.IsEnabled = false;
- if (newCurrentFocal < vm.MinFocal || newCurrentFocal > vm.MaxFocal)
- {
- return;
- }
- vm.CurrentFocal = newCurrentFocal;
- vm.RefPic(vm.CurrentFocal);
- }
- catch (Exception ex)
- {
- ExLog(ex, "ChangeFocal");
- }
- }
- private void ImageSource_Click(object sender, RoutedEventArgs e)
- {
- //List<PictureEntity> allList = new List<PictureEntity>();
- //if (vm.CurrentEmbryoAllPicDic.ContainsKey(vm.CurrentFocal)) allList = vm.CurrentEmbryoAllPicDic[vm.CurrentFocal];
- AppData.Instance.MainWindowViewModel.MaskVisibility = true;
- if (new SafeWindow(AppData.Instance.MainWindow).ShowDialog() != true)
- {
- AppData.Instance.MainWindowViewModel.MaskVisibility = false;
- return;
- }
- List<PhotoBoxSetting1> settings = new List<PhotoBoxSetting1>();
- foreach (var item in vm.CheckBoxNoFrameCustomList) if (item.Tag is PhotoBoxSetting itemsetting) settings.Add(new PhotoBoxSetting1 { minHour = itemsetting.MinHour / 60, maxHour = itemsetting.MaxHour / 60 });
- new ImageSourceNewWindow(vm.CurrentEmbryo, vm.CurrentEmbryo.houseSn, vm.CurrentFocal, vm.CurrentEmbryo.tlSn, vm.CurrentDish, vm.MaxFocal, vm.MinFocal, settings).ShowDialog();
- AppData.Instance.MainWindowViewModel.MaskVisibility = false;
- }
- private void ImageExport_Click(object sender, RoutedEventArgs e)
- {
- if (vm == null || !vm.ShowPictureList.Any())
- {
- Toast(false);
- return;
- }
- AppData.Instance.MainWindowViewModel.MaskVisibility = true;
- if (new PicExportWindow(AppData.Instance.MainWindow, CheckBoxImageList.Count).ShowDialog() != true)
- {
- AppData.Instance.MainWindowViewModel.MaskVisibility = false;
- return;
- }
- string dateString = DateTime.Now.ToString("yy-MM-dd-HH-mm");
- string fileName = SaveFileName(dateString);
- AppData.Instance.MainWindowViewModel.MaskVisibility = false;
- if (string.IsNullOrEmpty(fileName)) return;
- if (CheckBoxImageList.Any())
- {
- vm.DowLoadPic(CheckBoxImageList.Select(x => (long)x.Tag).ToList(), fileName);
- }
- else
- {
- vm.DowLoadPic(vm.ShowPictureList.Select(x => x.id).ToList(), fileName);
- }
- }
- private void ScrollViewer_ManipulationBoundaryFeedback(object sender, ManipulationBoundaryFeedbackEventArgs e)
- {
- e.Handled = true;
- }
- private void PaginationUserControl_PageChangedEvent(PaginationUserControl source, int obj)
- {
- if (source == null) return;
- if (!source.IsLoaded) return;
- Task.Run(() =>
- {
- this.Dispatcher.Invoke(() =>
- {
- _root_Canvas.Children.Clear();
- CheckBoxImageList.Clear();
- this._allCheck.IsChecked = false;
- if (vm == null || vm.ShowPictureList == null) return;
- vm.CurrentPage = obj;
- vm.ViewCheckBoxImageList.Clear();
- var list = vm.ShowPictureList.Skip(vm.PicPageSize * (obj - 1)).Take(vm.PicPageSize);
- CheckBoxNum = 1;
- CheckBoxImageNum = 1;
- foreach (var item in list)
- {
- if (string.IsNullOrEmpty(item.imageUrl)) continue;
- PicUserControl checkBoxImage = new PicUserControl()
- {
- ImageSourceUrl = AppData.Instance.StringToBitmapImage($"{AppData.Instance.BaseUrl}{item.imageUrl.Replace(AppData.Instance.PicSuf, $"_240x240{AppData.Instance.PicSuf}")}?token={AppData.Instance.HttpServiceCall.GetToken()}"),
- ImageInfoString = $"{item.imageTime.ToString("MM-dd HH:mm")}",
- Tag = item.id,
- };
- if (checkBoxImage.ImageSourceUrl == null) continue;
- if (CheckBoxImageNum > 6)
- {
- if ((CheckBoxImageNum - 1) % 6 == 0) checkBoxImage.Margin = new Thickness(40, 18, 0, 0);
- else checkBoxImage.Margin = new Thickness(18, 18, 0, 0);
- }
- else
- {
- if (CheckBoxImageNum == 1) checkBoxImage.Margin = new Thickness(40, 0, 0, 0);
- else checkBoxImage.Margin = new Thickness(18, 0, 0, 0);
- }
- CheckBoxImageNum++;
- checkBoxImage.MouseDown += CheckBoxImage_MouseDown;
- checkBoxImage.SelectedPropertyChangedEevent += CheckBoxImage_SelectedPropertyChangedEevent;
- //checkBoxImage.Checked += CheckBoxImage_Checked;
- //checkBoxImage.Unchecked += CheckBoxImage_Unchecked;
- vm.ViewCheckBoxImageList.Add(checkBoxImage);
- _root_Canvas.Children.Add(checkBoxImage);
- }
- this._ScrollViewer.ScrollToVerticalOffset(0);
- //this._ScrollViewer.ScrollToTop();
- //this._ScrollViewer.ScrollToHome();
- });
- });
- }
- private void CheckBoxImage_PreviewMouseDown(object sender, MouseButtonEventArgs e)
- {
- if (e.ClickCount >= 2)
- {
- e.Handled = true;
- }
- }
- private bool isImage = false;
- private void CheckBoxImage_Unchecked(object sender, RoutedEventArgs e)
- {
- //if (!(sender is CheckBoxImage source)) return;
- //isImage = true;
- //this._allCheck.IsChecked = false;
- //isImage = false;
- //CheckBoxNum--;
- //if (!CheckBoxImageList.Any()) return;
- //if (CheckBoxImageList.Last() == source)
- //{
- // CheckBoxImageList.Remove(source);
- // return;
- //}
- //CheckBoxImageList.Remove(source);
- //int k = 1;
- //foreach (var item in CheckBoxImageList)
- //{
- // source.SelectedNum = k++;
- //}
- }
- private void CheckBoxImage_Checked(object sender, RoutedEventArgs e)
- {
- // if (!(sender is CheckBoxImage source)) return;
- // source.SelectedNum = CheckBoxNum++;
- // CheckBoxImageList.Add(source);
- //if(vm != null)
- // {
- // var a = vm.ViewCheckBoxImageList.FirstOrDefault(x => x.IsChecked == false);
- // if (a == null) this._allCheck.IsChecked = true;
- // }
- }
- private void CheckBoxImage_SelectedPropertyChangedEevent(PicUserControl arg1, bool arg2)
- {
- if (arg1 == null) return;
- if (!arg1.IsLoaded) return;
- if (arg2)
- {
- arg1.SelectedNum = CheckBoxNum++;
- CheckBoxImageList.Add(arg1);
- if (vm != null)
- {
- var a = vm.ViewCheckBoxImageList.FirstOrDefault(x => x.IsSelected == false);
- if (a == null) this._allCheck.IsChecked = true;
- }
- return;
- }
- isImage = true;
- this._allCheck.IsChecked = false;
- isImage = false;
- CheckBoxNum--;
- if (!CheckBoxImageList.Any()) return;
- if (CheckBoxImageList.Last() == arg1)
- {
- CheckBoxImageList.Remove(arg1);
- return;
- }
- CheckBoxImageList.Remove(arg1);
- int k = 1;
- foreach (var item in CheckBoxImageList)
- {
- item.SelectedNum = k++;
- }
- }
- private void CheckBoxImage_MouseDown(object sender, MouseButtonEventArgs e)
- {
- if (!(sender is PicUserControl source)) return;
- if (!source.IsLoaded) return;
- if (source.IsSelected) return;
- if (vm == null || vm.CurrentDish == null || vm.CurrentEmbryo == null) return;
- AppData.Instance.MainWindowViewModel.MaskVisibility = true;
- PhotoWindowNew photoWindowNew = new PhotoWindowNew(AppData.Instance.MainWindow, vm.ShowPictureList, (long)source.Tag, vm.CurrentDish.tlSn, vm.CurrentDish.houseSn, vm.CurrentDish.wife, vm.CurrentEmbryo.wellSn);
- photoWindowNew.ShowDialog();
- AppData.Instance.MainWindowViewModel.MaskVisibility = false;
- }
- private ButtonRightImage GetButtonImage(CheckBoxNoFrameCustom checkBoxNoFrameCustom)
- {
- var a = new ButtonRightImage()
- {
- Margin = new Thickness(7, 0, 0, 0),
- Padding = new Thickness(15, 0, 0, 0),
- MinWidth = 127,
- Height = 42,
- Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#E8E8E8")),
- IconMargin = new Thickness(20, 0, 15, 0),
- FontWeight = FontWeights.Medium,
- Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#4D75AC")),
- FontSize = 18,
- CornerRadiusButton = new CornerRadius(10),
- Tag = checkBoxNoFrameCustom,
- Content = checkBoxNoFrameCustom.Content,
- IconWidth = 18,
- IconHeight = 18,
- IconSource = new BitmapImage(new Uri("pack://application:,,,/ivf_tl_Manage;component/Resources/Images/CloseGrayIcon.png", UriKind.Absolute)),
- MouseOverIconSource = new BitmapImage(new Uri("pack://application:,,,/ivf_tl_Manage;component/Resources/Images/CloseBlueIcon.png", UriKind.Absolute)),
- };
- a.Click += (s, e) =>
- {
- if (checkBoxNoFrameCustom.IsChecked == true)
- {
- checkBoxNoFrameCustom.IsChecked = false;
- }
- };
- vm.ButtonRightImageList.Add(a);
- return a;
- }
- private void CheckBoxNoFrameCustom_Checked(object sender, RoutedEventArgs e)
- {
- if (vm == null) return;
- if (!(sender is CheckBoxNoFrameCustom source)) return;
- this._stack.Children.Add(GetButtonImage(source));
- if (!vm.CheckBoxNoFrameCustomList.Contains(source))
- {
- vm.CheckBoxNoFrameCustomList.Add(source);
- }
- vm.RefPic(vm.CurrentFocal);
- }
- private void CheckBoxNoFrameCustom_Unchecked(object sender, RoutedEventArgs e)
- {
- if (vm == null) return;
- if (!(sender is CheckBoxNoFrameCustom source)) return;
- ButtonRightImage k = null;
- foreach (var item in vm.ButtonRightImageList)
- {
- if (!(item.Tag is CheckBoxNoFrameCustom c)) continue;
- if (c == source)
- {
- k = item;
- break;
- }
- }
- if (k != null)
- {
- vm.ButtonRightImageList.Remove(k);
- this._stack.Children.Remove(k);
- }
- if (vm.CheckBoxNoFrameCustomList.Contains(source))
- {
- var a = vm.CheckBoxNoFrameCustomList.Remove(source);
- }
- vm.RefPic(vm.CurrentFocal);
- }
- public string SaveFileName(string dateString)
- {
- var dialog = new Microsoft.Win32.SaveFileDialog();
- dialog.FileName = $"{vm.CurrentDish.wife}_{dateString}.zip";
- dialog.DefaultExt = ".zip";
- dialog.Filter = "zip|*.zip";
- if (dialog.ShowDialog() != true)
- {
- return null;
- }
- return dialog.FileName;
- }
- private void CheckBoxContent_Checked(object sender, RoutedEventArgs e)
- {
- if (sender is CheckBoxContent source && source.IsLoaded && vm != null)
- {
- foreach (var item in vm.ViewCheckBoxImageList)
- {
- item.IsSelected = true;
- }
- }
- }
- private void CheckBoxContent_Unchecked(object sender, RoutedEventArgs e)
- {
- if (isImage) return;
- if (sender is CheckBoxContent source && source.IsLoaded && vm != null)
- {
- foreach (var item in vm.ViewCheckBoxImageList)
- {
- item.IsSelected = false;
- }
- }
- }
- private void ListBox_Selected(object sender, RoutedEventArgs e)
- {
- this._bigFocal_Button.IsEnabled = true;
- this._smallFocal_Button.IsEnabled = true;
- }
- private void ListBox_Selected(object sender, SelectionChangedEventArgs e)
- {
- this._bigFocal_Button.IsEnabled = true;
- this._smallFocal_Button.IsEnabled = true;
- }
- }
- }
|