Fix WPF and cleanup
This commit is contained in:
Родитель
cc219cce1a
Коммит
701e4ac3cb
|
@ -11,6 +11,7 @@ using System.Linq;
|
|||
using Foundation;
|
||||
using MessageUI;
|
||||
using MvvmCross.iOS.Views.Presenters;
|
||||
using MvvmCross.iOS.Views.Presenters.Attributes;
|
||||
using MvvmCross.Platform;
|
||||
using MvvmCross.Platform.Exceptions;
|
||||
using MvvmCross.Platform.iOS.Platform;
|
||||
|
@ -70,7 +71,7 @@ namespace MvvmCross.Plugins.Email.iOS
|
|||
}
|
||||
_mail.Finished += HandleMailFinished;
|
||||
|
||||
_viewPresenter.ShowModalViewController(_mail, new MvvmCross.iOS.Views.Presenters.Attributes.MvxModalPresentationAttribute() { Animated = true }, null);
|
||||
_viewPresenter.ShowModalViewController(_mail, new MvxModalPresentationAttribute() { Animated = true }, null);
|
||||
}
|
||||
|
||||
public bool CanSendEmail => MFMailComposeViewController.CanSendMail;
|
||||
|
|
|
@ -12,6 +12,7 @@ using System.Threading.Tasks;
|
|||
using CoreGraphics;
|
||||
using Foundation;
|
||||
using MvvmCross.iOS.Views.Presenters;
|
||||
using MvvmCross.iOS.Views.Presenters.Attributes;
|
||||
using MvvmCross.Platform;
|
||||
using MvvmCross.Platform.iOS.Platform;
|
||||
using MvvmCross.Platform.iOS.Views;
|
||||
|
@ -92,7 +93,7 @@ namespace MvvmCross.Plugins.PictureChooser.iOS
|
|||
_pictureAvailable = pictureAvailable;
|
||||
_assumeCancelled = assumeCancelled;
|
||||
|
||||
_viewPresenter.ShowModalViewController(_picker, new MvvmCross.iOS.Views.Presenters.Attributes.MvxModalPresentationAttribute() { Animated = true }, null);
|
||||
_viewPresenter.ShowModalViewController(_picker, new MvxModalPresentationAttribute() { Animated = true }, null);
|
||||
}
|
||||
|
||||
private void HandleImagePick(UIImage image, string name)
|
||||
|
|
|
@ -22,6 +22,7 @@ namespace MvvmCross.Wpf.Platform
|
|||
: MvxSetup
|
||||
{
|
||||
private readonly Dispatcher _uiThreadDispatcher;
|
||||
private readonly ContentControl _root;
|
||||
private IMvxWpfViewPresenter _presenter;
|
||||
|
||||
protected MvxWpfSetup(Dispatcher uiThreadDispatcher, IMvxWpfViewPresenter presenter)
|
||||
|
@ -33,7 +34,13 @@ namespace MvvmCross.Wpf.Platform
|
|||
protected MvxWpfSetup(Dispatcher uiThreadDispatcher, ContentControl root)
|
||||
{
|
||||
_uiThreadDispatcher = uiThreadDispatcher;
|
||||
_presenter = CreateViewPresenter(root);
|
||||
_root = root;
|
||||
}
|
||||
|
||||
protected override void InitializePlatformServices()
|
||||
{
|
||||
RegisterPresenter();
|
||||
base.InitializePlatformServices();
|
||||
}
|
||||
|
||||
protected sealed override IMvxViewsContainer CreateViewsContainer()
|
||||
|
@ -48,6 +55,15 @@ namespace MvvmCross.Wpf.Platform
|
|||
return new MvxWpfViewsContainer();
|
||||
}
|
||||
|
||||
protected IMvxWpfViewPresenter Presenter
|
||||
{
|
||||
get
|
||||
{
|
||||
_presenter = _presenter ?? CreateViewPresenter(_root);
|
||||
return _presenter;
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual IMvxWpfViewPresenter CreateViewPresenter(ContentControl root)
|
||||
{
|
||||
return new MvxWpfViewPresenter(root);
|
||||
|
@ -55,7 +71,14 @@ namespace MvvmCross.Wpf.Platform
|
|||
|
||||
protected override IMvxViewDispatcher CreateViewDispatcher()
|
||||
{
|
||||
return new MvxWpfViewDispatcher(_uiThreadDispatcher, _presenter);
|
||||
return new MvxWpfViewDispatcher(_uiThreadDispatcher, Presenter);
|
||||
}
|
||||
|
||||
protected virtual void RegisterPresenter()
|
||||
{
|
||||
var presenter = Presenter;
|
||||
Mvx.RegisterSingleton(presenter);
|
||||
Mvx.RegisterSingleton<IMvxViewPresenter>(presenter);
|
||||
}
|
||||
|
||||
protected override IMvxPluginManager CreatePluginManager()
|
||||
|
|
Загрузка…
Ссылка в новой задаче