|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431 |
- using Common.system;
-
- using System;
- using System.Drawing;
- using System.IO;
- using System.Threading;
- using System.Windows;
- using System.Windows.Forms;
- using System.Windows.Ink;
- using System.Windows.Media;
- using System.Windows.Media.Imaging;
- using System.Windows.Threading;
-
- using XHWK.Model;
-
- namespace XHWK.WKTool
- {
- /// <summary>
- /// 录屏工具栏
- /// </summary>
- public partial class ScreenRecordingToolbarWindow : Window
- {
- #region 初始变量
- /// <summary>
- /// 视频保存名称
- /// </summary>
- private string VideoSavePathName;
-
- /// <summary>
- /// 是否首次录屏
- /// </summary>
- private bool IsFirstRS = true;
-
- /// <summary>
- /// 是否停止/暂停中
- /// </summary>
- private bool IsSuspend = true;
-
- /// <summary>
- /// 视频信息
- /// </summary>
- private Model_Video VideoInfo = null;
-
- //声明一个 DrawingAttributes 类型的变量
- private DrawingAttributes drawingAttributes;
- private DispatcherTimer t = null;
- /// <summary>
- /// 计时器状态
- /// </summary>
- private enum State
- {
- Start,
- Pause,
- End
- }
- /// <summary>
- /// 状态
- /// </summary>
- private State _state = State.End;
-
- private KeyboardHookCommon k_hook;
- /// <summary>
- /// 🖊状态 0红色 1蓝色 10红色批注内 11蓝色批注内
- /// </summary>
- public int flg = 0;
- private System.Timers.Timer timer = new System.Timers.Timer();
- #endregion
-
- #region 初始化
- /// <summary>
- /// 录屏工具栏
- /// </summary>
- public ScreenRecordingToolbarWindow()
- {
- InitializeComponent();
- ResizeMode = ResizeMode.NoResize;
- }
- /// <summary>
- /// 初始化
- /// </summary>
- public void Initialize()
- {
- GridSrToobar.Visibility = Visibility.Visible;
- if (APP.W_PracticeWindow == null)
- {
- APP.W_PracticeWindow = new PracticeWindow
- {
- //APP.W_PracticeWindow.Topmost = true;
- Width = pwidth,
- Height = pHeight,
- Left = 0,
- Top = 0
- };
- //practiceWin.Owner = this;
- }
- APP.W_PracticeWindow.InitPen();
- APP.W_PracticeWindow.InitTQLPPen();
- APP.W_PracticeWindow.Show();
- new Thread(new ThreadStart(new Action(() =>
- {
- Thread.Sleep(100);
- Dispatcher.Invoke(() =>
- {
- //Owner = APP.W_PracticeWindow;
- Topmost = true;
- });
- }))).Start();
- APP.W_PracticeWindow.Hide();
-
- //borOne.Background = new SolidColorBrush(Colors.DodgerBlue);
- //borTwo.Background = new SolidColorBrush(Colors.DodgerBlue);
- flg = 0;
-
-
- k_hook = new KeyboardHookCommon();
- k_hook.KeyDownEvent += K_hook_KeyDownEvent;
-
- //创建 DrawingAttributes 类的一个实例
- drawingAttributes = new DrawingAttributes();
- //将 InkCanvas 的 DefaultDrawingAttributes 属性的值赋成创建的 DrawingAttributes 类的对象的引用
- //InkCanvas 通过 DefaultDrawingAttributes 属性来获取墨迹的各种设置,该属性的类型为 DrawingAttributes 型
- blackboard_canvas.DefaultDrawingAttributes = drawingAttributes;
- drawingAttributes.FitToCurve = true;
- //隐藏画笔工具栏
- //BtnToolbarDown_Click(null, null);
- //GridSrToobar.Visibility = Visibility.Hidden;
- //gridColour.Visibility = Visibility.Hidden;
- //gridThickness.Visibility = Visibility.Hidden;
- BtnRecordingScreen.Visibility = Visibility.Visible;
- BtnRecordingScreenPause.Visibility = Visibility.Collapsed;
- BtnStopRecordingScreen.IsEnabled = false; //停止录制按钮不点击
- BtnPenBlue.IsEnabled = false;//蓝笔不可点击
- BtnPenRed.IsEnabled = false;//红笔不可点击
- BtnPenBlue.Visibility = Visibility.Visible;
- BtnPenRed.Visibility = Visibility.Visible;
- BtnPenBlue_CL.Visibility = Visibility.Collapsed;
- BtnPenRed_CL.Visibility = Visibility.Collapsed;
- TxbTime.Content = "00:00";
- if (t == null)
- {
- t = new DispatcherTimer();
- t.Tick += OnTimer;
- t.Interval = new TimeSpan(0, 0, 0, 0, 200);
- t.IsEnabled = true;
- t.Start();
- }
- t.Interval = new TimeSpan(0, 0, 0, 0, 200);
- }
-
- private void TimerDealy(object o, EventArgs e)
- {
- Dispatcher.Invoke(() =>
- {
- if (Left > 1630)
- {
- return;
- }
- //获取鼠标在屏幕上的位置
- double mouse_x = Form.MousePosition.X; //需要添加引用System.Drawing
- double mouse_y = Form.MousePosition.Y;
-
- bool is_in_collasped_range = (mouse_y > Left + Height) || (mouse_x < Left || mouse_x > Left + Width);//缩起的条件
- bool is_in_visiable_range = (mouse_y < 1 && mouse_x >= Left && mouse_x <= Left + Width); //展开的条件
-
- if (Left < 1630 && Left >= 0 && is_in_collasped_range)
- {
- System.Threading.Thread.Sleep(300);
- Left += 20 /*-this.ActualWidth - 3*/;
- }
- else if (Left < 0 && is_in_visiable_range)
- {
- Left = 1;
- }
- });
- }
- private void K_hook_KeyDownEvent(object sender, System.Windows.Forms.KeyEventArgs e)
- {
- if (e.KeyValue == (int)System.Windows.Forms.Keys.F5 && (int)Control.ModifierKeys == (int)Keys.Control)
- {
- //开始,暂停
- BtnRecordingScreen_Click(null, null);
- }
- if (e.KeyValue == (int)Keys.S && (int)Control.ModifierKeys == (int)Keys.Control)
- {
- //结束
- BtnStopRecordingScreen_Click(null, null);
- }
-
- }
- #endregion
-
- #region 事件
- /// <summary>
- /// 记录上次执行时间
- /// </summary>
- private DateTime Recorddt = DateTime.Now;
- DateTime SRTime = Convert.ToDateTime("2020-01-01 00:00:00");
- /// <summary>
- /// 时钟回调
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void OnTimer(object sender, EventArgs e)
- {
- switch (_state)
- {
- case State.Start:
- {
- DateTime dt = DateTime.Now;
- TimeSpan ts = dt.Subtract(Recorddt);//时间差
- double tsmi = ts.TotalMilliseconds;
- if (tsmi > 1000.0)
- {
- Recorddt = Recorddt.AddMilliseconds(1000);
- SRTime = SRTime.AddMilliseconds(1000);
- }
- }
- break;
-
- case State.Pause:
- {
- }
- break;
-
- case State.End:
- {
- SRTime = Convert.ToDateTime("2020-01-01 00:00:00");
- //_timeSpan = new TimeSpan();
- ////_timeSpan = new TimeSpan(0, 23, 12, 45, 54);
- }
- break;
- }
-
- //string time = string.Format("{0:D2}:{1:D2}",/* _timeSpan.Hours,*/ _timeSpan.Minutes, _timeSpan.Seconds);
- //char[] times = time.ToCharArray();
- if (SRTime.Hour > 0)
- {
- //Dispatcher.Invoke(() =>
- //{
- TxbTime.Content = SRTime.ToString("HH:mm:ss");
- //});
- }
- else
- {
- //Dispatcher.Invoke(() =>
- //{
- TxbTime.Content = SRTime.ToString("mm:ss");
- //});
- }
- }
-
- /// <summary>
- /// 开始
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void Stack()
- {
- Recorddt = DateTime.Now;
- _state = State.Start;
- }
- /// <summary>
- /// 暂停
- /// </summary>
- private void TimeOut()
- {
- _state = State.Pause;
- }
- /// <summary>
- /// 结束
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void End()
- {
- _state = State.End;
- }
-
- #region 录屏
- /// <summary>
- /// 设置录屏文件地址
- /// </summary>
- private void SetUpVideoPathName()
- {
- //FileToolsCommon.DeleteDirectory(APP.WKData.WkPath + "temp/");
- FileToolsCommon.CreateDirectory(APP.WKData.WkPath);
- FileToolsCommon.DeleteDirectory(APP.WKData.WkPath + "temprs/");
- VideoSavePathName = APP.WKData.WkPath + APP.WKData.WkName + "_录屏." + ((Enum_VideoType)int.Parse(FileToolsCommon.GetConfigValue("VideoType"))).ToString();
- int num = 1;
- while (FileToolsCommon.IsExistFile(VideoSavePathName))
- {
- VideoSavePathName = APP.WKData.WkPath + APP.WKData.WkName + "_录屏_" + num + "." + ((Enum_VideoType)int.Parse(FileToolsCommon.GetConfigValue("VideoType"))).ToString();
- num++;
- }
- }
-
- /// <summary>
- /// 是否已经按下按钮
- /// </summary>
- private bool IsPressButton = false;
- /// <summary>
- /// 开始或暂停录制
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void BtnRecordingScreen_Click(object sender, RoutedEventArgs e)
- {
- #region 防止连击
- if (IsPressButton)
- {
- return;
- }
- else
- {
- IsPressButton = true;
- new Thread(new ThreadStart(new Action(() =>
- {
- Thread.Sleep(500);
- IsPressButton = false;
- }))).Start();
- }
- #endregion
- if (IsSuspend)
- {
- if (IsFirstRS)
- {
- #region 检测麦克风扬声器是否可用
- string AudioPath = FileToolsCommon.GetFileAbsolutePath("/temp/audio/");
- FileToolsCommon.CreateDirectory(AudioPath);
- string audioSpeakerPath = AudioPath + "adoS" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".m";
- string audioMicrophonePath = AudioPath + "adoM" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".m";
- try
- {
- FileToolsCommon.DeleteFile(audioSpeakerPath);
- FileToolsCommon.DeleteFile(audioMicrophonePath);
- }
- catch (Exception)
- {
-
- }
- //扬声器
- if (APP.FFmpeg.StartRecordSpeakerAudio(audioSpeakerPath))
- {
- APP.FFmpeg.StopRecordAudio(2);
- //Thread.Sleep(500);
- //麦克风
- if (APP.FFmpeg.StartRecordAudio(audioMicrophonePath))
- {
- }
- else
- {
- //无法录制麦克风
- MessageBoxResult Res = MessageWindow.Show("当前电脑无法录制麦克风,是否继续?", "消息提示", MessageBoxButton.OKCancel);
- if (Res == MessageBoxResult.Cancel)
- {
- return;
- }
- }
- APP.FFmpeg.StopRecordAudio(1);
- }
- else
- {
- //无法录制扬声器音频
- MessageBoxResult Res = MessageWindow.Show("当前电脑无法录制音频,是否继续?", "消息提示", MessageBoxButton.OKCancel);
- if (Res == MessageBoxResult.Cancel)
- {
- return;
- }
- }
- #endregion
-
- VideoInfo = new Model_Video
- {
- VideoType = (Enum_VideoType)int.Parse(FileToolsCommon.GetConfigValue("VideoType")),
- WkType = Enum_WKVidetype.RecordingScreen
- };
- SetUpVideoPathName();
- k_hook.Start();//安装键盘钩子
-
- if (APP.W_CountdownWindow == null)
- {
- APP.W_CountdownWindow = new CountdownWindow();
- APP.W_CountdownWindow.Initialize(true, 1800);
- //APP.W_CountdownWindow.Topmost = true;
- }
- else
- {
- APP.W_CountdownWindow.Initialize(true, 1800);
- //APP.W_CountdownWindow.Topmost = true;
- }
- APP.W_CountdownWindow.Show();
- }
- IsSuspend = false;
-
- BtnRecordingScreen.Visibility = Visibility.Collapsed;
- BtnRecordingScreenPause.Visibility = Visibility.Visible;
- BtnStopRecordingScreen.IsEnabled = true; //停止录制按钮可点击
- BtnPenBlue.IsEnabled = true;//蓝笔可点击
- BtnPenRed.IsEnabled = true;//红笔可点击
- BtnPenBlue.Visibility = Visibility.Visible;
- BtnPenRed.Visibility = Visibility.Visible;
- BtnPenBlue_CL.Visibility = Visibility.Collapsed;
- BtnPenRed_CL.Visibility = Visibility.Collapsed;
- TxbTime.Visibility = Visibility.Visible;//时间显示
-
- #region 隐藏工具栏
- if (APP.IsHideSRTool)
- {
- if (APP.W_MinToolbar == null)
- {
- APP.W_MinToolbar = new MinToolbar();
- }
- APP.W_MinToolbar.Topmost = true;
- double MinToolTop = Top;
- GridSrToobar.Visibility = Visibility.Hidden;
- //if (APP.SkinStyle == "1")
- //{
- // ColorType = 0;
- // MinToolTop = this.Top + ((this.ActualHeight - btnReturn.ActualHeight) / 2);//(VbxBlue.ActualHeight -)
- //}
- //else if (APP.SkinStyle == "2")
- //{
- //MinToolTop = this.Top + ((this.ActualHeight - VbxBlack.ActualHeight) / 2);
- //}
- APP.W_MinToolbar.Initialize(MinToolTop,ActualHeight);
- APP.W_MinToolbar.Show();
- }
- #endregion
- try
- {
- #region 4秒内不可点击
- new Thread(new ThreadStart(new Action(() =>
- {
- //Dispatcher.Invoke(() =>
- //{
- // ImgEndRecordingScreen.Source = new BitmapImage(new Uri("pack://application:,,,/Images/Toobar15.png"));
- // BtnRecordingScreen.IsEnabled = false;
- // BtnStopRecordingScreen.IsEnabled = false;
- //});
- //Thread.Sleep(4000);
- Dispatcher.Invoke(() =>
- {
- BtnRecordingScreen.IsEnabled = true;
- BtnStopRecordingScreen.IsEnabled = true;
- BtnRecordingScreenPause.IsEnabled = true;
- });
- }))).Start();
- #endregion
- new Thread(new ThreadStart(new Action(() =>
- {
- if (IsFirstRS)
- {
- Thread.Sleep(800);
- }
- if (APP.FFmpeg.myProcess != null)
- {
- Thread.Sleep(100);
- }
- System.Drawing.Size DesktopSize = PrimaryScreen.DESKTOP;
- bool IsRecordingSound = FileToolsCommon.GetConfigValue("IsRecordingSound") == "1";
- bool IsRecordingMicrophone = FileToolsCommon.GetConfigValue("IsRecordingMicrophone") == "1";
- bool SynRes = APP.FFmpeg.StartRecordingVideo(VideoSavePathName, DesktopSize, IsRecordingSound, IsRecordingMicrophone, out string ErrMessage, APP.MicrophoneName);
-
- Thread.Sleep(1300);
- Dispatcher.Invoke(() =>
- {
- if (!SynRes)
- {
- MessageWindow.Show(ErrMessage);
- //隐藏画笔工具栏
- //BtnToolbarDown_Click(null, null);
- //gridToolbar.Visibility = Visibility.Hidden;
- //gridColour.Visibility = Visibility.Hidden;
- //gridThickness.Visibility = Visibility.Hidden;
- BtnRecordingScreen.Visibility = Visibility.Visible;
- BtnRecordingScreenPause.Visibility = Visibility.Collapsed;
- BtnStopRecordingScreen.IsEnabled = false; //停止录制按钮不点击
- BtnPenBlue.IsEnabled = false;//蓝笔不可点击
- BtnPenRed.IsEnabled = false;//红笔不可点击
- BtnPenBlue.Visibility = Visibility.Visible;
- BtnPenRed.Visibility = Visibility.Visible;
- BtnPenBlue_CL.Visibility = Visibility.Collapsed;
- BtnPenRed_CL.Visibility = Visibility.Collapsed;
- IsSuspend = true;
- IsFirstRS = true;
- return;
- }
- Stack();
- });
- }))).Start();
- }
- catch (Exception ex)
- {
- MessageWindow.Show(ex.Message);
- }
- IsFirstRS = false;
- }
- else
- {
- TimeOut();
- IsSuspend = true;
- BtnRecordingScreen.Visibility = Visibility.Visible;
- BtnRecordingScreenPause.Visibility = Visibility.Collapsed;
- BtnStopRecordingScreen.IsEnabled = false; //停止录制按钮不点击
- //imgBlackPenOne.Source = new BitmapImage(new Uri("pack://application:,,,/Images/31.png"));
- //btnBlackPenOne.IsEnabled = false;//蓝笔不可点击
- //imgBlackPenTwo.Source = new BitmapImage(new Uri("pack://application:,,,/Images/31.png"));
- //btnBlackPenTwo.IsEnabled = false;//红笔不可点击
-
- #region 2秒内不可点击
- new Thread(new ThreadStart(new Action(() =>
- {
- //Dispatcher.Invoke(() =>
- //{
- // ImgEndRecordingScreen.Source = new BitmapImage(new Uri("pack://application:,,,/Images/Toobar15.png"));
- // BtnRecordingScreen.IsEnabled = false;
- // BtnStopRecordingScreen.IsEnabled = false;
- //});
- //Thread.Sleep(2000);
- Dispatcher.Invoke(() =>
- {
- BtnRecordingScreen.IsEnabled = true;
- BtnStopRecordingScreen.IsEnabled = true;
- });
- }))).Start();
- #endregion
- try
- {
- APP.FFmpeg.SuspendFFmpeg();
- }
- catch (Exception ex)
- {
- MessageWindow.Show(ex.Message);
- }
- }
- }
- /// <summary>
- /// 停止录像
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void BtnStopRecordingScreen_Click(object sender, RoutedEventArgs e)
- {
- #region 防止连击
- if (IsPressButton)
- {
- return;
- }
- else
- {
- IsPressButton = true;
- new Thread(new ThreadStart(new Action(() =>
- {
- Thread.Sleep(500);
- IsPressButton = false;
- }))).Start();
- }
- #endregion
- BtnRecordingScreen.ToolTip = "开始";
- k_hook.Stop();
- IsSuspend = true;
- TxbTime.Content = "00:00";
- End();
- if (APP.W_PracticeWindow != null)
- {
- if (APP.W_PracticeWindow.Visibility == Visibility.Visible)
- {
- Owner = null;
- APP.W_PracticeWindow.ReturnPractice();
- }
- }
- //if (gridToolbar.Visibility == Visibility.Visible)
- //{
- // GridSrToobar.Visibility = Visibility.Visible;
- // gridToolbar.Visibility = Visibility.Hidden;
- // gridColour.Visibility = Visibility.Hidden;
- // gridThickness.Visibility = Visibility.Hidden;
- //}
- if (APP.W_XHMicroLessonSystemWindow == null)
- {
- APP.W_XHMicroLessonSystemWindow = new XHMicroLessonSystemWindow();
- }
- APP.W_XHMicroLessonSystemWindow.InitializeKeyDownEvent();
- APP.W_XHMicroLessonSystemWindow.InitPen();
- APP.W_XHMicroLessonSystemWindow.InitTQLPPen();
- APP.W_XHMicroLessonSystemWindow.Show();
- if (!IsFirstRS)
- {
- try
- {
- if (SRTime.Hour > 0 || SRTime.Minute > 0 || SRTime.Second > 3)
- {
- try
- {
- APP.FFmpeg.StopFFmpeg(VideoSavePathName);
- }
- catch (Exception ex)
- {
- LogHelper.WriteErrLog("【停止录屏】(BtnStopRecordingScreen_Click)" + ex.Message, ex);
- }
- IsFirstRS = true;
- //生成缩略图
- string ThumbnailPath = FileToolsCommon.GetDirectoryName(VideoSavePathName) + "ThumbnailPath/";
- FileToolsCommon.CreateDirectory(ThumbnailPath);
- //缩略图存储位置
- string ThumbnailPathName = ThumbnailPath + FileToolsCommon.GetIOFileName(VideoSavePathName).Replace(".", "") + ".JPG";
- new Thread(new ThreadStart(new Action(() =>
- {
- while (!FileToolsCommon.IsExistFile(VideoSavePathName))
- {
- Thread.Sleep(100);
- }
- FileToolsCommon.DeleteFile(ThumbnailPathName);
- //VideoInfo.VideoSize = FileToolsCommon.GetFileSizeByMB(VideoSavePathName).ToString() + " MB";
- VideoInfo.RSTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
- VideoInfo.VideoPath = VideoSavePathName;
- VideoInfo.ThumbnailPath = ThumbnailPathName;
- APP.FFmpeg.GenerateThumbnails(VideoSavePathName, ThumbnailPathName, 200, 130);
- VideoInfo.FileGuid = Guid.NewGuid().ToString();
- VideoInfo.IsUpload = false;
- VideoInfo.Uploaded = 0;
- //VideoInfo.Savefolder = APP.UserInfo.Schoolid + "/resource";
- if (!APP.VideoList.Exists(x => x.FileGuid == VideoInfo.FileGuid) || !APP.VideoList.Exists(x => x.VideoPath == VideoInfo.VideoPath))
- {
- APP.VideoList.Add(VideoInfo);
- //保存数据
- APP.SaveWkData();
- }
- }))).Start();
- Click_stopRecordingScreen();
- }
- else
- {
- //视频过短
- APP.FFmpeg.SuspendFFmpeg();
- IsFirstRS = true;
- MessageWindow.Show("录屏时间过短,请重新录制!");
- }
-
- new Thread(new ThreadStart(new Action(() =>
- {
- Thread.Sleep(700);
- Dispatcher.Invoke(() =>
- {
- if (APP.W_MinToolbar != null)
- {
- APP.W_MinToolbar.Hide();
- }
- });
- }))).Start();
- }
- catch (Exception ex)
- {
- LogHelper.WriteErrLog("【停止录屏】(BtnStopRecordingScreen_Click)" + ex.Message, ex);
- }
- }
- Hide();
- }
- public void MaxToobar()
- {
- Graphics graphics = Graphics.FromHwnd(IntPtr.Zero);
- float DIP = graphics.DpiX;
- //float DIPY = graphics.DpiY;
- APP.W_ScreenRecordingToolbarWindow.Left = PrimaryScreen.WorkingArea.Width / (DIP / 96) - APP.W_ScreenRecordingToolbarWindow.Width;
- GridSrToobar.Visibility = Visibility.Visible;
- APP.W_ScreenRecordingToolbarWindow.Topmost = true;
- }
- #endregion
-
- #region 画笔相关
- /// <summary>
- /// 画笔工具栏关闭事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void BtnToolbarDown_Click(object sender, RoutedEventArgs e)
- {
- gridToolbar.Visibility = Visibility.Hidden;
- gridColour.Visibility = Visibility.Hidden;
- gridThickness.Visibility = Visibility.Hidden;
- APP.W_PracticeWindow.Hide();
- }
- /// <summary>
- /// 笔调用批注
- /// </summary>
- public void PenPractice()
- {
- if (!IsFirstRS)
- {
- if (flg != 11 && flg != 10)
- {
- #region 防止连击
- if (IsPressButton)
- {
- return;
- }
- else
- {
- IsPressButton = true;
- new Thread(new ThreadStart(new Action(() =>
- {
- Thread.Sleep(500);
- IsPressButton = false;
- }))).Start();
- }
- #endregion
- string time = GetTimeStamp();
- string tempPath = AppDomain.CurrentDomain.BaseDirectory + "temp\\";
- if (!Directory.Exists(tempPath))
- {
- Directory.CreateDirectory(tempPath);
- }
- try
- {
- Dispatcher.Invoke(() =>
- {
- //borOne.Background = new SolidColorBrush(Colors.LightSkyBlue);
- //borTwo.Background = new SolidColorBrush(Colors.DodgerBlue);
- if (APP.W_PracticeWindow == null)
- {
- APP.W_PracticeWindow = new PracticeWindow
- {
- Width = pwidth,
- Height = pHeight,
- Left = 0,
- Top = 0
- };
- //practiceWin.Owner = this;
- }
- //APP.W_PracticeWindow.InitPen();
- //APP.W_PracticeWindow.InitTQLPPen();
- APP.W_PracticeWindow.Initialize();// imagePath);
- flg = 11;
- APP.W_PracticeWindow.Blue();
- APP.W_PracticeWindow.Show();
- APP.W_PracticeWindow.Topmost = true;
- APP.W_PracticeWindow.Focus();
- });
-
-
- new Thread(new ThreadStart(new Action(() =>
- {
- Dispatcher.Invoke(() =>
- {
- APP.W_PracticeWindow.Topmost = false;
- });
- Thread.Sleep(500);
- Dispatcher.Invoke(() =>
- {
- //Owner = APP.W_PracticeWindow;
- Topmost = true;
- });
- }))).Start();
- }
- catch (Exception ex)
- {
- LogHelper.WriteErrLog("【批注(PracticeWindow)" + ex.Message, ex);
- }
- }
- }
- }
- /// <summary>
- /// 画笔点击事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void BtnBrush_Click(object sender, RoutedEventArgs e)
- {
- if(BtnPenBlue.Visibility!= Visibility.Visible)
- {
- return;
- }
- #region 防止连击
- if (IsPressButton)
- {
- return;
- }
- else
- {
- IsPressButton = true;
- new Thread(new ThreadStart(new Action(() =>
- {
- Thread.Sleep(500);
- IsPressButton = false;
- }))).Start();
- }
- #endregion
- BtnPenBlue.Visibility = Visibility.Collapsed;
- BtnPenRed.Visibility = Visibility.Visible;
- BtnPenBlue_CL.Visibility = Visibility.Visible;
- BtnPenRed_CL.Visibility = Visibility.Collapsed;
- string time = GetTimeStamp();
- string tempPath = AppDomain.CurrentDomain.BaseDirectory + "temp\\";
- if (!Directory.Exists(tempPath))
- {
- Directory.CreateDirectory(tempPath);
- }
-
- #region 录屏批注取消画笔
- //string imagePath = Path.Combine(tempPath, time + ".jpg");
- //ImageHelper.GetScreenshot(new System.Drawing.Rectangle(0, 0, 0, 0), imagePath, true, out BitmapImage bitmap);
- #endregion
-
- try
- {
- if (flg == 11)
- {
- //Dispatcher.Invoke(() =>
- //{
- // borOne.Background = new SolidColorBrush(Colors.DodgerBlue);
- // borTwo.Background = new SolidColorBrush(Colors.DodgerBlue);
- //});
- flg = 1;
- //this.Owner = null;
- APP.W_PracticeWindow.ReturnPractice();
- }
- else if (flg == 10)
- {
- //Dispatcher.Invoke(() =>
- //{
- // borOne.Background = new SolidColorBrush(Colors.LightSkyBlue);
- // borTwo.Background = new SolidColorBrush(Colors.DodgerBlue);
- //});
- APP.W_PracticeWindow.Blue();
- flg = 11;
- }
- else
- {
- //new Thread(new ThreadStart(new Action(() =>
- //{
- //Dispatcher.Invoke(() =>
- //{
- // borOne.Background = new SolidColorBrush(Colors.LightSkyBlue);
- // borTwo.Background = new SolidColorBrush(Colors.DodgerBlue);
- //});
-
- //}))).Start();
- if (APP.W_PracticeWindow == null)
- {
- APP.W_PracticeWindow = new PracticeWindow
- {
- //APP.W_PracticeWindow.Topmost = true;
- Width = pwidth,
- Height = pHeight,
- Left = 0,
- Top = 0
- };
- //practiceWin.Owner = this;
- }
- APP.W_PracticeWindow.InitPen();
- APP.W_PracticeWindow.InitTQLPPen();
- APP.W_PracticeWindow.Initialize();// imagePath);
- flg = 11;
- APP.W_PracticeWindow.Blue();
- APP.W_PracticeWindow.Show();
- new Thread(new ThreadStart(new Action(() =>
- {
- Thread.Sleep(100);
- Dispatcher.Invoke(() =>
- {
- //Owner = APP.W_PracticeWindow;
- Topmost = true;
- });
- }))).Start();
- }
- }
- catch (Exception ex)
- {
- LogHelper.WriteErrLog("【批注(PracticeWindow)" + ex.Message, ex);
- }
-
- //imgCanvas.Source = new BitmapImage(new Uri(imagePath));
-
- }
- /// <summary>
- /// 屏幕宽
- /// </summary>
- internal double pwidth = SystemParameters.PrimaryScreenWidth;
- /// <summary>
- /// 屏幕高
- /// </summary>
- internal double pHeight = SystemParameters.PrimaryScreenHeight;
- /// <summary>
- /// 获取时间戳
- /// </summary>
- /// <returns></returns>
- public string GetTimeStamp()
- {
- TimeSpan ts = DateTime.Now - new DateTime(1970, 1, 1, 0, 0, 0, 0);
- return Convert.ToInt64(ts.TotalMilliseconds).ToString();
- }
- /// <summary>
- /// 画笔粗细事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void BtnThickness_Click(object sender, RoutedEventArgs e)
- {
- gridThickness.Visibility = Visibility.Visible;
- gridColour.Visibility = Visibility.Collapsed;
- }
- /// <summary>
- /// 画笔颜色事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void BtnColour_Click(object sender, RoutedEventArgs e)
- {
- gridColour.Visibility = Visibility.Visible;
- gridThickness.Visibility = Visibility.Collapsed;
- }
- /// <summary>
- /// 白色
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void BtnWhite_Click(object sender, RoutedEventArgs e)
- {
- //drawingAttributes.Color = Colors.White;
- APP.W_PracticeWindow.White();
- gridColour.Visibility = Visibility.Collapsed;
- gridThickness.Visibility = Visibility.Collapsed;
- }
- /// <summary>
- /// 红色
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void BtnRed_Click(object sender, RoutedEventArgs e)
- {
- //drawingAttributes.Color = Colors.Red;
- APP.W_PracticeWindow.Red();
- gridColour.Visibility = Visibility.Collapsed;
- gridThickness.Visibility = Visibility.Collapsed;
- }
- /// <summary>
- /// 黄色
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void BtnYellow_Click(object sender, RoutedEventArgs e)
- {
- //drawingAttributes.Color = Colors.Gold;
- APP.W_PracticeWindow.Yellow();
- gridColour.Visibility = Visibility.Collapsed;
- gridThickness.Visibility = Visibility.Collapsed;
- }
- /// <summary>
- /// 青色
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void BtnCyanBlue_Click(object sender, RoutedEventArgs e)
- {
- //drawingAttributes.Color = Colors.LimeGreen;
- APP.W_PracticeWindow.CyanBlue();
- gridColour.Visibility = Visibility.Collapsed;
- gridThickness.Visibility = Visibility.Collapsed;
- }
- /// <summary>
- /// 灰色
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void BtnGray_Click(object sender, RoutedEventArgs e)
- {
- //drawingAttributes.Color = Colors.Gray;
- APP.W_PracticeWindow.Gray();
- gridColour.Visibility = Visibility.Collapsed;
- gridThickness.Visibility = Visibility.Collapsed;
- }
- /// <summary>
- /// 蓝色
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void BtnBlue_Click(object sender, RoutedEventArgs e)
- {
- //drawingAttributes.Color = Colors.DeepSkyBlue;
- APP.W_PracticeWindow.Blue();
- gridColour.Visibility = Visibility.Collapsed;
- gridThickness.Visibility = Visibility.Collapsed;
- }
- /// <summary>
- /// 画笔 细
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void BtnFine_Click(object sender, RoutedEventArgs e)
- {
- APP.W_PracticeWindow.Fine();
- gridColour.Visibility = Visibility.Collapsed;
- gridThickness.Visibility = Visibility.Collapsed;
- }
- /// <summary>
- /// 画笔 中
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void BtnIn_Click(object sender, RoutedEventArgs e)
- {
- APP.W_PracticeWindow.In();
- gridColour.Visibility = Visibility.Collapsed;
- gridThickness.Visibility = Visibility.Collapsed;
- }
- /// <summary>
- /// 画笔粗
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void BtnCrude_Click(object sender, RoutedEventArgs e)
- {
- APP.W_PracticeWindow.Crude();
- gridColour.Visibility = Visibility.Collapsed;
- gridThickness.Visibility = Visibility.Collapsed;
- }
- /// <summary>
- /// 橡皮
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void BtnEraser_Click(object sender, RoutedEventArgs e)
- {
- APP.W_PracticeWindow.Eraser();
- }
- /// <summary>
- /// 🖊
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void BtnPen_Click(object sender, RoutedEventArgs e)
- {
- APP.W_PracticeWindow.Pen();
- }
- /// <summary>
- /// ⚪
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void BtnRound_Click(object sender, RoutedEventArgs e)
- {
- APP.W_PracticeWindow.Round();
- }
- /// <summary>
- /// 矩形
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void BtnRectangle_Click(object sender, RoutedEventArgs e)
- {
- APP.W_PracticeWindow.Rectangle();
- }
- #endregion
- #endregion
-
- /// <summary>
- /// 停止录屏
- /// </summary>
- public delegate void StopRecordingScreen();
- /// <summary>
- /// 停止录屏
- /// </summary>
- public event StopRecordingScreen Click_stopRecordingScreen;
- /// <summary>
- /// 黑笔
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void BtnBlackPen_Click(object sender, RoutedEventArgs e)
- {
-
- }
- /// <summary>
- /// 移动工具栏
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void Grid_MouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
- {
- DragMove();
- }
- /// <summary>
- /// 红笔
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void BtnBlackPenTwo_Click(object sender, RoutedEventArgs e)
- {
- if (BtnPenRed.Visibility != Visibility.Visible)
- {
- return;
- }
- #region 防止连击
- if (IsPressButton)
- {
- return;
- }
- else
- {
- IsPressButton = true;
- new Thread(new ThreadStart(new Action(() =>
- {
- Thread.Sleep(500);
- IsPressButton = false;
- }))).Start();
- }
- #endregion
- BtnPenBlue.Visibility = Visibility.Visible;
- BtnPenRed.Visibility = Visibility.Collapsed;
- BtnPenBlue_CL.Visibility = Visibility.Collapsed;
- BtnPenRed_CL.Visibility = Visibility.Visible;
- string time = GetTimeStamp();
- string tempPath = AppDomain.CurrentDomain.BaseDirectory + "temp\\";
- if (!Directory.Exists(tempPath))
- {
- Directory.CreateDirectory(tempPath);
- }
- #region 录屏批注取消画笔
- string imagePath = Path.Combine(tempPath, time + ".jpg");
- ImageHelper.GetScreenshot(new System.Drawing.Rectangle(0, 0, 0, 0), imagePath, true, out BitmapImage bitmap);
- #endregion
- try
- {
- if (flg == 10)
- {
- //Dispatcher.Invoke(() =>
- //{
- // borOne.Background = new SolidColorBrush(Colors.DodgerBlue);
- // borTwo.Background = new SolidColorBrush(Colors.DodgerBlue);
- //});
- flg = 0;
- //this.Owner = null;
- APP.W_PracticeWindow.ReturnPractice();
- }
- else if (flg == 11)
- {
- //Dispatcher.Invoke(() =>
- //{
- // borTwo.Background = new SolidColorBrush(Colors.LightSkyBlue);
- // borOne.Background = new SolidColorBrush(Colors.DodgerBlue);
- //});
- flg = 10;
- APP.W_PracticeWindow.Red();
- }
- else
- {
- //Dispatcher.Invoke(() =>
- //{
- // borTwo.Background = new SolidColorBrush(Colors.LightSkyBlue);
- // borOne.Background = new SolidColorBrush(Colors.DodgerBlue);
- //});
- if (APP.W_PracticeWindow == null)
- {
- APP.W_PracticeWindow = new PracticeWindow
- {
- //APP.W_PracticeWindow.Topmost = true;
- Width = pwidth,
- Height = pHeight,
- Left = 0,
- Top = 0
- };
- //practiceWin.Owner = this;
- }
- APP.W_PracticeWindow.InitPen();
- APP.W_PracticeWindow.InitTQLPPen();
- APP.W_PracticeWindow.Initialize();//imagePath);
- flg = 10;
- APP.W_PracticeWindow.Red();
- APP.W_PracticeWindow.Show();
-
-
- new Thread(new ThreadStart(new Action(() =>
- {
- Thread.Sleep(100);
- Dispatcher.Invoke(() =>
- {
- //Owner = APP.W_PracticeWindow;
- Topmost = true;
- });
- }))).Start();
-
-
- }
- }
- catch (Exception ex)
- {
- LogHelper.WriteErrLog("【批注(PracticeWindow)" + ex.Message, ex);
- }
- }
- /// <summary>
- /// 鼠标右键按下事件 废弃
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void RightButtonDown()
- {
- if (flg > 9)
- {
- Owner = null;
- APP.W_PracticeWindow.Hide();
- }
- else
- {
- //string time = GetTimeStamp();
- string tempPath = AppDomain.CurrentDomain.BaseDirectory + "temp\\";
- if (!Directory.Exists(tempPath))
- {
- Directory.CreateDirectory(tempPath);
- }
-
- #region 录屏批注取消画笔
- //string imagePath = Path.Combine(tempPath, time + ".jpg");
- //ImageHelper.GetScreenshot(new System.Drawing.Rectangle(0, 0, 0, 0), imagePath, true, out BitmapImage bitmap);
- #endregion
-
- try
- {
- if (APP.W_PracticeWindow == null)
- {
- APP.W_PracticeWindow = new PracticeWindow
- {
- //APP.W_PracticeWindow.Topmost = true;
- Width = pwidth,
- Height = pHeight,
- Left = 0,
- Top = 0
- };
- //practiceWin.Owner = this;
- }
- APP.W_PracticeWindow.InitPen();
- APP.W_PracticeWindow.InitTQLPPen();
- APP.W_PracticeWindow.Initialize();//imagePath);
-
- if (flg == 0)
- {
- flg = 10;
- APP.W_PracticeWindow.Red();
- }
- else
- {
- flg = 11;
- APP.W_PracticeWindow.Blue();
- }
- APP.W_PracticeWindow.Show();
- }
- catch (Exception ex)
- {
- LogHelper.WriteErrLog("【批注(PracticeWindow)" + ex.Message, ex);
- }
- }
- }
- /// <summary>
- /// 返回主界面
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void BtnReturn_Click(object sender, RoutedEventArgs e)
- {
- if (!IsFirstRS)
- {
- MessageBoxResult br = MessageWindow.Show("退出将取消保存当前录屏,是否继续?", "提示", MessageBoxButton.OKCancel);
- if (br == MessageBoxResult.Cancel)
- {
- return;
- }
- k_hook.Stop();
- BtnRecordingScreen.ToolTip = "开始";
- IsSuspend = true;
- TxbTime.Content = "00:00";
- End();
- APP.W_PracticeWindow.ReturnPractice();
- if (APP.W_PracticeWindow != null)
- {
- if (APP.W_PracticeWindow.Visibility == Visibility.Visible)
- {
- APP.W_PracticeWindow.Hide();
- }
- }
- if (gridToolbar.Visibility == Visibility.Visible)
- {
- gridToolbar.Visibility = Visibility.Hidden;
- gridColour.Visibility = Visibility.Hidden;
- gridThickness.Visibility = Visibility.Hidden;
- }
- if (APP.W_XHMicroLessonSystemWindow == null)
- {
- APP.W_XHMicroLessonSystemWindow = new XHMicroLessonSystemWindow();
- }
- try
- {
- try
- {
- APP.FFmpeg.SuspendFFmpeg();
- }
- catch (Exception ex)
- {
- LogHelper.WriteErrLog("【录屏返回】(BtnStopRecordingScreen_Click)" + ex.Message, ex);
- }
- IsFirstRS = true;
- new Thread(new ThreadStart(new Action(() =>
- {
- VideoInfo = null;
- FileToolsCommon.DeleteDirectory(APP.WKData.WkPath + "temprs/");
-
- }))).Start();
- }
- catch (Exception ex)
- {
- LogHelper.WriteErrLog("【录屏返回】(BtnStopRecordingScreen_Click)" + ex.Message, ex);
- }
- }
- APP.W_XHMicroLessonSystemWindow.InitializeKeyDownEvent();
- APP.W_XHMicroLessonSystemWindow.InitPen();
- APP.W_XHMicroLessonSystemWindow.InitTQLPPen();
- APP.W_XHMicroLessonSystemWindow.Show();
-
- new Thread(new ThreadStart(new Action(() =>
- {
- Thread.Sleep(700);
- Dispatcher.Invoke(() =>
- {
- if (APP.W_MinToolbar != null)
- {
- APP.W_MinToolbar.Hide();
- }
- });
- }))).Start();
- Hide();
- }
- /// <summary>
- /// 批注退出 废弃
- /// </summary>
- public void ReturnPractice()
- {
- new Thread(new ThreadStart(new Action(() =>
- {
- //Dispatcher.Invoke(() =>
- //{
- // borOne.Background = new SolidColorBrush(Colors.DodgerBlue);
- // borTwo.Background = new SolidColorBrush(Colors.DodgerBlue);
- //});
- flg = 0;
- Thread.Sleep(500);
- Dispatcher.Invoke(() =>
- {
- Owner = null;
- APP.W_PracticeWindow.Hide();
- });
- }))).Start();
- }
- /// <summary>
- /// 修改笔状态
- /// </summary>
- public void ModifyState()
- {
- BtnPenBlue.Visibility = Visibility.Visible;
- BtnPenRed.Visibility = Visibility.Visible;
- BtnPenBlue_CL.Visibility = Visibility.Collapsed;
- BtnPenRed_CL.Visibility = Visibility.Collapsed;
- //borOne.Background = new SolidColorBrush(Colors.DodgerBlue);
- //borTwo.Background = new SolidColorBrush(Colors.DodgerBlue);
- }
-
- /// <summary>
- /// 切换页面
- /// </summary>
- void SwitchPages()
- {
- //SendKeys.SendWait("%{TAB}");
- MouseEventCommon.MouseMiddleClickEvent(0);
- }
- //bool isToobar = false;
- /// <summary>
- /// 在工具条区域内
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void gridToobarTwo_MouseEnter(object sender, System.Windows.Input.MouseEventArgs e)
- {
- //isToobar = true;
- }
-
- private void gridToobarTwo_MouseLeave(object sender, System.Windows.Input.MouseEventArgs e)
- {
- //if (BtnRecordingScreen.ToolTip.ToString().Equals("暂停") && (gridToobar.Visibility == Visibility.Visible || BorderBlack.Visibility == Visibility.Visible))
- if(BtnRecordingScreenPause.Visibility == Visibility.Visible)
- {
- if (APP.IsHideSRTool)
- {
- if (APP.W_MinToolbar == null)
- {
- APP.W_MinToolbar = new MinToolbar();
-
- }
- APP.W_MinToolbar.Topmost = true;
- double MinToolTop = Top;
- //int ColorType = 0;
- //if (APP.SkinStyle == "1")
- //{
- // ColorType = 0;
- // MinToolTop = this.Top + ((this.ActualHeight - btnReturn.ActualHeight) / 2);
- //}
- //else if (APP.SkinStyle == "2")
- //{
- // ColorType = 1;
- // MinToolTop = this.Top + ((this.ActualHeight - VbxBlack.ActualHeight) / 2);
- //}
- new Thread(new ThreadStart(new Action(() =>
- {
- Thread.Sleep(500);
- Dispatcher.Invoke(() =>
- {
- MouseEventCommon.GetCursorPos(out MouseEventCommon.POINT pointRecord);
- if (pointRecord.X >= this.Left && pointRecord.X < this.Left + this.ActualWidth && pointRecord.Y >= this.Top && pointRecord.Y < this.Top + this.ActualHeight)
- {
- //LblMessage.Content = "在区域内:("+ pointRecord.X+","+pointRecord.Y+") ("+ Left + ","+Top+")";
- }
- else
- {
- //LblMessage.Content = "不在区域内:(" + pointRecord.X + "," + pointRecord.Y + ") (" + Left + "," + Top + ")";
- APP.W_MinToolbar.Initialize(MinToolTop, ActualHeight);
- GridSrToobar.Visibility = Visibility.Hidden;
- APP.W_MinToolbar.Show();
- }
- });
- }))).Start();
- }
- }
- }
- }
- }
|