public static void Start(Type type, bool savePrevious, params object[] parameters) { Container.Dispatcher.SafelyInvoke((() => { var parametersCopy = new object[parameters.Length]; Array.Copy(parameters, parametersCopy, parameters.Length); LoadingView?.Invoke(Container.Content.GetType(), type, parametersCopy); if (savePrevious && Container.Content.GetType() != Wait.GetType() && Container.Content is Page) { PreviousContent = (Page)Container.Content; } if (Container == null) { throw new ApplicationException("Container hasn't been defined yet"); } if (!type.IsSubclassOf(typeof(Page))) { throw new ApplicationException($"{type} has to be a Page"); } Container.Content = Activator.CreateInstance(type, parameters); })); }
public static void BackToPrevious() { if (!Container.Dispatcher.CheckAccess()) { Container.Dispatcher.BeginInvoke(new Action(BackToPrevious)); return; } LoadingView?.Invoke(Container.Content.GetType(), PreviousContent.GetType(), new object[] { }); Container.Content = PreviousContent; }