public void TransitionWindow(ISimpleWindow to) { to.SetDataContext(DataContext); to.ShowWindow(); CloseWindow(); provider.Window = to; }
protected override void NavigateWindow(SimpleViewModel navObject, ISimpleWindow newWindow) { if (navObject is AuthorizedViewModel authVM) { if (VerifyNavigation(authVM)) { base.Navigate(navObject); return; } base.NavigateWindow(service.DefaultNavigation, new LoginWindow()); return; } base.NavigateWindow(navObject, newWindow); }
/// <summary> /// Navigate to a ViewModel with a new window /// </summary> /// <param name="navObject">ViewModel to navigate to</param> /// <param name="newWindow">Window to navigate to</param> public void NavigateWithNewWindow(SimpleViewModel navObject, ISimpleWindow newWindow) { if (Provider == null) { throw new NullReferenceException("The navigation service does not have a registered 'ISimpleNavigationProvider'"); } var args = new WindowEventArgs(newWindow, Provider.Window); Navigate(navObject); OnBeforeClosing(this, args); Provider.Window.TransitionWindow(newWindow); OnAfterClosing(this, args); }
public WindowEventArgs(ISimpleWindow windowTo, ISimpleWindow windowFrom = null) { WindowTo = windowTo; WindowFrom = windowFrom; }
protected virtual void NavigateWindow(SimpleViewModel navObject, ISimpleWindow newWindow) { service.NavigateWithNewWindow(navObject, newWindow); }