| 1 | |
| 2 | static void @(Model.Name)Setter(Local<String> property, Local<Value> value, const Nan::PropertyCallbackInfo<void> &info) { |
| 3 | HandleScope scope; |
| 4 | |
| 5 | if (!@(String.Format(Converter.TypeCheck(Model.PropertyType, TX.MainModel.Types.ContainsKey(Model.PropertyType)),"value"))) { |
| 6 | Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Value to set is of unexpected type"))); |
| 7 | return; |
| 8 | } |
| 9 | |
| 10 | try { |
| 11 | @{ |
| 12 | var winrtConversionInfo = Converter.ToWinRT(Model.PropertyType); |
| 13 | } |
| 14 | |
| 15 | @(winrtConversionInfo[0]) winRtValue = @(string.Format(winrtConversionInfo[1], "value")); |
| 16 | |
| 17 | @(TX.ToWinRT(Model.DeclaringType, false))::@(Model.Name) = winRtValue; |
| 18 | } catch (Platform::Exception ^exception) { |
| 19 | NodeRT::Utils::ThrowWinRtExceptionInJs(exception); |
| 20 | } |
| 21 | } |