|
public static int Main(string[] args)
' Y: n# `6 Y4 f7 Y {+ W$ q$ ~/ o! g# s( I3 o# U4 t$ j
int retValue = 0;
8 N. f4 j' m3 B! W. u9 n7 g try7 Y% ]8 u/ Z( C) E/ n9 @3 P# ?( w2 q
{3 B" `5 o) j0 q( h) |
theProgram = new Program();6 v& \8 ?( G7 U/ ?: B- K
Part dispPart = theSession.Parts.Display;
; [9 a8 }+ l$ s string filePath = dispPart.FullPath;//获得文件全路径
r( p+ ^7 {1 c" ~6 n" g //UI.GetUI().NXMessageBox.Show("Message", NXMessageBox.DialogType.Information, str);
9 j* R: o" C. N; K" \. P ProcessStartInfo psi = new ProcessStartInfo("Explorer.exe");//还是调用进程打开文件夹- g. s' F# L' N0 |
psi.Arguments = "/e,/select," + filePath;
& X/ R( B8 c: I Process p;
+ R( H# S" K3 ^$ V: E p=Process.Start(psi);//启动进程打开
; R7 j& y* |* k4 Y( T1 b1 i& d //TODO: Add your application code here
3 K8 {8 \) Z( ]4 j$ } p.WaitForInputIdle(2000);//等2秒钟
& J0 T, Z; c6 e, ^# `' \ //p.Kill();
, w6 |/ u9 j9 t theProgram.Dispose();+ D% B/ s+ l) d
}
Z3 O& O7 j! R5 v# p) T, H4 W. R catch (NXOpen.NXException ex)! f; @# v; \$ e- P' G& Q1 l+ M
{
C8 Y f8 _- o // ---- Enter your exception handling code here -----1 y- u; u# a# b t( f/ R
- m( S1 N. A# H. X }
# T+ w0 A4 @9 J1 k9 R9 V/ x return retValue;
@3 t4 I1 X0 c8 [/ ?/ f } |
|