You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ghuntley [10:31 PM] @flagbug: I'm doing UWP currently, as is @moswald so
between us we got that covered.
flagbug [10:34 PM] @ghuntley: Beware, there are some major issues with RxUI
if your app is a target for a share operation:
https://msdn.microsoft.com/en-us/library/windows/apps/hh465251.aspx
because of the way that RxApp.MainThreadScheduler and friends work.
ghuntley [10:39 PM] @flagbug: can you give some examples of what you have
observed? Thanks for the heads up, not using sharing in this app fortunately.
flagbug [10:41 PM] @ghuntley: You have to set `RxApp.MainThreadScheduler`
when opening the app as share target, since the share target UI gets its own UI
thread and then, when you close the share UI, you have to set
`RxApp.MainThreadScheduler` back to its previous value, or else your main
application will crash.
As a workaround, I'm doing something like this in the OnShareTargetActivated method:
// Capture the UI thread scheduler of the main application, so we can reset it, when we// exit the share flyoutISchedulerrealMainThreadScheduler= RxApp.MainThreadScheduler;
RxApp.MainThreadScheduler =new WaitForDispatcherScheduler(()=> CoreDispatcherScheduler.Current);// Pretty much the same goes for the DefaulltItemTemplate, since the template is// generated on a different UI thread, we have to reset it here and change it back when// closing the share target// // See https://github.com/reactiveui/ReactiveUI/issues/965 for more informationvarpreviousTemplate= AutoDataTemplateBindingHook.DefaultItemTemplate;
AutoDataTemplateBindingHook.DefaultItemTemplate =newLazy<DataTemplate>(()=>{conststringtemplate="<DataTemplate xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation' xmlns:xaml='using:ReactiveUI'>"+"<xaml:ViewModelViewHost ViewModel=\"{Binding}\" VerticalContentAlignment=\"Stretch\" HorizontalContentAlignment=\"Stretch\" IsTabStop=\"False\" />"+"</DataTemplate>";varassemblyName="";return(DataTemplate)XamlReader.Load(template.Replace("__ASSEMBLYNAME__", assemblyName));});
Window.Current.Activate();
Window.Current.VisibilityChanged +=(sender,ev)=>{if(!ev.Visible){ RxApp.MainThreadScheduler =realMainThreadScheduler; AutoDataTemplateBindingHook.DefaultItemTemplate =previousTemplate;}};
See also #965
The text was updated successfully, but these errors were encountered: