protected void RunViewModelLifecycle <TParameter>( IMvxViewModel <TParameter> viewModel, TParameter param, IMvxBundle?parameterValues, IMvxBundle?savedState, IMvxNavigateEventArgs?navigationArgs) where TParameter : notnull { if (viewModel == null) { throw new ArgumentNullException(nameof(viewModel)); } try { CallCustomInitMethods(viewModel, parameterValues); if (navigationArgs?.Cancel == true) { return; } if (savedState != null) { CallReloadStateMethods(viewModel, savedState); if (navigationArgs?.Cancel == true) { return; } } viewModel.Start(); if (navigationArgs?.Cancel == true) { return; } viewModel.Prepare(); if (navigationArgs?.Cancel == true) { return; } viewModel.Prepare(param); if (navigationArgs?.Cancel == true) { return; } viewModel.InitializeTask = MvxNotifyTask.Create(() => viewModel.Initialize()); } catch (Exception exception) { throw exception.MvxWrap("Problem running viewModel lifecycle of type {0}", viewModel.GetType().Name); } }
protected void RunViewModelLifecycle(IMvxViewModel viewModel, IMvxBundle parameterValues, IMvxBundle savedState, IMvxNavigateEventArgs navigationArgs) { try { CallCustomInitMethods(viewModel, parameterValues); if (navigationArgs?.Cancel == true) { return; } if (savedState != null) { CallReloadStateMethods(viewModel, savedState); if (navigationArgs?.Cancel == true) { return; } } viewModel.Start(); if (navigationArgs?.Cancel == true) { return; } viewModel.Prepare(); if (navigationArgs?.Cancel == true) { return; } } catch (Exception exception) { throw exception.MvxWrap("Problem running viewModel lifecycle of type {0}", viewModel.GetType().Name); } }
protected void RunViewModelLifecycle <TParameter>(IMvxViewModel <TParameter> viewModel, TParameter param, IMvxBundle parameterValues, IMvxBundle savedState) { try { CallCustomInitMethods(viewModel, parameterValues); if (savedState != null) { CallReloadStateMethods(viewModel, savedState); } viewModel.Start(); viewModel.Prepare(); viewModel.Prepare(param); viewModel.InitializeTask = MvxNotifyTask.Create(() => viewModel.Initialize()); } catch (Exception exception) { throw exception.MvxWrap("Problem running viewModel lifecycle of type {0}", viewModel.GetType().Name); } }