@@ -50,21 +50,16 @@ private void Initialize()
5050 _modernProcessor = new ModernInkProcessor ( ) ;
5151 _modernAnalyzer = new ModernInkAnalyzer ( ) ;
5252 _isModernSystemAvailable = true ;
53- LogHelper . WriteLogToFile (
54- $ "墨迹识别管理器:使用现代化墨迹识别系统 (WinRT) - 进程64位: { Environment . Is64BitProcess } , OS64位: { Environment . Is64BitOperatingSystem } ") ;
5553 }
5654 catch ( Exception ex )
5755 {
58- LogHelper . WriteLogToFile ( "WinRT API不可用,回退到IACore : " + ex . Message , LogHelper . LogType . Warning ) ;
56+ LogHelper . WriteLogToFile ( "WinRT 墨迹初始化失败 : " + ex . Message , LogHelper . LogType . Warning ) ;
5957 _isModernSystemAvailable = false ;
6058 _modernProcessor = null ;
6159 _modernAnalyzer = null ;
6260 }
6361 }
6462
65- if ( ! _isModernSystemAvailable )
66- LogHelper . WriteLogToFile ( "墨迹识别管理器:使用IACore墨迹识别系统" ) ;
67-
6863 _isInitialized = true ;
6964 }
7065 catch ( Exception ex )
@@ -86,7 +81,7 @@ public Task<InkShapeRecognitionResult> RecognizeShapeAsync(
8681 if ( ShapeRecognitionRouter . ResolveUseWinRt ( mode )
8782 && WinRtInkShapeRecognizer . IsApiAvailable )
8883 {
89- return RunWinRtOrLogAsync ( strokes ) ;
84+ return RecognizeShapeWinRtOnDispatcherContext ( strokes ) ;
9085 }
9186
9287 var legacy = InkRecognizeHelper . RecognizeShapeIACore ( strokes ) ;
@@ -99,17 +94,10 @@ public Task<InkShapeRecognitionResult> RecognizeShapeAsync(
9994 }
10095 }
10196
102- private static async Task < InkShapeRecognitionResult > RunWinRtOrLogAsync ( StrokeCollection strokes )
97+ private static async Task < InkShapeRecognitionResult > RecognizeShapeWinRtOnDispatcherContext (
98+ StrokeCollection strokes )
10399 {
104- try
105- {
106- return await WinRtInkShapeRecognizer . RecognizeShapeAsync ( strokes ) . ConfigureAwait ( true ) ;
107- }
108- catch ( Exception ex )
109- {
110- LogHelper . WriteLogToFile ( "WinRT 墨迹形状识别异常: " + ex , LogHelper . LogType . Error ) ;
111- return InkShapeRecognitionResult . Empty ;
112- }
100+ return await WinRtInkShapeRecognizer . RecognizeShapeAsync ( strokes ) . ConfigureAwait ( true ) ;
113101 }
114102
115103 public Task < StrokeCollection > CorrectInkAsync (
0 commit comments