| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107 |
- using ivf_tl_Entity.Entity.AppSetting;
- using ivf_tl_Entity.Enums;
- using System;
- using System.Collections.Generic;
- using System.Diagnostics;
- 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.Shapes;
- namespace ivf_tl_Manage.Win
- {
- /// <summary>
- /// UserBusWindow.xaml 的交互逻辑
- /// </summary>
- public partial class UserBusWindow : Window
- {
- List<Business> BusinesseList = new List<Business>();
- public UserBusWindow(List<Business> businesses)
- {
- InitializeComponent();
- this.Owner = AppData.Instance.MainWindow;
- foreach (var item in businesses)
- {
- item.isOpen = 0;
- }
- BusinesseList = businesses;
- this._listBox.ItemsSource = BusinesseList;
- this.Closed += (a, b) =>
- {
- AppData.Instance.MainWindow.Activate();
- };
- }
- private void MessageBoxShow(string mess)
- {
- }
- private void ExLog(Exception ex, string name)
- {
- AppData.Instance.LogService.ExceptionLog(ex, $"UserBusWindow.{name}", LogEnum.RunException);
- }
- private void ErrorLog(string message, LogEnum logType)
- {
- AppData.Instance.LogService.TLLog($"UserBusWindow.{message}", logType);
- }
- private void Cancel_Click(object sender, RoutedEventArgs e)
- {
- this.DialogResult = false;
- return;
- }
- private void _listBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
- {
- if (!(this._listBox.SelectedItem is Business business)) return;
- foreach (var item in BusinesseList)
- {
- if (item.id == business.id)
- {
- item.isOpen = 1;
- }
- else
- {
- item.isOpen = 0;
- }
- }
- this._children.ItemsSource = business.children;
- }
- private void Ok_Click(object sender, RoutedEventArgs e)
- {
- this.DialogResult = true;
- return;
- }
- private void Image_MouseDown(object sender, MouseButtonEventArgs e)
- {
- if (!(sender is Image source)) return;
- if (!(source.Tag is Business business)) return;
- if (this._listBox.SelectedItem == business)
- {
- if (business.isOpen == 1)
- {
- business.isOpen = 0;
- this._children.ItemsSource = null;
- }
- else
- {
- business.isOpen = 1;
- this._children.ItemsSource = business.children;
- }
- }
- else
- {
- this._listBox.SelectedItem = business;
- }
- e.Handled = true;
- }
- }
- }
|