|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
4 f6 `# I+ c/ t/ y
" {5 E* I' O4 k1 b" f
NX二次开发源码分享:自定义yes或者no的确认对话框
3 R/ e3 n; |, f4 w
: w/ J% D, u5 S; @: t9 S- _static bool AskYesOrNo(string title, string message)& Q' z/ b! l r% g' v0 S0 C
{, D% t9 L( V- q- x) e- C
string[] messages = { message };% i& H4 |0 V$ F5 [7 H& ^
UFUi.MessageButtons buttons = default(UFUi.MessageButtons);; n' x4 O) Z V6 R% H
buttons.button1 = true;6 j+ ~4 L `* ]* }
buttons.button2 = false;- H2 K; f4 j# i$ y8 Q1 u1 e' d
buttons.button3 = true; J/ q$ u, G* T. Z0 e s5 S
buttons.label1 = "Yes";1 x$ [; e8 B9 x. g
buttons.label2 = null;
: ~1 a0 F) Z8 z7 d! {* q6 _, X% ^ buttons.label3 = "No";
4 o c- E8 l. C ~/ W2 y& x buttons.response1 = 1;, P$ V0 c c2 Q; x* x4 R2 C4 Y
buttons.response2 = 0; C& B; `) G' J3 R; C, F
buttons.response3 = 2;
9 ^, y8 O7 ^% V3 e int resp = 0;
7 M* v9 c6 N" k; q
8 h5 k1 R* ^% p8 a$ `, D theUFSession.Ui.LockUGAccess(UFConstants.UF_UI_FROM_CUSTOM);
$ i' \; D$ q8 R$ u2 F5 @ theUFSession.Ui.MessageDialog(title, UiMessageDialogType.UiMessageQuestion, 4 O- Y0 S" B7 v4 g6 T% O5 F* y( D# r
messages, 1, true, ref buttons, out resp);7 @/ p+ o3 e2 Q* v
theUFSession.Ui.UnlockUgAccess(UFConstants.UF_UI_FROM_CUSTOM);. } N: }" ~2 `9 }9 u
7 s3 @. @2 s& g1 W# p if (resp == 1)
* U4 Q9 C4 |1 y1 h: Q$ w& |3 F- Q0 X return true;
- N0 H; Z6 c5 J& p else
$ d5 Z5 j; X3 [. S+ D& \ return false;' l, E9 G" |& x. `8 V7 K
}
7 l j- C3 P( I/ v2 W! p, \0 I
* W5 s7 e5 Q( L' I& Z( z
7 t) l! q* q0 m, p- l |
|