Initialized - How Not To Execute During XAML Build Step
When a XAML file changes externally I notice that OnInitialized is called in the code behind file. Most of the time this is fine, but occasionally I have dependencies on other state in this method which may not be initialized. Is there an easy way to have OnInitialized (from UserControl.Initialized) not execute during this XAML refresh/build step?
Re: Initialized - How Not To Execute During XAML Build Step
Not calling OnInitialize when XAML is refreshing could give strange errors at parsing time or break thumbnails. What about having a way to inform your control that is is being reimported and that OnInitialize could be ignored?
We need to think more about it, it is definitely a issue.
PS: does it happen if you disable thumbnails in noesis settings?
We need to think more about it, it is definitely a issue.
PS: does it happen if you disable thumbnails in noesis settings?
Re: Initialized - How Not To Execute During XAML Build Step
It's a minor nuisance, really. I just clear the errors from the Unity console and continue on. It just seems like there would be some way to know whether it is a runtime build or editor build. Another option might be using a different event such as Loaded(), but my understanding of that method is that it is reentrant, where as Initialized() is not.
Re: Initialized - How Not To Execute During XAML Build Step
Could you please open a ticket about it?
Re: Initialized - How Not To Execute During XAML Build Step
I have an effective (and good enough) work-around: In UserControl.OnInitialized()...
Code: Select all
private void OnInitialized(object sender, NoesisEventArgs args)
{
if (!Application.isPlaying)
return;
// execute code here with external dependencies that are only initialized during game playback.
}
Who is online
Users browsing this forum: No registered users and 7 guests