|
public static int Main(string[] args)' U# h: T E& z. q# ? O& W
{
: [+ k$ N t% P8 s/ w& u2 J& x int retValue = 0;
* L5 B3 s6 o$ I% S( g) p/ {+ T try8 {( f6 [# @# t; w
{5 a- h, C' l) B$ C
theProgram = new Program();" n5 l6 u$ g( f* W4 U% B; S
Part dispPart = theSession.Parts.Display;3 ~) V+ S4 _0 E. p4 g
string filePath = dispPart.FullPath;//获得文件全路径
, l0 ]" G: b7 W8 G/ Y; y //UI.GetUI().NXMessageBox.Show("Message", NXMessageBox.DialogType.Information, str);
; H$ w& K3 ^- B4 \0 B5 A ProcessStartInfo psi = new ProcessStartInfo("Explorer.exe");//还是调用进程打开文件夹- _) \- k* Y% E: |
psi.Arguments = "/e,/select," + filePath;- v! V1 V f6 o2 Y/ ~/ D# B$ A
Process p;
$ @% A/ z! X4 o$ o5 ]: ^ p=Process.Start(psi);//启动进程打开
2 K3 o. @# t% o8 [ //TODO: Add your application code here 1 L2 ?) {: r4 J! D- O
p.WaitForInputIdle(2000);//等2秒钟; m5 _8 z, `0 J. Y' d s
//p.Kill();
: T" Z0 b7 F) _1 `) [5 o theProgram.Dispose();
5 ~- k- h1 q9 a D' X) } Z5 o }9 K: O$ J* E! f% i2 X8 ^$ O
catch (NXOpen.NXException ex)
% T N+ T2 a/ |! L {" i# A9 }- c/ `- k, z7 m/ ]
// ---- Enter your exception handling code here -----
5 ?8 n# [. V- T) E8 y
* h/ y+ p! I0 U% v* } n+ R5 w2 i }
9 l' O, i: e* D# G9 o return retValue;
$ ^% U4 v$ L9 ] } |
|