more G-Labs products

Author Topic: Update widget data-ui-field  (Read 1645 times)

September 21, 2014, 11:13:10 PM
Read 1645 times

maxflax

  • ***
  • Information
  • Full Member
  • Posts: 90
I am wondering how to go about in the easiest manner to update a data-ui-field in my widget from my C# script.


September 21, 2014, 11:30:15 PM
Reply #1

Gene

  • *****
  • Information
  • Administrator
  • Posts: 1472
  • Tangible is the future!
    • Yet Another Programmer
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

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

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

g.

September 22, 2014, 01:01:59 AM
Reply #2

maxflax

  • ***
  • Information
  • Full Member
  • Posts: 90
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#.


September 22, 2014, 11:57:49 AM
Reply #3

Gene

  • *****
  • Information
  • Administrator
  • Posts: 1472
  • Tangible is the future!
    • Yet Another Programmer
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.

September 22, 2014, 10:48:01 PM
Reply #4

maxflax

  • ***
  • Information
  • Full Member
  • Posts: 90
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.