WinModeCheck.xaml.cs 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Collections.ObjectModel;
  4. using System.ComponentModel;
  5. using System.IO;
  6. using System.Linq;
  7. using System.Windows;
  8. using Microsoft.Win32;
  9. using SAGA.DotNetUtils;
  10. using SAGA.DotNetUtils.Extend;
  11. using System.Windows.Forms;
  12. using System.Windows.Threading;
  13. namespace Saga.PlugIn.ModelCheck
  14. {
  15. /// <summary>
  16. /// WinModeCheckSetting.xaml 的交互逻辑
  17. /// </summary>
  18. public partial class WinModeCheck
  19. {
  20. public WinModeCheck(VMModelCheck viewmodel)
  21. {
  22. InitializeComponent();
  23. this.DataContext = viewmodel;
  24. }
  25. #region BindingProperty
  26. #endregion
  27. #region Action
  28. private void ButtonNext_OnClick(object sender, RoutedEventArgs e)
  29. {
  30. this.DialogResult = true;
  31. }
  32. #endregion
  33. private void SelectFile_OnClick(object sender, RoutedEventArgs e)
  34. {
  35. FolderBrowserDialog dialog = new FolderBrowserDialog();
  36. dialog.Description = "请选择文件路径";
  37. if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
  38. {
  39. txtPath.Text = dialog.SelectedPath;
  40. }
  41. }
  42. public void DoEvents()
  43. {
  44. var frame = new DispatcherFrame();
  45. Dispatcher.CurrentDispatcher.BeginInvoke(DispatcherPriority.Background,
  46. new DispatcherOperationCallback(ExitFrames), frame);
  47. try
  48. {
  49. Dispatcher.PushFrame(frame);
  50. }
  51. catch (InvalidOperationException)
  52. {
  53. }
  54. }
  55. private object ExitFrames(object frame)
  56. {
  57. ((DispatcherFrame) frame).Continue = false;
  58. return null;
  59. }
  60. }
  61. }