星火微课系统客户端
Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

CreateAMicroLessonWindow.xaml.cs 4.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. using Common.system;
  2. using System;
  3. using System.Windows;
  4. using System.Windows.Forms;
  5. using System.Windows.Input;
  6. namespace XHWK.WKTool
  7. {
  8. /// <summary>
  9. /// 创建微课
  10. /// </summary>
  11. public partial class CreateAMicroLessonWindow : Window
  12. {
  13. #region 字段
  14. private FolderBrowserDialog ofd;
  15. private DialogResult result;
  16. #endregion
  17. /// <summary>
  18. /// 创建微课
  19. /// </summary>
  20. public CreateAMicroLessonWindow()
  21. {
  22. InitializeComponent();
  23. txbStoragePath.Text = FileToolsCommon.GetConfigValue("VideoSavePath");
  24. }
  25. #region 事件
  26. /// <summary>
  27. /// 关闭
  28. /// </summary>
  29. /// <param name="sender"></param>
  30. /// <param name="e"></param>
  31. private void BtnDown_Click(object sender, RoutedEventArgs e)
  32. {
  33. }
  34. /// <summary>
  35. /// 浏览
  36. /// </summary>
  37. /// <param name="sender"></param>
  38. /// <param name="e"></param>
  39. private void BtnBrowse_Click(object sender, RoutedEventArgs e)
  40. {
  41. string desktopPath = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
  42. ofd = new System.Windows.Forms.FolderBrowserDialog();
  43. result = ofd.ShowDialog();
  44. if (result == System.Windows.Forms.DialogResult.OK)
  45. {
  46. if (ofd.SelectedPath != "")
  47. {
  48. txbStoragePath.Text = ofd.SelectedPath;
  49. //string ApplicationData = ZConfig.dataPath + "fileStorageAddress.txt";
  50. //string temp = ofd.SelectedPath;
  51. //System.IO.File.WriteAllText(ApplicationData, temp, Encoding.Default);
  52. }
  53. }
  54. }
  55. /// <summary>
  56. /// 开始
  57. /// </summary>
  58. /// <param name="sender"></param>
  59. /// <param name="e"></param>
  60. private void BtnStart_Click(object sender, RoutedEventArgs e)
  61. {
  62. #region 合法性判断
  63. if (string.IsNullOrWhiteSpace(txbExplainName.Text.Trim()))
  64. {
  65. System.Windows.MessageBox.Show("讲解名称不可为空!");
  66. return;
  67. }
  68. if (string.IsNullOrWhiteSpace(txbStoragePath.Text.Trim()))
  69. {
  70. System.Windows.MessageBox.Show("路径不可为空!");
  71. return;
  72. }
  73. if (!FileToolsCommon.IsLegalPath(txbExplainName.Text.Trim(), out string ErrMessage))
  74. {
  75. System.Windows.MessageBox.Show(ErrMessage);
  76. }
  77. string PathName = FileToolsCommon.GetLegalPath(txbStoragePath.Text) + txbExplainName.Text.Trim() + "/";
  78. if (FileToolsCommon.IsExistDirectory(PathName))
  79. {
  80. //微课已存在
  81. MessageBoxResult dr = System.Windows.MessageBox.Show("讲解已存在是否覆盖?", "提示", MessageBoxButton.OKCancel);
  82. if (dr == MessageBoxResult.OK)
  83. {
  84. FileToolsCommon.DeleteDirectory(PathName);
  85. }
  86. else
  87. {
  88. return;
  89. }
  90. }
  91. #endregion
  92. //创建文件夹
  93. FileToolsCommon.CreateDirectory(PathName);
  94. //存储文件
  95. FileToolsCommon.SetConfigValue("VideoSavePath", txbStoragePath.Text);
  96. APP.WkName = txbExplainName.Text;
  97. APP.WkSavePath = PathName;
  98. FileToolsCommon.CreateDirectory(APP.WkSavePath);
  99. if (APP.W_XHMicroLessonSystemWindow == null)
  100. {
  101. APP.W_XHMicroLessonSystemWindow = new XHMicroLessonSystemWindow();
  102. //APP.W_XHMicroLessonSystemWindow .Topmost = true;
  103. }
  104. APP.W_XHMicroLessonSystemWindow.Show();
  105. this.Hide();
  106. }
  107. /// <summary>
  108. /// 窗体移动
  109. /// </summary>
  110. /// <param name="sender"></param>
  111. /// <param name="e"></param>
  112. private void Window_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
  113. {
  114. DragMove();
  115. }
  116. #endregion
  117. }
  118. }