星火微课系统客户端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

CreateAMicroLessonWindow.xaml.cs 4.3KB

hace 4 años
hace 4 años
hace 4 años
hace 4 años
hace 4 años
hace 4 años
hace 4 años
hace 4 años
hace 4 años
hace 4 años
hace 4 años
hace 4 años
hace 4 años
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. System.Environment.Exit(0);
  34. }
  35. /// <summary>
  36. /// 浏览
  37. /// </summary>
  38. /// <param name="sender"></param>
  39. /// <param name="e"></param>
  40. private void BtnBrowse_Click(object sender, RoutedEventArgs e)
  41. {
  42. string desktopPath = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
  43. ofd = new System.Windows.Forms.FolderBrowserDialog();
  44. result = ofd.ShowDialog();
  45. if (result == System.Windows.Forms.DialogResult.OK)
  46. {
  47. if (ofd.SelectedPath != "")
  48. {
  49. txbStoragePath.Text = ofd.SelectedPath;
  50. //string ApplicationData = ZConfig.dataPath + "fileStorageAddress.txt";
  51. //string temp = ofd.SelectedPath;
  52. //System.IO.File.WriteAllText(ApplicationData, temp, Encoding.Default);
  53. }
  54. }
  55. }
  56. /// <summary>
  57. /// 开始
  58. /// </summary>
  59. /// <param name="sender"></param>
  60. /// <param name="e"></param>
  61. private void BtnStart_Click(object sender, RoutedEventArgs e)
  62. {
  63. #region 合法性判断
  64. if (string.IsNullOrWhiteSpace(txbExplainName.Text.Trim()))
  65. {
  66. System.Windows.MessageBox.Show("讲解名称不可为空!");
  67. return;
  68. }
  69. if (string.IsNullOrWhiteSpace(txbStoragePath.Text.Trim()))
  70. {
  71. System.Windows.MessageBox.Show("路径不可为空!");
  72. return;
  73. }
  74. //if (!FileToolsCommon.IsLegalPath(txbStoragePath.Text.Trim(), out string ErrMessage))
  75. //{
  76. // System.Windows.MessageBox.Show(ErrMessage);
  77. // return;
  78. //}
  79. APP.WKData.WkPath = FileToolsCommon.GetLegalPath(txbStoragePath.Text) + txbExplainName.Text.Trim() + "/";
  80. if (FileToolsCommon.IsExistDirectory(APP.WKData.WkPath))
  81. {
  82. //微课已存在
  83. MessageBoxResult dr = System.Windows.MessageBox.Show("讲解已存在是否覆盖?", "提示", MessageBoxButton.OKCancel);
  84. if (dr == MessageBoxResult.OK)
  85. {
  86. FileToolsCommon.DeleteDirectory(APP.WKData.WkPath);
  87. }
  88. else
  89. {
  90. return;
  91. }
  92. }
  93. #endregion
  94. //创建文件夹
  95. FileToolsCommon.CreateDirectory(APP.WKData.WkPath);
  96. //存储文件
  97. FileToolsCommon.SetConfigValue("VideoSavePath", txbStoragePath.Text);
  98. APP.WKData.WkName = txbExplainName.Text;
  99. APP.WKData.WkCreateDateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
  100. if (APP.W_XHMicroLessonSystemWindow == null)
  101. {
  102. APP.W_XHMicroLessonSystemWindow = new XHMicroLessonSystemWindow();
  103. //APP.W_XHMicroLessonSystemWindow .Topmost = true;
  104. }
  105. APP.W_XHMicroLessonSystemWindow.ShowDialog();
  106. this.Hide();
  107. }
  108. /// <summary>
  109. /// 窗体移动
  110. /// </summary>
  111. /// <param name="sender"></param>
  112. /// <param name="e"></param>
  113. private void Window_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
  114. {
  115. DragMove();
  116. }
  117. #endregion
  118. }
  119. }