UCStandMain.xaml.cs 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729
  1. using MeterVision.Config;
  2. using MeterVision.db;
  3. using MeterVision.Dlg;
  4. using MeterVision.model;
  5. using MeterVision.Util;
  6. using OfficeOpenXml;
  7. using OfficeOpenXml.Style;
  8. using Ookii.Dialogs.Wpf;
  9. using System;
  10. using System.Collections.Generic;
  11. using System.Collections.ObjectModel;
  12. using System.ComponentModel;
  13. using System.IO;
  14. using System.Linq;
  15. using System.Text;
  16. using System.Text.RegularExpressions;
  17. using System.Threading.Tasks;
  18. using System.Windows;
  19. using System.Windows.Controls;
  20. using System.Windows.Data;
  21. using System.Windows.Documents;
  22. using System.Windows.Input;
  23. using System.Windows.Media;
  24. using System.Windows.Media.Imaging;
  25. using System.Windows.Navigation;
  26. //using System.Windows.Shapes;
  27. namespace MeterVision.Stand
  28. {
  29. /// <summary>
  30. /// UCStand.xaml 的交互逻辑
  31. /// </summary>
  32. public partial class UCStandMain : UserControl, INotifyPropertyChanged
  33. {
  34. private const int COLUMN_LEFT_WIDTH = 220;
  35. private const int COLUMN_RIGHT_WIDTH = 400;
  36. private bool LeftVisiable = true; //表示左侧的显示状态
  37. private bool RightVisiable = true; //表示右侧的显示状态
  38. public event PropertyChangedEventHandler PropertyChanged;
  39. protected void OnPropertyChanged(string propertyName)
  40. {
  41. PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
  42. }
  43. public PageModel StandPage { get; set; }
  44. //定义模板目录数据源
  45. public ObservableCollection<StandItem> StandItemList { get; set; }
  46. // 定义"标准答案编辑"依赖属性
  47. public static readonly DependencyProperty IsResultEditingProperty =
  48. DependencyProperty.Register("IsResultEditing", typeof(bool), typeof(UCStandMain), new PropertyMetadata(false));
  49. public bool IsResultEditing
  50. {
  51. get { return (bool)GetValue(IsResultEditingProperty); }
  52. set { SetValue(IsResultEditingProperty, value); }
  53. }
  54. private StandItem _selectedStandItem;
  55. public StandItem SelectedStandItem
  56. {
  57. get => _selectedStandItem;
  58. set
  59. {
  60. _selectedStandItem = value;
  61. OnPropertyChanged(nameof(SelectedStandItem)); //通知更新
  62. //ucStandGird.CurStandItem = value;
  63. ucStationGrid.ChangeFind(FindStationId,_selectedStandItem.StandId);
  64. Apply_UCStandDetaisl_Title(value);
  65. }
  66. }
  67. private StationItem _selectedStationItem;
  68. public StationItem SelectedStationItem
  69. {
  70. get => _selectedStationItem;
  71. set
  72. {
  73. _selectedStationItem = value;
  74. OnPropertyChanged(nameof(SelectedStationItem));
  75. ucStandGird.CurStationItem = value;
  76. }
  77. }
  78. private int _totalStandRecords;
  79. public int TotalStandRecords
  80. {
  81. get => _totalStandRecords;
  82. set
  83. {
  84. if (_totalStandRecords != value)
  85. {
  86. _totalStandRecords = value;
  87. OnPropertyChanged(nameof(TotalStandRecords));
  88. }
  89. }
  90. }
  91. public CfginiItem mConfigItem { get; set; }
  92. private void Apply_UCStandDetaisl_Title(StandItem standItem)
  93. {
  94. if(standItem == null)
  95. {
  96. //pnlDetailsTitle.Visibility = Visibility.Hidden;
  97. pnlDetailsFunc.Visibility = Visibility.Hidden;
  98. txtStandName.Text = "请选择左侧模板";
  99. }
  100. else
  101. {
  102. //pnlDetailsTitle.Visibility = Visibility.Visible;
  103. pnlDetailsFunc.Visibility = Visibility.Visible;
  104. //txtStandName.Text = $"模板名称: {standItem.Index}. {standItem.StandName}[{standItem.StandCount}]";
  105. txtStandName.Text = $"模板名称: {standItem.Index}. {standItem.StandName}";
  106. }
  107. }
  108. private void InitRightControls(StandDetailItem standDetailsItem)
  109. {
  110. pnlImage.Visibility = txtRightItemIndex.Visibility =
  111. standDetailsItem == null ? Visibility.Collapsed : Visibility.Visible;
  112. //pnlResult.Visibility = Visibility.Hidden;
  113. }
  114. private string _findStationId;
  115. public string FindStationId
  116. {
  117. get => _findStationId;
  118. set
  119. {
  120. if (_findStationId != value)
  121. {
  122. _findStationId = value;
  123. OnPropertyChanged(nameof(FindStationId));
  124. //ucStationGrid.ChangeFindStationId(FindStationId);
  125. }
  126. }
  127. }
  128. public UCStandMain()
  129. {
  130. InitializeComponent();
  131. StandItemList = new ObservableCollection<StandItem>();
  132. dgStand.ItemsSource = StandItemList;
  133. //this.btnStandExport.Click += BtnStandExport_Click;
  134. ucStandGird.OnSelectedStandDetailItemChanged += UcStandGird_OnSelectedStandDetailsItemChanged;
  135. IsResultEditing = false;
  136. Apply_UCStandDetaisl_Title(null);
  137. //SelectedStandItem = null;
  138. txtFindStationId.Text = "";
  139. FindStationId = "";
  140. InitRightControls(null);
  141. mConfigItem = CfginiItem.GetConfigItem();
  142. StandPage = new PageModel
  143. {
  144. //PageSize = mConfigItem.CatalogPageSize,
  145. PageSize = mConfigItem.StandCatalogPageSize,
  146. PageNumber = 1,
  147. };
  148. //LoadStandItemList();
  149. ucStandGird.OnStandItemCountChanged += UcStandGird_OnStandItemCountChanged;
  150. ucStandGird.OnDeleteStandDetailItem += UcStandGird_OnDeleteStandDetailItem;
  151. mConfigItem.OnStandCatalogPageSizeChanged += MConfigItem_OnStandCatalogPageSizeChanged;
  152. this.DataContext = this;
  153. // 启动异步初始化,确保不会阻塞构造函数
  154. LoadStandItemListAsync();
  155. //控制左右2侧栏目的显示
  156. LeftVisiable = true;
  157. ChangeLeftVisiable(LeftVisiable);
  158. RightVisiable = true;
  159. ChangeRightVisiable(RightVisiable);
  160. ucStationGrid.OnStationItemChange += UcStationGrid_OnStationItemChange;
  161. }
  162. private void UcStationGrid_OnStationItemChange(StationItem stationItem)
  163. {
  164. SelectedStationItem = stationItem;
  165. }
  166. private async void MConfigItem_OnStandCatalogPageSizeChanged(int pageSize)
  167. {
  168. //throw new NotImplementedException();
  169. StandPage.InitDefaulValue(pageSize);
  170. bool blLoad = await LoadStandItemList();
  171. if (blLoad)
  172. {
  173. SelectedStandItem = null;
  174. }
  175. }
  176. private async void LoadStandItemListAsync()
  177. {
  178. await LoadStandItemList();
  179. }
  180. private void UcStandGird_OnStandItemCountChanged(object sender, StandItemCountChangedEventArgs e)
  181. {
  182. //Detail的数量发生变化
  183. RefreshStandItemById(e.mStandItem.StandId);
  184. }
  185. private void UcStandGird_OnDeleteStandDetailItem(string standId)
  186. {
  187. RefreshStandItemById(standId);
  188. }
  189. private async void RefreshStandItemById(string standId)
  190. {
  191. if ( string.IsNullOrWhiteSpace(standId) ) return;
  192. VStand vStand = null;
  193. await Task.Run(() =>
  194. {
  195. vStand = DBStand.GetVStandById(standId);
  196. });
  197. if (vStand != null)
  198. {
  199. //var NewStandItem = new StandItem(vStand);
  200. foreach (var standItem in StandItemList)
  201. {
  202. if (standItem.StandId == vStand.StandId)
  203. {
  204. // ObjectHelper.CopyMatchingFields(NewStandItem, standItem);
  205. ObjectHelper.CopyMatchingFields(vStand, standItem);
  206. break;
  207. }
  208. }//foreach
  209. }//if vpatch!=null
  210. }
  211. private async Task<bool> LoadStandItemList()
  212. {
  213. StandItemList.Clear();
  214. try
  215. {
  216. var result = await Task.Run(() =>
  217. {
  218. return DBStand.GetPagedVStands(StandPage.PageNumber, StandPage.PageSize);
  219. });
  220. TotalStandRecords = result.Item1;
  221. StandPage.PageCount = result.Item2;
  222. List<VStand> stands = result.Item3;
  223. int index = 0;
  224. foreach (VStand vStand in stands)
  225. {
  226. index++;
  227. StandItem standItem = new StandItem(vStand);
  228. standItem.Index = index + (StandPage.PageNumber - 1) * StandPage.PageSize;
  229. StandItemList.Add(standItem);
  230. }
  231. if(StandItemList.Count > 0)
  232. {
  233. //dgStand.ScrollIntoView(StandItemList[0]);
  234. }
  235. return true;
  236. }
  237. catch (Exception ex)
  238. {
  239. MessageBox.Show(Application.Current.MainWindow,
  240. $"加载数据时发生错误:{ex.Message}", "错误", MessageBoxButton.OK, MessageBoxImage.Error);
  241. return false;
  242. }
  243. }
  244. private void UcStandGird_OnSelectedStandDetailsItemChanged(object sender, StandDetailItemChangedEventArgs e)
  245. {
  246. InitRightControls(e.SelectedDataItem);
  247. txtRightItemIndex.Text = string.Empty;
  248. if (e.SelectedDataItem != null)
  249. {
  250. ucImageSource.ImageSource = e.SelectedDataItem.SrcImage;
  251. ucImageSource.ImageName = "原始图片";
  252. //txtRightResult.Text = e.SelectedDataItem.StandValue;
  253. IsResultEditing = false;
  254. if(SelectedStandItem != null)
  255. {
  256. txtRightItemIndex.Text = $"{SelectedStandItem.Index}. - {e.SelectedDataItem.Index}.";
  257. }
  258. }
  259. }
  260. //导出模板
  261. private void BtnStandExport_Click(object sender, RoutedEventArgs e)
  262. {
  263. //查询所有的数据
  264. if (SelectedStandItem == null) return;
  265. List<TStandDetail> standDetails = DBStand.GetAllStandDetails(SelectedStandItem.StandId);
  266. if (standDetails.Count <= 0) return;
  267. string fileName = $"{SelectedStandItem.StandName}_{standDetails.Count}.xlsx";
  268. //创建保存文件对话框
  269. VistaSaveFileDialog saveFileDialog = new VistaSaveFileDialog
  270. {
  271. Filter = "Excel 文件 (*.xlsx)|*.xlsx",
  272. FileName = fileName,
  273. Title = "选择模板保存路径"
  274. };
  275. // 如果用户选择了路径并点击保存
  276. if (saveFileDialog.ShowDialog() == true){
  277. string titleInfo = "正在导出模板数据,请稍后...";
  278. WaitWindow waitWindow = new WaitWindow(titleInfo)
  279. {
  280. Owner = Application.Current.MainWindow,
  281. WindowStartupLocation = WindowStartupLocation.CenterOwner
  282. };
  283. waitWindow.Show();
  284. string filePath = saveFileDialog.FileName;
  285. try{
  286. // 创建Excel包
  287. using (ExcelPackage package = new ExcelPackage()){
  288. var worksheet = package.Workbook.Worksheets.Add("Sheet1");
  289. // 表头
  290. worksheet.Cells[1, 1].Value = "图像";
  291. worksheet.Cells[1, 2].Value = "标准答案";
  292. // 设置表头样式
  293. using (var range = worksheet.Cells[1, 1, 1, 2])
  294. {
  295. //range.Style.Font.Bold = false;
  296. range.Style.Font.Name = "等线";
  297. range.Style.Font.Size = 11;
  298. //range.Style.Fill.PatternType = ExcelFillStyle.Solid;
  299. //range.Style.Fill.BackgroundColor.SetColor(System.Drawing.Color.LightBlue);
  300. range.AutoFitColumns();
  301. }
  302. // 填充数据
  303. for (int i = 0; i < standDetails.Count; i++)
  304. {
  305. worksheet.Cells[i + 2, 1].Value = standDetails[i].SrcImage;
  306. worksheet.Cells[i + 2, 2].Value = standDetails[i].StandValue;
  307. // 设置行字体
  308. worksheet.Cells[i + 2, 1, i + 2, 2].Style.Font.Name = "等线";
  309. worksheet.Cells[i + 2, 1, i + 2, 2].Style.Font.Size = 11;
  310. //worksheet.Cells[i + 2, 1, i + 2, 2].Style.Font.Color.SetColor(System.Drawing.Color.Black);
  311. }
  312. // 设置列宽
  313. worksheet.Column(1).Width = 50; // 姓名列
  314. worksheet.Column(2).Width = 20; // 年龄列
  315. // 或者自动调整列宽
  316. //worksheet.Cells.AutoFitColumns();
  317. // 保存到用户选择的路径
  318. FileInfo excelFile = new FileInfo(filePath);
  319. package.SaveAs(excelFile);
  320. MessageBox.Show("Excel导出成功!");
  321. }
  322. }
  323. catch (Exception ex){
  324. MessageBox.Show($"导出失败: {ex.Message}");
  325. }
  326. waitWindow.Close();
  327. }
  328. }
  329. private void BtnStandImport_Click(object sender, RoutedEventArgs e)
  330. {
  331. //throw new NotImplementedException();
  332. }
  333. private void TextBox_PreviewTextInput(object sender, TextCompositionEventArgs e)
  334. {
  335. // 只允许数字输入
  336. e.Handled = !Regex.IsMatch(e.Text, @"^\d$");
  337. }
  338. private void TxtRightResult_PreviewTextInput(object sender, TextCompositionEventArgs e)
  339. {
  340. // 只允许数字输入
  341. e.Handled = !Regex.IsMatch(e.Text, @"^\d$");
  342. }
  343. private void BtnEditRightResult_Click(object sender, RoutedEventArgs e)
  344. {
  345. IsResultEditing = true;
  346. }
  347. private void BtnSubmitRightResult_Click(object sender, RoutedEventArgs e)
  348. {
  349. IsResultEditing = false;
  350. }
  351. private void BtnCancelRightResult_Click(object sender, RoutedEventArgs e)
  352. {
  353. IsResultEditing = false;
  354. }
  355. private async void BtnStandNextPage_Click(object sender, RoutedEventArgs e)
  356. {
  357. if(StandPage.PageNumber < StandPage.PageCount)
  358. {
  359. StandPage.PageNumber += 1;
  360. bool blLoad = await LoadStandItemList();
  361. if(blLoad && StandItemList.Count > 0)
  362. {
  363. dgStand.ScrollIntoView(StandItemList[0]);
  364. }
  365. }
  366. }
  367. private async void BtnStandPrePage_Click(object sender, RoutedEventArgs e)
  368. {
  369. if(StandPage.PageNumber > 1)
  370. {
  371. StandPage.PageNumber -= 1;
  372. bool blLoad = await LoadStandItemList();
  373. if(blLoad && StandItemList.Count > 0)
  374. {
  375. dgStand.ScrollIntoView(StandItemList[0]);
  376. }
  377. }
  378. }
  379. private void BtnStandDetailFirstPage_Click(object sender, RoutedEventArgs e)
  380. {
  381. ucStandGird.FirstPage();
  382. }
  383. private void BtnStandDetailNextPage_Click(object sender, RoutedEventArgs e)
  384. {
  385. ucStandGird.NextPage();
  386. }
  387. private void BtnStanddetailPrePage_Click(object sender, RoutedEventArgs e)
  388. {
  389. ucStandGird.PrePage();
  390. }
  391. private void BtnStandDetailLastPage_Click(object sender, RoutedEventArgs e)
  392. {
  393. ucStandGird.LastPage();
  394. }
  395. private void BtnStandDetailSpeciPage_Click(object sender, RoutedEventArgs e)
  396. {
  397. try
  398. {
  399. int pageNumber = int.Parse(txtStandDetailPageNumber.Text.ToString());
  400. ucStandGird.SpeciPage(pageNumber);
  401. }
  402. catch
  403. {
  404. }
  405. }
  406. private async void BtnAddStand_Click(object sender, RoutedEventArgs e)
  407. {
  408. //List<string> tableNames = SQLiteHelper.GetAllTables();
  409. var dialog = new AddStandDialog()
  410. {
  411. Owner = Application.Current.MainWindow,
  412. WindowStartupLocation = WindowStartupLocation.CenterOwner
  413. };
  414. if (dialog.ShowDialog() == true)
  415. {
  416. StandPage.InitDefaulValue();
  417. bool blLoad = await LoadStandItemList();
  418. if (blLoad && StandItemList.Count > 0)
  419. {
  420. SelectedStandItem = StandItemList[0];
  421. dgStand.ScrollIntoView(StandItemList[0]);
  422. }
  423. }
  424. }
  425. private async void BtnDelStand_Click(object sender, RoutedEventArgs e)
  426. {
  427. bool blDelete = await DeleteStandItem();
  428. }
  429. private async Task<bool> DeleteStandItem()
  430. {
  431. bool blDelete = false;
  432. if (SelectedStandItem == null) return blDelete;
  433. MessageBoxResult result = MessageBox.Show(
  434. $"您确定要删除[{SelectedStandItem.StandName}]任务吗?\n此操作无法撤销。",
  435. "确认删除",
  436. MessageBoxButton.YesNo, // 提供“是”和“否”按钮
  437. MessageBoxImage.Warning // 使用警告图标
  438. );
  439. if (result != MessageBoxResult.Yes)
  440. {
  441. return blDelete;
  442. }
  443. //开始删除操作
  444. string titleInfo = "正在删除,请稍候...";
  445. WaitWindow waitWindow = new WaitWindow(titleInfo)
  446. {
  447. Owner = Application.Current.MainWindow,
  448. WindowStartupLocation = WindowStartupLocation.CenterOwner
  449. };
  450. waitWindow.Show();
  451. try
  452. {
  453. //执行异步删除逻辑
  454. bool deleteSuccess = false;
  455. await Task.Run(() =>
  456. {
  457. deleteSuccess = DBStand.DeleteStandAndDetails(SelectedStandItem.StandId);
  458. //Task.Delay(200).Wait(); // 模拟延迟
  459. });
  460. if (deleteSuccess)
  461. {
  462. //await LoadStandItemList();
  463. // 在 UI 线程上更新 ObservableCollection
  464. Application.Current.Dispatcher.Invoke(() =>
  465. {
  466. StandItemList.Remove(SelectedStandItem);
  467. SelectedStandItem = null;
  468. TotalStandRecords -= 1;
  469. });
  470. blDelete = true;
  471. }
  472. }
  473. catch (Exception ex)
  474. {
  475. MessageBox.Show(Application.Current.MainWindow, $"删除失败:{ex.Message}", "错误",
  476. MessageBoxButton.OK, MessageBoxImage.Error);
  477. }
  478. finally
  479. {
  480. //关闭等待窗口
  481. waitWindow.Close();
  482. }
  483. return blDelete;
  484. }
  485. private async void BtnRefresh_Click(object sender, RoutedEventArgs e)
  486. {
  487. StandPage.InitDefaulValue();
  488. bool blLoad = await LoadStandItemList();
  489. if (blLoad && StandItemList.Count > 0)
  490. {
  491. dgStand.ScrollIntoView(StandItemList[0]);
  492. }
  493. }
  494. private async void MiDeleteStand_Click(object sender, RoutedEventArgs e)
  495. {
  496. bool blDelete = await DeleteStandItem();
  497. }
  498. private void MiUpdateStandname_Click(object sender, RoutedEventArgs e)
  499. {
  500. if (SelectedStandItem == null) return;
  501. EditNameDlg editNameDlg = new EditNameDlg("模板", SelectedStandItem.StandName)
  502. {
  503. Owner = Application.Current.MainWindow,
  504. WindowStartupLocation = WindowStartupLocation.CenterOwner
  505. };
  506. if (editNameDlg.ShowDialog() == true)
  507. {
  508. UpdateStandName(SelectedStandItem, editNameDlg.EditName);
  509. }
  510. }
  511. private async void UpdateStandName(StandItem standItem,string newStandName)
  512. {
  513. try
  514. {
  515. bool blUpdate = false;
  516. await Task.Run(() =>
  517. {
  518. blUpdate = DBStand.UpdateStandName(standItem.StandId, newStandName);
  519. });
  520. if (blUpdate)
  521. {
  522. standItem.StandName = newStandName;
  523. }
  524. else
  525. {
  526. MessageBox.Show(Application.Current.MainWindow, $"修改模板名称失败。", "警告",
  527. MessageBoxButton.OK, MessageBoxImage.Warning);
  528. }
  529. }
  530. catch(Exception ex)
  531. {
  532. MessageBox.Show(Application.Current.MainWindow, $"修改模板名称:{ex.Message}错误", "错误",
  533. MessageBoxButton.OK, MessageBoxImage.Error);
  534. }
  535. }
  536. private void BtnRefreshDetail_Click(object sender, RoutedEventArgs e)
  537. {
  538. //ucStandGird.CurStandItem = null;
  539. //ucStandGird.CurStandItem = SelectedStandItem;
  540. ucStandGird.CurStationItem = null;
  541. ucStandGird.CurStationItem = SelectedStationItem;
  542. }
  543. //private async void BtnSelectImageFloder_Click(object sender, RoutedEventArgs e)
  544. //{
  545. // // 创建 VistaFolderBrowserDialog 实例
  546. // var dialog = new VistaFolderBrowserDialog();
  547. // dialog.Description = "请选择模板图片文件夹";
  548. // dialog.UseDescriptionForTitle = true; // 使用 Description 作为窗口标题
  549. // // 显示对话框并检查用户是否点击了“确定”
  550. // if (dialog.ShowDialog() == true)
  551. // {
  552. // // 获取用户选择的文件夹路径
  553. // string selectedFolderPath = dialog.SelectedPath;
  554. // await ucStandGird.ImportStandImageFloder(selectedFolderPath);
  555. // }
  556. //}
  557. private void BtnLeftCtl_Click(object sender, RoutedEventArgs e)
  558. {
  559. bool visiable = !LeftVisiable;
  560. ChangeLeftVisiable(visiable);
  561. }
  562. private void BtnRightCtl_Click(object sender, RoutedEventArgs e)
  563. {
  564. bool visiable = !RightVisiable;
  565. ChangeRightVisiable(visiable);
  566. }
  567. private void ChangeLeftVisiable(bool visiable)
  568. {
  569. LeftVisiable = visiable;
  570. colLeft.Width = new GridLength(visiable ? COLUMN_LEFT_WIDTH : 0);
  571. btnLeftCtl.Content = visiable ? "◀️" : "▶️";
  572. btnLeftCtl.ToolTip = visiable ? "点击隐藏左侧栏" : "点击显示左侧栏";
  573. }
  574. private void ChangeRightVisiable(bool visiable)
  575. {
  576. RightVisiable = visiable;
  577. colRight.Width = new GridLength(visiable ? COLUMN_RIGHT_WIDTH : 0);
  578. btnRightCtl.Content = visiable ? "▶️" : "◀️";
  579. btnRightCtl.ToolTip = visiable ? "点击隐藏右侧栏" : "点击显示右侧栏";
  580. }
  581. private void BtnStationFirstPage_Click(object sender, RoutedEventArgs e)
  582. {
  583. ucStationGrid.FirstPage();
  584. }
  585. private void BtnStationPrePage_Click(object sender, RoutedEventArgs e)
  586. {
  587. ucStationGrid.PrePage();
  588. }
  589. private void BtnStationNextPage_Click(object sender, RoutedEventArgs e)
  590. {
  591. ucStationGrid.NextPage();
  592. }
  593. private void BtnStationLastPage_Click(object sender, RoutedEventArgs e)
  594. {
  595. ucStationGrid.LastPage();
  596. }
  597. private void BtnStationSpeciPage_Click(object sender, RoutedEventArgs e)
  598. {
  599. try
  600. {
  601. int pageNumber = int.Parse(txtStationPageNumber.Text.ToString());
  602. ucStationGrid.SpeciPage(pageNumber);
  603. }
  604. catch
  605. {
  606. }
  607. }
  608. private void BtnQuery_Click(object sender, RoutedEventArgs e)
  609. {
  610. FindStationId = txtFindStationId.Text.Trim();
  611. ucStationGrid.ChangeFind(FindStationId, SelectedStandItem.StandId);
  612. Apply_UCStandDetaisl_Title(SelectedStandItem);
  613. }
  614. private void BtnRefreshStation_Click(object sender, RoutedEventArgs e)
  615. {
  616. FindStationId = txtFindStationId.Text.Trim();
  617. ucStationGrid.ChangeFind(FindStationId, SelectedStandItem.StandId);
  618. Apply_UCStandDetaisl_Title(SelectedStandItem);
  619. }
  620. /////////////////////////////////////////////////////////////////////////////
  621. }
  622. }