private IMvxViewModel LoadViewModel(MvxViewModelRequest request, IMvxBundle savedState,
                                            IMvxViewModelLocator viewModelLocator)
        {
            IMvxViewModel viewModel = null;
            var parameterValues = new MvxBundle(request.ParameterValues);
            if (!viewModelLocator.TryLoad(request.ViewModelType, parameterValues, savedState, out viewModel))
            {
                throw new MvxException(
                    "Failed to construct and initialize ViewModel for type {0} from locator {1} - check MvxTrace for more information",
                    request.ViewModelType, viewModelLocator.GetType().Name);
            }

            viewModel.RequestedBy = request.RequestedBy;
            return viewModel;
        }
        private IMvxViewModel LoadViewModel(MvxViewModelRequest request, IMvxBundle savedState,
                                            IMvxViewModelLocator viewModelLocator)
        {
            IMvxViewModel viewModel       = null;
            var           parameterValues = new MvxBundle(request.ParameterValues);

            if (!viewModelLocator.TryLoad(request.ViewModelType, parameterValues, savedState, out viewModel))
            {
                throw new MvxException(
                          "Failed to construct and initialize ViewModel for type {0} from locator {1} - check MvxTrace for more information",
                          request.ViewModelType, viewModelLocator.GetType().Name);
            }

            viewModel.RequestedBy = request.RequestedBy;
            return(viewModel);
        }
 private IMvxViewModel LoadViewModel(MvxViewModelRequest request, IMvxBundle savedState,
                                     IMvxViewModelLocator viewModelLocator)
 {
     IMvxViewModel viewModel = null;
     var parameterValues = new MvxBundle(request.ParameterValues);
     try
     {
         viewModel = viewModelLocator.Load(request.ViewModelType, parameterValues, savedState);
     }
     catch (Exception exception)
     {
         throw exception.MvxWrap(
             "Failed to construct and initialize ViewModel for type {0} from locator {1} - check InnerException for more information",
             request.ViewModelType, viewModelLocator.GetType().Name);
     }
     viewModel.RequestedBy = request.RequestedBy;
     return viewModel;
 }
示例#4
0
        private IMvxViewModel LoadViewModel(MvxViewModelRequest request, IMvxBundle savedState,
                                            IMvxViewModelLocator viewModelLocator)
        {
            IMvxViewModel viewModel       = null;
            var           parameterValues = new MvxBundle(request.ParameterValues);

            try
            {
                viewModel = viewModelLocator.Load(request.ViewModelType, parameterValues, savedState);
            }
            catch (Exception exception)
            {
                throw exception.MvxWrap(
                          "Failed to construct and initialize ViewModel for type {0} from locator {1} - check InnerException for more information",
                          request.ViewModelType, viewModelLocator.GetType().Name);
            }
            return(viewModel);
        }
        private IMvxViewModel ReloadViewModel(IMvxViewModel viewModel, MvxViewModelRequest request, IMvxBundle savedState,
                                    IMvxViewModelLocator viewModelLocator)
        {
            if (viewModelLocator == null)
            {
                throw new MvxException("Received view model is null, view model reload failed. ", request.ViewModelType);
            }

            var parameterValues = new MvxBundle(request.ParameterValues);
            try
            {
                viewModel = viewModelLocator.Reload(viewModel, parameterValues, savedState);
            }
            catch (Exception exception)
            {
                throw exception.MvxWrap(
                    "Failed to reload a previously created created ViewModel for type {0} from locator {1} - check InnerException for more information",
                    request.ViewModelType, viewModelLocator.GetType().Name);
            }
            viewModel.RequestedBy = request.RequestedBy;
            return viewModel;
        }
示例#6
0
        private IMvxViewModel ReloadViewModel(IMvxViewModel viewModel, MvxViewModelRequest request, IMvxBundle savedState,
                                              IMvxViewModelLocator viewModelLocator)
        {
            if (viewModelLocator == null)
            {
                throw new MvxException("Received view model is null, view model reload failed. ", request.ViewModelType);
            }

            var parameterValues = new MvxBundle(request.ParameterValues);

            try
            {
                viewModel = viewModelLocator.Reload(viewModel, parameterValues, savedState);
            }
            catch (Exception exception)
            {
                throw exception.MvxWrap(
                          "Failed to reload a previously created created ViewModel for type {0} from locator {1} - check InnerException for more information",
                          request.ViewModelType, viewModelLocator.GetType().Name);
            }
            return(viewModel);
        }