星火微课系统客户端
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

CreateAMicroLessonWindow.xaml.cs 4.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  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. //判断微课是否存在,存在则询问
  91. if (APP.WKDataList != null&& APP.WKDataList.Count>0)
  92. {
  93. if (APP.WKDataList.Exists(x => x.WkName == APP.WKData.WkName))
  94. {
  95. MessageBoxResult dr = System.Windows.MessageBox.Show("此微课已存在是否覆盖?", "提示", MessageBoxButton.OKCancel);
  96. if (dr == MessageBoxResult.OK)
  97. {
  98. FileToolsCommon.DeleteDirectory(APP.WKData.WkPath);
  99. FileToolsCommon.CreateDirectory(APP.WKData.WkPath);
  100. APP.WKDataList.RemoveAll(x => x.WkName == APP.WKData.WkName);
  101. }
  102. else
  103. {
  104. return;
  105. }
  106. }
  107. }
  108. if (APP.W_XHMicroLessonSystemWindow == null)
  109. {
  110. APP.W_XHMicroLessonSystemWindow = new XHMicroLessonSystemWindow();
  111. //APP.W_XHMicroLessonSystemWindow .Topmost = true;
  112. }
  113. APP.W_XHMicroLessonSystemWindow.Show();
  114. this.Hide();
  115. }
  116. /// <summary>
  117. /// 窗体移动
  118. /// </summary>
  119. /// <param name="sender"></param>
  120. /// <param name="e"></param>
  121. private void Window_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
  122. {
  123. DragMove();
  124. }
  125. #endregion
  126. }
  127. }