Przeglądaj źródła

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

tags/录制修改前
耀 4 lat temu
rodzic
commit
e02cd055d9

+ 1
- 0
XHWK.WKTool/App.config Wyświetl plik

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

+ 1
- 1
XHWK.WKTool/App.cs Wyświetl plik

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

+ 2
- 3
XHWK.WKTool/XHMicroLessonSystemWindow.xaml Wyświetl plik

@@ -148,7 +148,7 @@
148 148
             <RowDefinition Height="85*"/>
149 149
             <RowDefinition Height="5*"/>
150 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 152
             <Grid.RowDefinitions>
153 153
                 <RowDefinition Height="auto"/>
154 154
                 <RowDefinition Height="auto"/>
@@ -258,8 +258,6 @@
258 258
                     </StackPanel>
259 259
                 </Button>
260 260
             </StackPanel>
261
-
262
-
263 261
         </Grid>
264 262
 
265 263
         <!--主内容-->
@@ -322,6 +320,7 @@
322 320
             <Label Content="" Grid.Column="1" Height="2" Width="2" Background="#FF0F0F0F" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0,0,16,0"/>
323 321
             <Label Content="" Grid.Column="0" Height="2" Width="2" Background="#FF0F0F0F" HorizontalAlignment="Left" VerticalAlignment="Bottom" Margin="1,0,0,0"/>
324 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 324
         </Grid>
326 325
         <!--页码-->
327 326
         <Grid Grid.Row="1" x:Name="gridPage" Visibility="Collapsed">

+ 59
- 25
XHWK.WKTool/XHMicroLessonSystemWindow.xaml.cs Wyświetl plik

@@ -82,6 +82,7 @@ namespace XHWK.WKTool
82 82
         /// 计时用
83 83
         /// </summary>
84 84
         private TimeSpan _timeSpan = new TimeSpan(0, 0, 0, 0, 0);
85
+
85 86
         #region 上传
86 87
         /// <summary>
87 88
         /// 视频模型
@@ -884,6 +885,7 @@ namespace XHWK.WKTool
884 885
             try
885 886
             {
886 887
                 Record();
888
+                HideAngleBorder();
887 889
                 string desktopPath = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
888 890
                 ofd = new System.Windows.Forms.OpenFileDialog
889 891
                 {
@@ -1767,6 +1769,15 @@ namespace XHWK.WKTool
1767 1769
         /// 是否录制了音频
1768 1770
         /// </summary>
1769 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 1781
         #endregion
1771 1782
 
1772 1783
         #region 录屏
@@ -1899,8 +1910,6 @@ namespace XHWK.WKTool
1899 1910
             EndRecord();
1900 1911
         }
1901 1912
 
1902
-        private System.Timers.Timer timer;
1903
-
1904 1913
         /// <summary>
1905 1914
         /// 设置录屏文件地址
1906 1915
         /// </summary>
@@ -1961,15 +1970,16 @@ namespace XHWK.WKTool
1961 1970
                     #endregion
1962 1971
 
1963 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 1983
                     txbTime.Visibility = Visibility.Visible;
1974 1984
                     #endregion
1975 1985
 
@@ -2079,12 +2089,14 @@ namespace XHWK.WKTool
2079 2089
                     #endregion
2080 2090
                     IsFirstR = false;
2081 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,7 +2132,7 @@ namespace XHWK.WKTool
2120 2132
                         Dispatcher.Invoke(() =>
2121 2133
                         {
2122 2134
                             IsStartCount = true;
2123
-                            Stack();
2135
+                            //Stack();
2124 2136
                             //timer.Start();
2125 2137
                         });
2126 2138
                     }))).Start();
@@ -2138,7 +2150,7 @@ namespace XHWK.WKTool
2138 2150
                 ImgStop.Visibility = Visibility.Visible;
2139 2151
                 ImgStopTwo.Visibility = Visibility.Collapsed;
2140 2152
                 TxbRecordingWord.Text = "继续";
2141
-                TimeOut();
2153
+                //TimeOut();
2142 2154
                 #region 2秒内不可点击
2143 2155
                 new Thread(new ThreadStart(new Action(() =>
2144 2156
                 {
@@ -2177,8 +2189,7 @@ namespace XHWK.WKTool
2177 2189
         /// 录制保存图片
2178 2190
         /// </summary>
2179 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 2194
             if (IsStartCount)
2184 2195
             {
@@ -2187,8 +2198,17 @@ namespace XHWK.WKTool
2187 2198
                     Dispatcher.Invoke(() =>
2188 2199
                     {
2189 2200
                         string FilePathName = ImgPath + RsImgName.Count + ".png";
2190
-                        ImageHelper.SaveUIToImage(GridMain, FilePathName, (int)ActualWidth, (int)ActualHeight);
2191 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 2214
                 catch (Exception ex)
@@ -2241,7 +2261,7 @@ namespace XHWK.WKTool
2241 2261
                 ImgRecord.Source = new BitmapImage(new Uri("pack://application:,,,/Images/microLessonSystem_14.png"));
2242 2262
                 ImgStop.Visibility = Visibility.Visible;
2243 2263
                 ImgStopTwo.Visibility = Visibility.Collapsed;
2244
-                TimeOut();
2264
+                //TimeOut();
2245 2265
                 txbType.Text = "保存中";
2246 2266
                 #region 2秒内不可点击
2247 2267
                 new Thread(new ThreadStart(new Action(() =>
@@ -2298,8 +2318,9 @@ namespace XHWK.WKTool
2298 2318
                         Dispatcher.Invoke(() =>
2299 2319
                         {
2300 2320
                             IsStartCount = false;
2301
-                            timer.Stop();
2302
-                            End();
2321
+                            timer.Change(-1, 0);
2322
+                            timer.Dispose();
2323
+                                    //End();
2303 2324
                             txbTime.Text = "";
2304 2325
                             txbTime.Visibility = Visibility.Hidden;
2305 2326
                         });
@@ -3911,6 +3932,19 @@ namespace XHWK.WKTool
3911 3932
             float x = PrimaryScreen.ScaleX;
3912 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
 }

Ładowanie…
Anuluj
Zapisz