HomeGenie Forum

Automation Program Plugins and Wizard Scripting => Help => Topic started by: maxflax on September 21, 2014, 11:13:10 PM

Title: Update widget data-ui-field
Post by: maxflax on September 21, 2014, 11:13:10 PM
I am wondering how to go about in the easiest manner to update a data-ui-field in my widget from my C# script.

Title: Re: Update widget data-ui-field
Post by: Gene on September 21, 2014, 11:30:15 PM
Your c# app must call Program.RaiseEvent:

http://www.homegenie.it/docs/doxy/de/d1f/class_home_genie_1_1_automation_1_1_scripting_1_1_program_helper.html#af51db91ed13809da94337aac3c1053b7 (http://www.homegenie.it/docs/doxy/de/d1f/class_home_genie_1_1_automation_1_1_scripting_1_1_program_helper.html#af51db91ed13809da94337aac3c1053b7)

Code: [Select]
Program.RaiseEvent("MyField.Name", "SomeValue", "Some Description");

the widget "Refresh" method will then be invoked automatically.

g.
Title: Re: Update widget data-ui-field
Post by: maxflax on September 22, 2014, 01:01:59 AM
Can't get that to work.. have this field in my widget <span data-ui-field="description">...</span> And Im trying to update that <span> from my C#.

Title: Re: Update widget data-ui-field
Post by: Gene on September 22, 2014, 11:57:49 AM
Hi maxflax,

please post here both the code of the c# program and of the widget (html and json files).
You also need to instruct the widget json file about what field to update from your c# app module to the widget html UI elemets (binding/mapping).

Cheers,
g.
Title: Re: Update widget data-ui-field
Post by: maxflax on September 22, 2014, 10:48:01 PM
I took the route setting a property from C# which I then in the json code retrieve with HG.WebApp.Utility.GetModulePropertyByName and set to my span html tag.
Not a traditional binding but it does get the job done.