/// <summary> /// Called by HomeSeer when a user updates the configuration of an action and those changes /// are in need of processing. /// </summary> /// <param name="postData">A <see cref="Dictionary"/> of changes to the action configuration</param> /// <param name="actInfo">The action being configured</param> /// <returns> /// An <see cref="EventUpdateReturnData"/> describing the new state of the action that will be saved by HomeSeer. /// The action configuration will be saved if the result returned is an empty string. /// </returns> public EventUpdateReturnData OnUpdateActionConfig(Dictionary <string, string> postData, TrigActInfo actInfo) { var eurd = new EventUpdateReturnData { Result = "", TrigActInfo = actInfo }; try { var curAct = GetObjectFromActInfo(actInfo); var result = curAct.ProcessPostData(postData); //curAct = _listener?.OnActionConfigChange(curAct) ?? curAct; eurd.Result = result ? "" : "Unknown Plugin Error"; eurd.DataOut = curAct.Data; return(eurd); } catch (Exception exception) { if (LogDebug) { Console.WriteLine(exception); } eurd.Result = exception.Message; return(eurd); } }
/// <summary> /// Called by HomeSeer when a user updates the configuration of a trigger and those changes /// are in need of processing. /// </summary> /// <param name="postData">A <see cref="Dictionary"/> of changes to the trigger configuration</param> /// <param name="trigInfo">The trigger being configured</param> /// <returns> /// An <see cref="EventUpdateReturnData"/> describing the new state of the trigger that will be saved by HomeSeer. /// The trigger configuration will be saved if the result returned is an empty string. /// </returns> public EventUpdateReturnData OnUpdateTriggerConfig(Dictionary <string, string> postData, TrigActInfo trigInfo) { var mr = new EventUpdateReturnData { Result = "", TrigActInfo = trigInfo }; try { var curTrig = GetObjectFromTrigInfo(trigInfo); var result = curTrig.ProcessPostData(postData); //curTrig = _listener?.OnTriggerConfigChange(curTrig) ?? curTrig; mr.Result = result ? "" : "Unknown Plugin Error"; mr.DataOut = curTrig.Data; return(mr); } catch (Exception exception) { if (LogDebug) { Console.WriteLine(exception); } mr.Result = exception.Message; return(mr); } }