Closed negue closed 9 years ago
I will look into this sometime in the next week.
Most of the reflection stuff is encapsulated in the Foundation.Databinding.Model.dll. The solution would be a new VS class library targeting the correct subset. I will probably reuse the same code files and use compiler directives for switching between the two api's.
I managed it to be compiled for WinRT but for now the binding doesn't work :smile:
I'll clean up and create a pull request tomorrow with my first changes.
I have a prototype fork for Windows Store. It builds but when I run the scene nothing happens. I tried building as a "Unity C# application" so that I could get debug support, however this resulted in missing reference exceptions. Take a look.
https://github.com/NVentimiglia/Unity3d-Databinding-Mvvm-Mvc/tree/WinSA
Edit
I managed it to be compiled for WinRT but for now the binding doesn't work :smile:
Nice. I have included support for Tasks and FullSerializer in my branch if you haven't.
I added a new test method. I confirmed that the bug we are seeing is in the view portion of the code.
IEnumerator Start()
{
Output.text = "Starting Tests";
yield return StartCoroutine(TestEvent());
yield return StartCoroutine(Update1());
yield return StartCoroutine(Update2());
yield return StartCoroutine(Update3());
Log = "Ending Tests";
Log = string.Format("Average {0} {1} {2}", average1, average2, average3);
}
IEnumerator TestEvent()
{
Log = "Testing Event";
yield return new WaitForSeconds(2);
OnBindingUpdate += DatabindingTester_OnBindingUpdate;
Property1 = 1;
yield return new WaitForSeconds(2);
Property2 = 2;
yield return new WaitForSeconds(2);
Property3 = 3;
yield return new WaitForSeconds(2);
OnBindingUpdate -= DatabindingTester_OnBindingUpdate;
}
void DatabindingTester_OnBindingUpdate(ObservableMessage obj)
{
Log = string.Format("{0} : {1}", obj.Name, obj.Value);
}
Did some more research.
The BindingInfo (responsible for facilitating a property binding for the Binders) are not being serialized for WindowsStore. As a result, their values are deleted. If you look at the scene view, all 'values' are empty... the scene is totally unbound.
It is insane that WSA does not support editor serialization. I will need to think of a new way of serializing bindings within the editor.
Got it working.
I added a reference to the WinRTLegacy dll to the Databinding class library. After that everything worked even the [Serializable] annotation's used outside that library.
Oh nice! gonna try it right away
Finally it works on my end too xD
WinRTLegacy is added automatically by Unity Editor? (for the Build & Run Step)
Since WinRT (Windows Store & Phone) don't use the normal .Net Subset, this Package (and its dependencies) doesn't work for WinRT
For example.
and also my #3 Set-Method doesn't work (yet)
I think many workarounds / helper methods will need an own package / base project so that all other packages can use them.
What do you think?
I'll help to fix as much as possible^^