|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217 |
- using Common.system;
-
- using System;
- using System.Threading;
- using System.Windows;
- using System.Windows.Forms;
- using System.Windows.Input;
-
- using XHWK.Model;
-
- namespace XHWK.WKTool
- {
-
-
-
- public partial class CreateAMicroLessonWindow : Window
- {
- #region 字段
- private FolderBrowserDialog ofd;
- private DialogResult result;
- #endregion
-
-
-
-
- public CreateAMicroLessonWindow()
- {
- InitializeComponent();
- ResizeMode = ResizeMode.NoResize;
- if (!APP.CheckScreenCapturerRecorder())
- {
- MessageWindow.Show("首次运行需安装环境,请在确定后依次点击“OK-Next>-Next>Install”完成安装!");
- APP.InstallScreenCapturerRecorder();
- }
- txbStoragePath.Text = FileToolsCommon.GetConfigValue("VideoSavePath");
- APP.FFmpeg.GetMToFFmpeg();
- }
-
- #region 事件
-
-
-
-
-
- private void BtnDown_Click(object sender, RoutedEventArgs e)
- {
- MessageBoxResult dr = MessageWindow.Show("确定退出系统?", "提示", MessageBoxButton.OKCancel);
- if (dr == MessageBoxResult.OK)
- {
- System.Environment.Exit(0);
- }
- else
- {
- return;
- }
- }
-
-
-
-
-
- private void BtnBrowse_Click(object sender, RoutedEventArgs e)
- {
- string desktopPath = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
- ofd = new System.Windows.Forms.FolderBrowserDialog();
-
- result = ofd.ShowDialog();
- if (result == System.Windows.Forms.DialogResult.OK)
- {
- if (ofd.SelectedPath != "")
- {
- txbStoragePath.Text = ofd.SelectedPath;
-
-
-
- }
- }
- }
-
-
-
-
-
- private void BtnStart_Click(object sender, RoutedEventArgs e)
- {
- #region 合法性判断
- if (string.IsNullOrWhiteSpace(txbExplainName.Text.Trim()))
- {
- MessageWindow.Show("讲解名称不可为空!");
- return;
- }
- if (string.IsNullOrWhiteSpace(txbStoragePath.Text.Trim()))
- {
- MessageWindow.Show("路径不可为空!");
- return;
- }
- #endregion
- string wkpath = FileToolsCommon.GetLegalPath(txbStoragePath.Text) + txbExplainName.Text.Trim() + "/";
-
- APP.ReadWkData(wkpath);
- if (APP.WKData == null)
- {
- APP.WKData = new Model.Model_WKData
- {
- WkPath = wkpath,
- WkName = txbExplainName.Text,
- WkCreateDateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
- };
- }
-
- FileToolsCommon.CreateDirectory(APP.WKData.WkPath);
- FileToolsCommon.DeleteDirectory(wkpath + "temp");
- FileToolsCommon.DeleteDirectory(wkpath + "temprs");
-
- FileToolsCommon.SetConfigValue("VideoSavePath", txbStoragePath.Text);
- APP.ReadDrawData();
- #region 微课不允许有多个视频 废弃
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- #endregion
- if (APP.W_XHMicroLessonSystemWindow == null)
- {
-
- APP.W_XHMicroLessonSystemWindow = new XHMicroLessonSystemWindow();
-
-
-
- }
- APP.W_XHMicroLessonSystemWindow.Show();
- Hide();
- }
-
- private double screeHeight = SystemParameters.FullPrimaryScreenHeight;
- private double screeWidth = SystemParameters.FullPrimaryScreenWidth;
-
-
-
-
-
- private void Window_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
- {
- DragMove();
- }
- #endregion
-
-
-
-
- private void getNewApp()
- {
- new Thread(o =>
- {
- string url = APP.apiUrl + "/apprecord/get_new";
-
- string result = HttpHelper.PostAndRespStr(url, "{}");
- Model.ResultVo<Model_App> resultObj = JsonHelper.JsonToObj<Model.ResultVo<Model_App>>(result);
- if (result != null && resultObj.code == 0)
- {
- if (resultObj.obj != null)
- {
- try
- {
- int versionCode = resultObj.obj.versioncode;
- int versionThis = int.Parse(FileToolsCommon.GetConfigValue("VersionCode"));
- if (versionThis < versionCode)
- {
- Dispatcher.Invoke(new Action(() =>
- {
- string pathTemp = AppDomain.CurrentDomain.BaseDirectory + "Temp\\";
- FileToolsCommon.CreateDirectory(pathTemp);
- appUpdateShow(resultObj.obj);
- }));
- }
- }
- catch (Exception ex)
- {
- LogHelper.WriteErrLog("【检查更新】(getNewApp)版本号错误:" + ex.Message, ex);
- }
- }
- }
- }).Start();
- }
-
-
-
-
- private void appUpdateShow(Model_App app)
- {
- AppUpdateWin win = new AppUpdateWin(app)
- {
- Topmost = true,
- Owner = this
- };
- win.ShowDialog();
- }
- private void Window_Loaded(object sender, RoutedEventArgs e)
- {
- getNewApp();
- }
- }
- }
|