Applications use SftStyle/NET royalty-free on end users' machines. What permits this is the license the Visual Studio designer saves with each SftStyle/NET component and control placed on a form, in its Contents property: the SftStyle and SftColorDialog components save it as a string in the form's code (InitializeComponent), the SftSlider control in the form's resource (.resx) file. Applications don't use this property themselves.
Once one object with a saved license has been loaded, every SftStyle/NET class of the process is licensed: the components, the slider, SftMessageBox and SftTaskDialog, also those created in code. That is why every application that uses SftStyle/NET has an SftStyle component on its main form, also an application that only shows message boxes or task dialogs: the component carries the license, and it is loaded with the main form before any dialog appears. Without a licensed object, the dialogs and the slider refuse to work on an end user's machine: they show a message and throw an exception.
An application that creates its SftStyle component in code, without the Visual Studio designer, gives it the license with SftStyle.SetContents. The document comes from SftStyle.GetContents, called once on the licensed development machine; the application ships it, for example as a project resource, and loads it right after it creates the component. A component created in code starts as soon as its SftStyle.DarkMode or SftStyle.HighContrastMode property is set or, without that, at the first idle moment of the application, so the application loads the license before it sets any property.
C#
// once, on the development machine using (SftStyle temp = new SftStyle()) SftStyle.GetContents(temp).Save("SftStyleLicense.xml"); // in the application XmlDocument license = new XmlDocument(); license.LoadXml(Properties.Resources.SftStyleLicense); SftStyle style = new SftStyle(components); SftStyle.SetContents(style, license); style.DarkMode = DarkModeEnum.Auto;
VB
' once, on the development machine Using temp As New SftStyle() SftStyle.GetContents(temp).Save("SftStyleLicense.xml") End Using ' in the application Dim license As New XmlDocument() license.LoadXml(My.Resources.SftStyleLicense) Dim style As New SftStyle(components) SftStyle.SetContents(style, license) style.DarkMode = DarkModeEnum.Auto
Sliders and color dialogs created in code need no license of their own once the SftStyle component has one.
The properties of an SftSlider control can be saved as an XML document and loaded again, for example to keep a user's settings. SftSlider.GetContents returns the properties of a slider, SftSlider.SetContents loads them into a slider; PersistContentsEnum.Props and PersistContentsEnum.All both save and load the properties; with PersistContentsEnum.None, SftSlider.GetContents saves only the version and license information and SftSlider.SetContents loads nothing. SftSlider.SetContents sets the properties the document does not contain to their defaults, and never loads the license information.
C#
XmlDocument doc = SftSlider.GetContents(sliderPrice, PersistContentsEnum.Props); SftSlider.SetContents(sliderOther, doc, PersistContentsEnum.Props);
VB
Dim doc As XmlDocument = SftSlider.GetContents(SliderPrice, PersistContentsEnum.Props) SftSlider.SetContents(SliderOther, doc, PersistContentsEnum.Props)
The saved properties hold no images or fonts, so a document saved by a .NET 10 application loads in .NET Framework applications and the other way around.