/// <summary> /// Open the form and get a return value. /// </summary> /// <param name="context"></param> protected override void DoWork(CodeActivityContext context) { MultiOptionMessageBoxStyleEnum style = (Style.Expression != null) ? Style.Get(context) : MultiOptionMessageBoxStyleEnum.DropDown; bool showCancelButton = (ShowCancelButton.Expression != null) ? ShowCancelButton.Get(context) : true; string windowTitle = String.IsNullOrEmpty(Caption.Get(context)) ? " " : Caption.Get(context); List <string> items = Items.Get(context); string message = Message.Get(context); string values = String.Empty; foreach (string str in items) { if (items.IndexOf(str) != 0) { values += ", "; } values += str; } Track("Items", values); DialogResult result; if (style == MultiOptionMessageBoxStyleEnum.DropDown) { var form = new MultiOptionDropDownForm { Choices = items, Text = windowTitle, Message = message, ShowCancelButton = showCancelButton }; result = form.ShowDialog(); if (result == System.Windows.Forms.DialogResult.OK) { SelectedIndex.Set(context, form.SelectedIndex); SelectedText.Set(context, form.SelectedText); } DialogResult.Set(context, result); } else { var form = new MultiOptionButtonForm { Choices = items, Text = windowTitle, Message = message, ShowCancelButton = showCancelButton }; result = form.ShowDialog(); if (result == System.Windows.Forms.DialogResult.OK) { SelectedIndex.Set(context, form.SelectedIndex); SelectedText.Set(context, form.SelectedText); } DialogResult.Set(context, result); } }