星火微课系统客户端
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

CreateAMicroLessonWindow.xaml.cs 5.0KB

pirms 4 gadiem
pirms 4 gadiem
pirms 4 gadiem
pirms 4 gadiem
pirms 4 gadiem
pirms 4 gadiem
pirms 4 gadiem
pirms 4 gadiem
pirms 4 gadiem
pirms 4 gadiem
pirms 4 gadiem
pirms 4 gadiem
pirms 4 gadiem
pirms 4 gadiem
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  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. MessageBoxResult dr = System.Windows.MessageBox.Show("确定退出系统?", "提示", MessageBoxButton.OKCancel);
  34. if (dr == MessageBoxResult.OK)
  35. {
  36. System.Environment.Exit(0);
  37. }
  38. else
  39. {
  40. return;
  41. }
  42. }
  43. /// <summary>
  44. /// 浏览
  45. /// </summary>
  46. /// <param name="sender"></param>
  47. /// <param name="e"></param>
  48. private void BtnBrowse_Click(object sender, RoutedEventArgs e)
  49. {
  50. string desktopPath = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
  51. ofd = new System.Windows.Forms.FolderBrowserDialog();
  52. result = ofd.ShowDialog();
  53. if (result == System.Windows.Forms.DialogResult.OK)
  54. {
  55. if (ofd.SelectedPath != "")
  56. {
  57. txbStoragePath.Text = ofd.SelectedPath;
  58. //string ApplicationData = ZConfig.dataPath + "fileStorageAddress.txt";
  59. //string temp = ofd.SelectedPath;
  60. //System.IO.File.WriteAllText(ApplicationData, temp, Encoding.Default);
  61. }
  62. }
  63. }
  64. /// <summary>
  65. /// 开始
  66. /// </summary>
  67. /// <param name="sender"></param>
  68. /// <param name="e"></param>
  69. private void BtnStart_Click(object sender, RoutedEventArgs e)
  70. {
  71. #region 合法性判断
  72. if (string.IsNullOrWhiteSpace(txbExplainName.Text.Trim()))
  73. {
  74. System.Windows.MessageBox.Show("讲解名称不可为空!");
  75. return;
  76. }
  77. if (string.IsNullOrWhiteSpace(txbStoragePath.Text.Trim()))
  78. {
  79. System.Windows.MessageBox.Show("路径不可为空!");
  80. return;
  81. }
  82. #endregion
  83. string wkpath=FileToolsCommon.GetLegalPath(txbStoragePath.Text) + txbExplainName.Text.Trim()+"/";
  84. //读取微课数据
  85. APP.ReadWkData(wkpath);
  86. if(APP.WKData==null)
  87. {
  88. APP.WKData = new Model.Model_WKData();
  89. APP.WKData.WkPath = wkpath;
  90. APP.WKData.WkName = txbExplainName.Text;
  91. APP.WKData.WkCreateDateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
  92. }
  93. //创建文件夹
  94. FileToolsCommon.CreateDirectory(APP.WKData.WkPath);
  95. //存储文件
  96. FileToolsCommon.SetConfigValue("VideoSavePath", txbStoragePath.Text);
  97. APP.ReadDrawData();
  98. #region 微课不允许有多个视频 废弃
  99. ////判断微课是否存在,存在则询问
  100. //if (APP.WKDataList != null&& APP.WKDataList.Count>0)
  101. //{
  102. // if (APP.WKDataList.Exists(x => x.WkName == APP.WKData.WkName))
  103. // {
  104. // MessageBoxResult dr = System.Windows.MessageBox.Show("此微课已存在是否覆盖?", "提示", MessageBoxButton.OKCancel);
  105. // if (dr == MessageBoxResult.OK)
  106. // {
  107. // FileToolsCommon.DeleteDirectory(APP.WKData.WkPath);
  108. // FileToolsCommon.CreateDirectory(APP.WKData.WkPath);
  109. // APP.WKDataList.RemoveAll(x => x.WkName == APP.WKData.WkName);
  110. // }
  111. // else
  112. // {
  113. // return;
  114. // }
  115. // }
  116. //}
  117. #endregion
  118. if (APP.W_XHMicroLessonSystemWindow == null)
  119. {
  120. APP.W_XHMicroLessonSystemWindow = new XHMicroLessonSystemWindow();
  121. //APP.W_XHMicroLessonSystemWindow .Topmost = true;
  122. }
  123. APP.W_XHMicroLessonSystemWindow.Show();
  124. this.Hide();
  125. }
  126. /// <summary>
  127. /// 窗体移动
  128. /// </summary>
  129. /// <param name="sender"></param>
  130. /// <param name="e"></param>
  131. private void Window_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
  132. {
  133. DragMove();
  134. }
  135. #endregion
  136. }
  137. }