- public class Class1
- {
- private static FormMain MyForm = null;//此处是关键
- [CommandMethod("LoadWin")]
- static public void LoadWin()
- {
- if (MyForm == null) { MyForm = new FormMain(); }
- MyForm.Show();
- MyForm.TextBox1.Text = "001";
- MyForm.TextBox2.Text = "002";
- }
- [LispFunction("GetVal")]
- public static ResultBuffer GetVal(ResultBuffer resBufIn)
- {
- if (MyForm == null)
- {
- return new ResultBuffer(new TypedValue((int)LispDataType.Nil));
- }
- else
- {
- return new ResultBuffer(new TypedValue((int)LispDataType.Int32, MyForm.TextBox1.Text));
- }
- }
- [LispFunction("CloseMyForm")]
- public static ResultBuffer CloseMyForm(ResultBuffer resBufIn)
- {
- if (MyForm != null)
- {
- MyForm.Close();
- }
- return new ResultBuffer(new TypedValue((int)LispDataType.T_atom, true));
- }
- }
|