protected override void Execute(CodeActivityContext context) { try { string _title = TitleTextBox.Get(context); string _textValue = LabelTextBox.Get(context); string[] _listItem = OptionsTextBox.Get(context); string _resultValue = null; latch = new CountdownEvent(1); Thread td = new Thread(() => { DialogActivity.Windows.InputDialogWindow dlg = new DialogActivity.Windows.InputDialogWindow(); if (_title != null) { dlg.Title = _title; } if (_textValue != null) { dlg.setTextContent(_textValue); } if (_listItem != null) { if (_listItem.Length <= 1) { dlg.CreateEditBox(IsPassword); } else if (_listItem.Length > 1 && _listItem.Length < 4) { dlg.CreateCheckBox(_listItem); } else { dlg.CreateCombobox(_listItem); } } else { dlg.CreateEditBox(IsPassword); } dlg.ShowDialog(); _resultValue = dlg.getValue(); dlg.Close(); refreshData(latch); }); td.TrySetApartmentState(ApartmentState.STA); td.IsBackground = true; td.Start(); latch.Wait(); Result.Set(context, _resultValue); } catch (Exception e) { SharedObject.Instance.Output(SharedObject.enOutputType.Error, "有一个错误产生", e.Message); } }