Browse Source

zhao:1修改测试配置 2解决导入无法取消截图拉伸边框 3修改录制定时器

tags/录制修改前
耀 4 years ago
parent
commit
e02cd055d9

+ 1
- 0
XHWK.WKTool/App.config View File

4
         <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
4
         <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
5
     </startup>
5
     </startup>
6
   <appSettings>
6
   <appSettings>
7
+    <add key="IsDebug" value="1"/>
7
     <!--图片压缩等级-->
8
     <!--图片压缩等级-->
8
     <add key="ImageCompressionLevel" value="30" />
9
     <add key="ImageCompressionLevel" value="30" />
9
     <!--文件存放路径  路径\账户名\讲解名称_x.MP4-->
10
     <!--文件存放路径  路径\账户名\讲解名称_x.MP4-->

+ 1
- 1
XHWK.WKTool/App.cs View File

23
         /// <summary>
23
         /// <summary>
24
         /// 是否为测试版
24
         /// 是否为测试版
25
         /// </summary>
25
         /// </summary>
26
-        public static bool isDebug = false;
26
+        public static bool isDebug =FileToolsCommon.GetConfigValue("IsDebug")!="0";
27
         /// <summary>
27
         /// <summary>
28
         /// 接口地址
28
         /// 接口地址
29
         /// </summary>
29
         /// </summary>

+ 2
- 3
XHWK.WKTool/XHMicroLessonSystemWindow.xaml View File

148
             <RowDefinition Height="85*"/>
148
             <RowDefinition Height="85*"/>
149
             <RowDefinition Height="5*"/>
149
             <RowDefinition Height="5*"/>
150
         </Grid.RowDefinitions>
150
         </Grid.RowDefinitions>
151
-        <Grid Grid.Row="0" Background="#2D8CF0" MouseLeftButtonDown="Window_MouseLeftButtonDown" Margin="0,0,0,0" MinHeight="100px">
151
+        <Grid Grid.Row="0" Background="#2D8CF0" MouseLeftButtonDown="Window_MouseLeftButtonDown" Margin="0,0,0,0" MinHeight="100px" MouseDown="Grid_MouseDown">
152
             <Grid.RowDefinitions>
152
             <Grid.RowDefinitions>
153
                 <RowDefinition Height="auto"/>
153
                 <RowDefinition Height="auto"/>
154
                 <RowDefinition Height="auto"/>
154
                 <RowDefinition Height="auto"/>
258
                     </StackPanel>
258
                     </StackPanel>
259
                 </Button>
259
                 </Button>
260
             </StackPanel>
260
             </StackPanel>
261
-
262
-
263
         </Grid>
261
         </Grid>
264
 
262
 
265
         <!--主内容-->
263
         <!--主内容-->
322
             <Label Content="" Grid.Column="1" Height="2" Width="2" Background="#FF0F0F0F" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0,0,16,0"/>
320
             <Label Content="" Grid.Column="1" Height="2" Width="2" Background="#FF0F0F0F" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0,0,16,0"/>
323
             <Label Content="" Grid.Column="0" Height="2" Width="2" Background="#FF0F0F0F" HorizontalAlignment="Left" VerticalAlignment="Bottom" Margin="1,0,0,0"/>
321
             <Label Content="" Grid.Column="0" Height="2" Width="2" Background="#FF0F0F0F" HorizontalAlignment="Left" VerticalAlignment="Bottom" Margin="1,0,0,0"/>
324
             <Label Content="" Grid.Column="1" Height="2" Width="2" Background="#FF0F0F0F" HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="0,0,16,0"/>
322
             <Label Content="" Grid.Column="1" Height="2" Width="2" Background="#FF0F0F0F" HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="0,0,16,0"/>
323
+            <!--<TextBlock x:Name="txbTime" Text="123456" FontSize="20" Foreground="#000000" Margin="0,0,0,10" HorizontalAlignment="Left" VerticalAlignment="Bottom"/>-->
325
         </Grid>
324
         </Grid>
326
         <!--页码-->
325
         <!--页码-->
327
         <Grid Grid.Row="1" x:Name="gridPage" Visibility="Collapsed">
326
         <Grid Grid.Row="1" x:Name="gridPage" Visibility="Collapsed">

+ 59
- 25
XHWK.WKTool/XHMicroLessonSystemWindow.xaml.cs View File

82
         /// 计时用
82
         /// 计时用
83
         /// </summary>
83
         /// </summary>
84
         private TimeSpan _timeSpan = new TimeSpan(0, 0, 0, 0, 0);
84
         private TimeSpan _timeSpan = new TimeSpan(0, 0, 0, 0, 0);
85
+
85
         #region 上传
86
         #region 上传
86
         /// <summary>
87
         /// <summary>
87
         /// 视频模型
88
         /// 视频模型
884
             try
885
             try
885
             {
886
             {
886
                 Record();
887
                 Record();
888
+                HideAngleBorder();
887
                 string desktopPath = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
889
                 string desktopPath = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
888
                 ofd = new System.Windows.Forms.OpenFileDialog
890
                 ofd = new System.Windows.Forms.OpenFileDialog
889
                 {
891
                 {
1767
         /// 是否录制了音频
1769
         /// 是否录制了音频
1768
         /// </summary>
1770
         /// </summary>
1769
         private bool IsRecordAudio = false;
1771
         private bool IsRecordAudio = false;
1772
+
1773
+        /// <summary>
1774
+        /// 截图定时器
1775
+        /// </summary>
1776
+        private System.Threading.Timer timer;
1777
+        /// <summary>
1778
+        /// 录制计时
1779
+        /// </summary>
1780
+        private DateTime SRTime = DateTime.Now;
1770
         #endregion
1781
         #endregion
1771
 
1782
 
1772
         #region 录屏
1783
         #region 录屏
1899
             EndRecord();
1910
             EndRecord();
1900
         }
1911
         }
1901
 
1912
 
1902
-        private System.Timers.Timer timer;
1903
-
1904
         /// <summary>
1913
         /// <summary>
1905
         /// 设置录屏文件地址
1914
         /// 设置录屏文件地址
1906
         /// </summary>
1915
         /// </summary>
1961
                     #endregion
1970
                     #endregion
1962
 
1971
 
1963
                     #region 计时器初始化
1972
                     #region 计时器初始化
1964
-                    if (t == null)
1965
-                    {
1966
-                        t = new DispatcherTimer();
1967
-                        t.Tick += OnTimer;
1968
-                        t.Interval = new TimeSpan(0, 0, 0, 1);
1969
-                        t.IsEnabled = true;
1970
-                        t.Start();
1971
-                    }
1972
-                    t.Interval = new TimeSpan(0, 0, 0, 1);
1973
+                    
1974
+                    //if (t == null)
1975
+                    //{
1976
+                    //    t = new DispatcherTimer();
1977
+                    //    t.Tick += OnTimer;
1978
+                    //    t.Interval = new TimeSpan(0, 0, 0, 1);
1979
+                    //    t.IsEnabled = true;
1980
+                    //    t.Start();
1981
+                    //}
1982
+                    //t.Interval = new TimeSpan(0, 0, 0, 1);
1973
                     txbTime.Visibility = Visibility.Visible;
1983
                     txbTime.Visibility = Visibility.Visible;
1974
                     #endregion
1984
                     #endregion
1975
 
1985
 
2079
                     #endregion
2089
                     #endregion
2080
                     IsFirstR = false;
2090
                     IsFirstR = false;
2081
                     RsImgName = new List<string>();
2091
                     RsImgName = new List<string>();
2082
-                    timer = new System.Timers.Timer(200)
2083
-                    {
2084
-                        AutoReset = true//设置是否执行System.Timers.Timer.Elapsed事件
2085
-                    };//设置执行一次(false)还是一直执行(true)
2086
-                    timer.Elapsed += new System.Timers.ElapsedEventHandler(Timer_Elapsed);
2087
-                    timer.Enabled = true; //启动计时器
2092
+                    ///启动截图
2093
+                    timer = new System.Threading.Timer(new TimerCallback(Timer_Elapsed), null, 0, 200);
2094
+                    SRTime = Convert.ToDateTime("2020-01-01 00:00:00");
2095
+                    //{
2096
+                    //    AutoReset = true//设置是否执行System.Timers.Timer.Elapsed事件
2097
+                    //};//设置执行一次(false)还是一直执行(true)
2098
+                    //timer.Elapsed += new System.Timers.ElapsedEventHandler(Timer_Elapsed);
2099
+                    //timer.Enabled = true; //启动计时器
2088
                 }
2100
                 }
2089
 
2101
 
2090
                 //继续录制
2102
                 //继续录制
2120
                         Dispatcher.Invoke(() =>
2132
                         Dispatcher.Invoke(() =>
2121
                         {
2133
                         {
2122
                             IsStartCount = true;
2134
                             IsStartCount = true;
2123
-                            Stack();
2135
+                            //Stack();
2124
                             //timer.Start();
2136
                             //timer.Start();
2125
                         });
2137
                         });
2126
                     }))).Start();
2138
                     }))).Start();
2138
                 ImgStop.Visibility = Visibility.Visible;
2150
                 ImgStop.Visibility = Visibility.Visible;
2139
                 ImgStopTwo.Visibility = Visibility.Collapsed;
2151
                 ImgStopTwo.Visibility = Visibility.Collapsed;
2140
                 TxbRecordingWord.Text = "继续";
2152
                 TxbRecordingWord.Text = "继续";
2141
-                TimeOut();
2153
+                //TimeOut();
2142
                 #region 2秒内不可点击
2154
                 #region 2秒内不可点击
2143
                 new Thread(new ThreadStart(new Action(() =>
2155
                 new Thread(new ThreadStart(new Action(() =>
2144
                 {
2156
                 {
2177
         /// 录制保存图片
2189
         /// 录制保存图片
2178
         /// </summary>
2190
         /// </summary>
2179
         /// <param name="sender"></param>
2191
         /// <param name="sender"></param>
2180
-        /// <param name="e"></param>
2181
-        private void Timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
2192
+        private void Timer_Elapsed(object sender)
2182
         {
2193
         {
2183
             if (IsStartCount)
2194
             if (IsStartCount)
2184
             {
2195
             {
2187
                     Dispatcher.Invoke(() =>
2198
                     Dispatcher.Invoke(() =>
2188
                     {
2199
                     {
2189
                         string FilePathName = ImgPath + RsImgName.Count + ".png";
2200
                         string FilePathName = ImgPath + RsImgName.Count + ".png";
2190
-                        ImageHelper.SaveUIToImage(GridMain, FilePathName, (int)ActualWidth, (int)ActualHeight);
2191
                         RsImgName.Add(FilePathName);
2201
                         RsImgName.Add(FilePathName);
2202
+                        ImageHelper.SaveUIToImage(GridMain, FilePathName, (int)ActualWidth, (int)ActualHeight);
2203
+                        SRTime=SRTime.AddMilliseconds(200);
2204
+                        if (SRTime.Hour > 0)
2205
+                        {
2206
+                            txbTime.Text = SRTime.ToString("HH:mm:ss");
2207
+                        }
2208
+                        else
2209
+                        {
2210
+                            txbTime.Text = SRTime.ToString("mm:ss");
2211
+                        }
2192
                     });
2212
                     });
2193
                 }
2213
                 }
2194
                 catch (Exception ex)
2214
                 catch (Exception ex)
2241
                 ImgRecord.Source = new BitmapImage(new Uri("pack://application:,,,/Images/microLessonSystem_14.png"));
2261
                 ImgRecord.Source = new BitmapImage(new Uri("pack://application:,,,/Images/microLessonSystem_14.png"));
2242
                 ImgStop.Visibility = Visibility.Visible;
2262
                 ImgStop.Visibility = Visibility.Visible;
2243
                 ImgStopTwo.Visibility = Visibility.Collapsed;
2263
                 ImgStopTwo.Visibility = Visibility.Collapsed;
2244
-                TimeOut();
2264
+                //TimeOut();
2245
                 txbType.Text = "保存中";
2265
                 txbType.Text = "保存中";
2246
                 #region 2秒内不可点击
2266
                 #region 2秒内不可点击
2247
                 new Thread(new ThreadStart(new Action(() =>
2267
                 new Thread(new ThreadStart(new Action(() =>
2298
                         Dispatcher.Invoke(() =>
2318
                         Dispatcher.Invoke(() =>
2299
                         {
2319
                         {
2300
                             IsStartCount = false;
2320
                             IsStartCount = false;
2301
-                            timer.Stop();
2302
-                            End();
2321
+                            timer.Change(-1, 0);
2322
+                            timer.Dispose();
2323
+                                    //End();
2303
                             txbTime.Text = "";
2324
                             txbTime.Text = "";
2304
                             txbTime.Visibility = Visibility.Hidden;
2325
                             txbTime.Visibility = Visibility.Hidden;
2305
                         });
2326
                         });
3911
             float x = PrimaryScreen.ScaleX;
3932
             float x = PrimaryScreen.ScaleX;
3912
             float y = PrimaryScreen.ScaleY;
3933
             float y = PrimaryScreen.ScaleY;
3913
         }
3934
         }
3935
+        /// <summary>
3936
+        /// 点击标题栏 隐藏截图的四个点和线
3937
+        /// </summary>
3938
+        /// <param name="sender"></param>
3939
+        /// <param name="e"></param>
3940
+        private void Grid_MouseDown(object sender, MouseButtonEventArgs e)
3941
+        {
3942
+            HideAngleBorder();
3943
+        }
3914
 
3944
 
3945
+        private void Button_Click_1(object sender, RoutedEventArgs e)
3946
+        {
3947
+            Thread.Sleep(2000);
3948
+        }
3915
     }
3949
     }
3916
 }
3950
 }

Loading…
Cancel
Save