2015-06-22 81 views
2

我打电话给一个表格MyForm。在我的课上,我有if-else报表。我想关闭所有进程。我需要看起来像如何关闭类代码的过程?

element.close(); 

例子,我的代码的命令:

if (_condition a_) 
{ 
    //operations class; 
} 

if(_condition b_) 
{ 
    //abort all, and close all; 
} 

,如果我在形式上我不是我应该怎么办?我会通过我班的代码关闭所有循环。

回答

2

您可以使用FormRun类开始您的表单,然后使用formRun.close()再次关闭它。请记住,当您希望表单保持打开状态并等待用户的操作时,请致电formRun.wait()。

static void openCloseForm(Args _args) 
{ 
    FormRun formRun; 
    Args args = new Args();  

    args.name(formstr(MyForm)); 

    formRun = ClassFactory.formRunClass(args); 
    formRun.init(); 
    formRun.run(); 

    if (_condition a_) 
    { 
     //operations class before user input; 
     formRun.wait(); 
     //operations class after user input; 
    } 
    if(_condition b_) 
    { 
     formRun.close(); 
    } 
} 
+0

good @TinavanderVyver! – ulisses