Skip to content

Commit

Permalink
#506 Window Manager and Forms Application
Browse files Browse the repository at this point in the history
  • Loading branch information
Nigel Sampson committed Mar 5, 2018
1 parent c0a6d0d commit 1c01692
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
24 changes: 12 additions & 12 deletions src/Caliburn.Micro.Platform/Platforms/WPF/WindowManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public virtual void ShowWindow(object rootModel, object context = null, IDiction
/// <param name="rootModel">The root model.</param>
/// <param name="context">The view context.</param>
/// <param name="settings">The optional popup settings.</param>
public virtual void ShowPopup(object rootModel, object context = null, IDictionary<string, object> settings = null) {
public virtual async void ShowPopup(object rootModel, object context = null, IDictionary<string, object> settings = null) {
var popup = CreatePopup(rootModel, settings);
var view = ViewLocator.LocateForModel(rootModel, popup, context);

Expand All @@ -92,10 +92,10 @@ public virtual void ShowPopup(object rootModel, object context = null, IDictiona

ViewModelBinder.Bind(rootModel, popup, null);
Action.SetTargetWithoutContext(view, rootModel);

var activatable = rootModel as IActivate;
if (activatable != null) {
activatable.Activate();
if (rootModel is IActivate activator)
{
await activator.ActivateAsync();
}

var deactivator = rootModel as IDeactivate;
Expand Down Expand Up @@ -226,9 +226,9 @@ public virtual Page CreatePage(object rootModel, object context, IDictionary<str

ApplySettings(view, settings);

var activatable = rootModel as IActivate;
if (activatable != null) {
activatable.Activate();
if (rootModel is IActivate activator)
{
activator.ActivateAsync();
}

var deactivatable = rootModel as IDeactivate;
Expand Down Expand Up @@ -285,9 +285,9 @@ public WindowConductor(object model, Window view) {
this.model = model;
this.view = view;

var activatable = model as IActivate;
if (activatable != null) {
activatable.Activate();
if (model is IActivate activator)
{
activator.ActivateAsync();
}

var deactivatable = model as IDeactivate;
Expand Down Expand Up @@ -371,4 +371,4 @@ void Closing(object sender, CancelEventArgs e) {
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using System.Linq;
using System.Reflection;
using System.Threading.Tasks;
using Xamarin.Forms;

namespace Caliburn.Micro.Xamarin.Forms
Expand Down

0 comments on commit 1c01692

Please sign in to comment.