星火微课系统客户端
Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

CreateAMicroLessonWindow.xaml.cs 4.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  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. APP.WKData.WkPath = FileToolsCommon.GetLegalPath(txbStoragePath.Text) + txbExplainName.Text.Trim() + "/"+APP.UserInfo.Username + "/";
  83. #endregion
  84. //创建文件夹
  85. FileToolsCommon.CreateDirectory(APP.WKData.WkPath);
  86. //存储文件
  87. FileToolsCommon.SetConfigValue("VideoSavePath", txbStoragePath.Text);
  88. APP.WKData.WkName = txbExplainName.Text;
  89. APP.WKData.WkCreateDateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
  90. #region 微课不允许有多个视频 废弃
  91. ////判断微课是否存在,存在则询问
  92. //if (APP.WKDataList != null&& APP.WKDataList.Count>0)
  93. //{
  94. // if (APP.WKDataList.Exists(x => x.WkName == APP.WKData.WkName))
  95. // {
  96. // MessageBoxResult dr = System.Windows.MessageBox.Show("此微课已存在是否覆盖?", "提示", MessageBoxButton.OKCancel);
  97. // if (dr == MessageBoxResult.OK)
  98. // {
  99. // FileToolsCommon.DeleteDirectory(APP.WKData.WkPath);
  100. // FileToolsCommon.CreateDirectory(APP.WKData.WkPath);
  101. // APP.WKDataList.RemoveAll(x => x.WkName == APP.WKData.WkName);
  102. // }
  103. // else
  104. // {
  105. // return;
  106. // }
  107. // }
  108. //}
  109. #endregion
  110. if (APP.W_XHMicroLessonSystemWindow == null)
  111. {
  112. APP.W_XHMicroLessonSystemWindow = new XHMicroLessonSystemWindow();
  113. //APP.W_XHMicroLessonSystemWindow .Topmost = true;
  114. }
  115. APP.W_XHMicroLessonSystemWindow.Show();
  116. this.Hide();
  117. }
  118. /// <summary>
  119. /// 窗体移动
  120. /// </summary>
  121. /// <param name="sender"></param>
  122. /// <param name="e"></param>
  123. private void Window_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
  124. {
  125. DragMove();
  126. }
  127. #endregion
  128. }
  129. }