| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181 |
- using ivf_tl_Manage.ViewModels;
- 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.Navigation;
- using System.Windows.Shapes;
- namespace ivf_tl_Manage.Views
- {
- /// <summary>
- /// MarkDetail1.xaml 的交互逻辑
- /// </summary>
- ///
- public partial class MarkDetail1 : UserControl
- {
- private MarkDetailViewModel1 vm;
- public MarkDetail1()
- {
-
- InitializeComponent();
- Loaded += (s, e) =>
- {
- vm = (MarkDetailViewModel1)this.DataContext;
- if (vm != null) InitNav();
- };
- this.Unloaded += (s, e) =>
- {
- Canvas_Root.Children.Clear();
- vm = null;
- DataContext = null;
- };
- }
- 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 ListViewItem_MouseUp(object sender, MouseButtonEventArgs e)
- {
- }
- private void ListView_PreviewMouseWheel(object sender, MouseWheelEventArgs e)
- {
- ScrollViewer viewer = _scrollview;
- if (viewer == null)
- return;
- double num = Math.Abs((int)(e.Delta / 2));
- double offset = 0.0;
- if (e.Delta > 0)
- {
- offset = Math.Max((double)0.0, (double)(viewer.VerticalOffset - num));
- }
- else
- {
- offset = Math.Min(viewer.ScrollableHeight, viewer.VerticalOffset + num);
- }
- if (offset != viewer.VerticalOffset)
- {
- viewer.ScrollToVerticalOffset(offset);
- e.Handled = true;
- }
- }
- private void Button_Click(object sender, RoutedEventArgs e)
- {
- AppData.Instance.MainWindowViewModel.CurrentViewModle = new DevManageViewModel();
- }
- private void Button_Click_patient(object sender, RoutedEventArgs e)
- {
- AppData.Instance.MainWindowViewModel.CurrentViewModle = AppData.Instance.MainWindowViewModel.patientManageViewModel;
- }
- private void Button_Click_Detail(object sender, RoutedEventArgs e)
- {
- //AppData.Instance.MainWindowViewModel.CurrentViewModle = vm.DetailViewModel;
- }
- private void Button_Click_Mark_Detail(object sender, RoutedEventArgs e)
- {
- //var vm = ((MarkDetailViewModel1)this.DataContext);
- //AppData.Instance.MainWindowViewModel.CurrentViewModle = new MarkDetailViewModel(vm.DetailViewModel,vm.DishId,vm.Title);
- }
- private void RecordButton_Click_patient(object sender, RoutedEventArgs e)
- {
- //AppData.Instance.MainWindowViewModel.CurrentViewModle = vm.RecordViewModel;
- }
- private void RecordButton_Click_Detail(object sender, RoutedEventArgs e)
- {
- //AppData.Instance.MainWindowViewModel.CurrentViewModle = vm.DetailViewModel;
- }
- private void RecordButton_Click_Mark_Detail(object sender, RoutedEventArgs e)
- {
- //AppData.Instance.MainWindowViewModel.CurrentViewModle = vm.MarkDetailViewModel ;
- }
- private void _markDetailItem_ImageMouseEnterEvent(bool arg1, ImageSource arg2)
- {
- if (arg1)
- {
- this.Image_Big.Source = arg2;
- this.Canvas_BigImage.Visibility = Visibility.Visible;
- }
- else
- {
- this.Canvas_BigImage.Visibility = Visibility.Hidden;
- }
- }
- private void _scrollview_ManipulationBoundaryFeedback(object sender, ManipulationBoundaryFeedbackEventArgs e)
- {
- e.Handled = true;
- }
- }
- }
|