I am looking to develop a program that contains a script that a call center person could use. I would like it to start with some set of basic fields/questions (Name, Phone, Why are you calling) and then update the available fields/questions based on the answers to the previous questions.
For example:
Start with the fields/questions of Name, Phone and Why are you calling (possible answers would be “schedule appointment”, “cancel appointment”, “office call”). Once the caller answered the “Why are you calling question” additional fields would be displayed. These additional fields would be dependent upon the answer given. If the caller was calling for an appointment then a calendar might be displayed, if calling to cancel then any existing appointments would be shown, etc.
Unfortunately, I have no idea how to go about this. I think XML might be the way to go so that I can store the field/question data in a tree like structure but not sure if that will work.
Has anyone done anything similar that could offer some guidance? I will be doing this using C# and WPF.
Thanks in advance,
Brian
You’re describing a simple workflow. There are a number of approaches to this, depending on the complexity.
The simplest option might be to use the VisualStateManager to display a group of fields depending on a static list of “call reasons.” Set the visual state of the form when the call reason is selected from the dropdown.
If you need to be able to design a data-driven workflow where there are multiple paths and screens, you should consider a wizard-style interface in which the user navigates through pages. The next page that appears is dependent on the answers in the previous page.
If you need a complex workflow that you need to be able to update visually, consider Windows Workflow Foundation (WF.) The WF editor is hostable in a WPF application, which would allow superusers to design new workflows.
Look in to PRISM, also known as the Composite Application Library, for information on how to dynamically compose an application. Prism will allow you to build views that can be injected into a UserControl at runtime, depending on business logic.