Chronos Plugins 5.9.0
This documentation covers the plugin interfaces definitions and an example implementation.
Loading...
Searching...
No Matches
CoffeeMakerParamsEditor.cs
Go to the documentation of this file.
1using System;
2using System.ComponentModel;
3using System.Drawing.Design;
4using System.Windows.Forms;
5using System.Windows.Forms.Design;
6
8{
9 internal class CoffeeMakerParamsEditor : UITypeEditor
10 {
11 #region Overrides of UITypeEditor
12
13 public override UITypeEditorEditStyle GetEditStyle(ITypeDescriptorContext context)
14 {
15 return UITypeEditorEditStyle.Modal;
16 }
17
18 public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
19 {
20 var myPars = (value as CoffeMakerParams)?.Clone();
21 var editorService = provider?.GetService(typeof(IWindowsFormsEditorService)) as IWindowsFormsEditorService;
22 var theForm = new CoffeeMakerParamsUI() {Parameters = myPars};
23 if (editorService?.ShowDialog(theForm) == DialogResult.OK)
24 {
25 return theForm.Parameters;
26 }
27 // if the dialog was cancelled, return the old parameter set.
28 return value;
29 }
30
31 #endregion
32 }
33}
A fake device. This namespace contains the fake device driver and auxiliary classes for settings,...
Simple user interfrace for the fake coffee maker's parameters.
We have a fancy coffee machine that can regulate the warmer temperature for the pot and has lamps for...