[Windows Mobile Software Development] rublopez:
SenseSDK Util Library (FileDialog and SenseForm)

Hello all

I want to share an util library that I have developed with SenseSDK library. Source code is included.

This library has two clases:

FileDialog

A file dialog form with the SenseSDK UI. I have attached some screenshots.

It has three modes:

- OpenFile dialog

- SaveFile dialog

- SelectFolder

Features:

- Supports both multiple or single selection.

- Filters.

- Default extension for SaveFile mode.

- String localization (change strings included in SenseUtilStrings)

Examples:

SenseSDK.Util.FileDialog dlg = new SenseSDK.Util.FileDialog();

dlg.Mode = SenseSDK.Util.FileDialog.DialogMode.OpenFile;

dlg.Filters.Add(@"*.txt"); // Allows to open text files

if (dlg.ShowDialog() == DialogResult.OK)

{

MessageBox.Show(dlg.SelectedFile);

}

SenseSDK.Util.FileDialog dlg = new SenseSDK.Util.FileDialog();

dlg.Mode = SenseSDK.Util.FileDialog.DialogMode.SaveFile;

dlg.Filters.Add(@"*.txt"); // Allows to save text files

dlg.DefaultExtension = @"txt";

if (dlg.ShowDialog() == DialogResult.OK)

{

MessageBox.Show(dlg.SelectedFile);

}

SenseForm

This class converts any standard Windows Mobile form into SenseSDK UI form with no effort. Simply derive your current form from SenseForm and call to UpdateListControl() method from the constructor (after InitializeComponent()). Then a SenseListControl and HeaderListControl will be created and all the controls will be converted to SensePanelItems automatically. Thefore you also can create a form with the Visual Studio designer by using the standard controls and to use this class in order to convert it to SenseSDK UI.

The supported controls are:

- TabControl -> SensePanelDividerItem. For each tab page a SensePanelDividerItem will be added to the SenseListControl

- Label -> SensePanelItem. You can add a secondary text if you include | into Label.Text property. For example: "This is a primary text|This is a secondary text". If the label contains ":" to the end of the text, then a SensePanelItem will not be created, and the text will be included in the label of the following control. If for example the form contains a Label with text "Name:" and then a TextBox control, then only a SensePanelTextboxItem it will be created with SensePanelTextboxItem.LabelText = Label.Text and SensePanelTextboxItem.Text = TextBox.Text.

- TextBox -> SensePanelTextboxItem

- ComboBox -> SensePanelComboItem

- CheckBox -> SensePanelCheckboxItem. As SensePanelItem, you can include | in order to set the secondary text.

- RadioButton -> SensePanelRadioItem

- Button -> SensePanelButtonItem

- NumericUpDown -> SensePanelNumericItem

- DateTimePicker -> SensePanelDateTimeItem

- TrackBar -> SensePanelTrackbarItem

All the standard controls are unhide after converting, so only it will be visibles the SenseListControl and the SenseHeaderControl.

The controls will be added to the SenseListControl for its position into the form.

The values are transfered automatically from standard controls to SenseSDK controls, and viceversa. If you change the value from the standard control, its associated control also will be change its value, and viceversa. For example: you has a TextBox control, if you change the TextBox.Text property, then the associated SensePanelTextboxItem.Text will be changed automatically. When the user modifies the text from the SensePanelTextboxItem, the TextBox.Text property is changed automatically. So, you don't need to access to SenseSDK controls directly, only access to your standard controls and SenseForm class will do all the work for you as if it is an standard form, but with the UI from SenseSDK.