...
To enable scheduling, your configuration class should implement the {{IScheduleConfiguration
}} interface. This interface defines a single property:
...
Implement it as follows in your configuration class:
Code Block | ||
---|---|---|
| ||
public class MyDeviceConfiguration : NotifyBase, IScheduleConfiguration { private ScheduleConfig m_ScheduleConfiguration; [DataMember] public ScheduleConfig ScheduleConfiguration { get { if (m_ScheduleConfiguration == null) { m_ScheduleConfiguration = new ScheduleConfig(); m_ScheduleConfiguration.PropertyChanged += (o, e) => RaisePropertyChanged(e); } return m_ScheduleConfiguration; } } |
The next step is to add the user interface component(s) and bind to your configuration class {{ScheduleConfiguration
}} property. The schedule UI component is defined in the Connexion.ScheduleUi assembly (Connexion.ScheduleUi.dll), so you will need to reference this assembly.
In your {{device.xaml
}} class, add a reference to the scheduling namespace:
Code Block | ||
---|---|---|
| ||
<core:UserControlBase x:Class="mydevice.myDeviceUI"
xmlns:scheduleUi="clr-namespace:Connexion.ScheduleUi;assembly=Connexion.ScheduleUi" |
There are 2 UI components available:
An icon adorner which will launch an ‘edit schedule’ popup window - this can be placed next to textboxes and similar controls to indicate additional scheduling functionality.
Code Block language xml <scheduleUi:SchedulerIcon ScheduleConfiguration="{Binding Config.ScheduleConfiguration}" VerticalAlignment="Center" />
A schedule UI which can be placed directly onto your device UI - this can be placed on a separate tab or other large area if you only need a single schedule configuration.
Code Block language xml <Border> <scheduleUi:ScheduleControl ScheduleConfiguration="{Binding Config.ScheduleConfig}" NoSchedulingEnabled="False" /> </Border>