Estimated Completion Time: 8 hrs
Objective: Create your own AF applet for end users to be able to:
- Select the PI AF server they want to connect to.
- Select the city to view its attributes.
- Choose one of the 6 attributes to view the data.
- Choose the UOM.
- Specify the start time and end time.
- Choose the retrieval method (Recorded, Interpolated, or Summary).
- If the selected method is Interpolated, the user must choose the interval for the interpolation.
- If the selected method is Summary, the results will be shown using the default UOM, for the entire time range, and be time-weighted.
- If the user clicks on Get Data, the results/values should appear on the ListBox with the selected UOM.
- If the user clicks on View Element Settings, another form with the settings of the selected city/element would appear.
IMPORTANT TIP: To find help on the AF UI controls, search your local drives at %PIHOME%\help\AFUIRef.chm.
You should develop something similar to the screenshots below. It does not have to look exactly as shown. The more adventurous may choose to use a DataGridView instead of a ListBox:
The above was for Recorded Values, so you will note that the Interval combo box appears disabled. Below is for Interpolated, and you will note that Interval combo box is enabled.
Both of the previous 2 examples use 2 columns in the list box to display values. For Summary, there is an extra column in the ListBox in order to show which summary type is being displayed. The Summary is time-weighted and aggregates for the full timerange.
Finally, here's a shot of viewing AF properties when the user clicks on "View Element Settings".
Remember that your application should handle all types of errors (example: Invalid StartTime or EndTime, City element not selected when clicking on Get Data, etc.)
Tip: The following objects should be used in this exercise:
About the Interval ComboBox:
Feel free to make something suitable for your company needs. Example code used in the above screenshots:
private void FillIntervalPicks()
cboxInterval.SelectedIndex = 2;
Tips on calling a form dependent upon another form
Let's say you have a form named MainForm and it needs to open a form named AttributesForm and somehow MainForm needs to let AttributesForm what AFElement to use. That is to say that AttributesForm depends on something from MainForm. It is against Microsoft's best practices for AttributesForm to directly access controls on MainForm. One way around this is that you would have a read-only public property in MainForm expose its control's current value. Yet another way that works particularly well in this use-case is to have AttributesForm's constructor require an AFElement as an argument. Then all MainForm needs to do is create the AttributesForm while simultaneously passing the currently selected AFElement.
Look for help in your local drives at %PIHOME%\help\AFUIRef.chm. You are encouraged to research these methods:
Please use this discussion forum to discuss any ideas or questions related to Exercise 2