12
12
using System . Collections . Generic ;
13
13
using System . Collections . ObjectModel ;
14
14
using System . Diagnostics ;
15
- using System . Globalization ;
16
15
using System . IO ;
17
16
using System . Linq ;
18
17
using System . Reflection ;
@@ -1389,21 +1388,7 @@ private void TreeViewItem_MouseDoubleClick(object sender, MouseButtonEventArgs e
1389
1388
}
1390
1389
else if ( Config . Instance . TextSourceOn == RegexTextSource . Excel )
1391
1390
{
1392
- var searchResult = regexResult ;
1393
- RegexExcelSheetResult excelSheetResult = null ;
1394
-
1395
- while ( searchResult != null )
1396
- {
1397
- if ( searchResult is RegexExcelSheetResult )
1398
- excelSheetResult = ( RegexExcelSheetResult ) searchResult ;
1399
- searchResult = searchResult . Parent ;
1400
- }
1401
-
1402
- if ( excelSheetResult != null )
1403
- {
1404
- string launchExcelVbsScriptPath = Path . Combine ( Path . GetDirectoryName ( Assembly . GetExecutingAssembly ( ) . Location ) , "LaunchExcelVbsScript.vbs" ) ;
1405
- Process . Start ( launchExcelVbsScriptPath , $ "\" { Config . Instance . TextSourceExcelPath } \" \" { excelSheetResult . SheetName } \" \" { regexResult . InfoSup } \" ") ;
1406
- }
1391
+ OpenCellInExcel ( regexResult ) ;
1407
1392
}
1408
1393
1409
1394
e . Handled = true ;
@@ -1430,28 +1415,33 @@ private void TreeViewItem_KeyDown(object sender, KeyEventArgs e)
1430
1415
}
1431
1416
else if ( Config . Instance . TextSourceOn == RegexTextSource . Excel )
1432
1417
{
1433
- var searchResult = regexResult ;
1434
- RegexExcelSheetResult excelSheetResult = null ;
1435
-
1436
- while ( searchResult != null )
1437
- {
1438
- if ( searchResult is RegexExcelSheetResult )
1439
- excelSheetResult = ( RegexExcelSheetResult ) searchResult ;
1440
- searchResult = searchResult . Parent ;
1441
- }
1442
-
1443
- if ( excelSheetResult != null )
1444
- {
1445
- string launchExcelVbsScriptPath = Path . Combine ( Path . GetDirectoryName ( Assembly . GetExecutingAssembly ( ) . Location ) , "LaunchExcelVbsScript.vbs" ) ;
1446
- Process . Start ( launchExcelVbsScriptPath , $ "\" { Config . Instance . TextSourceExcelPath } \" \" { excelSheetResult . SheetName } \" \" { regexResult . InfoSup } \" ") ;
1447
- }
1418
+ OpenCellInExcel ( regexResult ) ;
1448
1419
}
1449
1420
1450
1421
e . Handled = true ;
1451
1422
}
1452
1423
}
1453
1424
catch { }
1454
1425
}
1426
+
1427
+ private void OpenCellInExcel ( RegexResult regexResult )
1428
+ {
1429
+ var searchResult = regexResult ;
1430
+ RegexExcelSheetResult excelSheetResult = null ;
1431
+
1432
+ while ( searchResult != null )
1433
+ {
1434
+ if ( searchResult is RegexExcelSheetResult result )
1435
+ excelSheetResult = result ;
1436
+ searchResult = searchResult . Parent ;
1437
+ }
1438
+
1439
+ if ( excelSheetResult != null )
1440
+ {
1441
+ string launchExcelVbsScriptPath = Path . Combine ( Path . GetDirectoryName ( Assembly . GetExecutingAssembly ( ) . Location ) , "LaunchExcelVbsScript.vbs" ) ;
1442
+ Process . Start ( launchExcelVbsScriptPath , $ "\" { Config . Instance . TextSourceExcelPath } \" \" { excelSheetResult . SheetName } \" \" { regexResult . InfoSup } \" ") ;
1443
+ }
1444
+ }
1455
1445
1456
1446
private void RegexLanguageElement_StackPanel_MouseDown ( object sender , MouseButtonEventArgs e )
1457
1447
{
0 commit comments