public override void Show(MvxShowViewModelRequest request) { var view = CreateView(request); if (request.ClearTop) ClearBackStack(); Show(view); }
public bool RequestNavigate(MvxShowViewModelRequest request) { Action action = () => { MvxTrace.TaggedTrace("MacNavigation", "Navigate requested"); _presenter.Show(request); }; return RequestMainThreadAction(action); }
public virtual void NavigateTo(MvxShowViewModelRequest request) { MvxTrace.TaggedTrace("TouchNavigation", "Navigate requested"); var view = CreateView(request); if (request.ClearTop) _presenter.ClearBackStack(); _presenter.ShowView(view); }
public virtual IMvxTouchView CreateView(MvxShowViewModelRequest request) { var viewType = GetViewType(request.ViewModelType); if (viewType == null) throw new MvxException("View Type not found for " + request.ViewModelType); var view = Activator.CreateInstance(viewType, request) as IMvxTouchView; if (view == null) throw new MvxException("View not loaded for " + viewType); return view; }
public virtual Uri GetXamlUriFor(MvxShowViewModelRequest request) { var viewType = GetViewType(request.ViewModelType); if (viewType == null) { throw new MvxException("View Type not found for " + request.ViewModelType); } var requestText = JsonConvert.SerializeObject(request); var viewUrl = string.Format("{0}?{1}={2}", GetBaseXamlUrlForView(viewType), QueryParameterKeyName, Uri.EscapeDataString(requestText)); return new Uri(viewUrl, UriKind.Relative); }
private static IMvxViewModel LoadViewModel(this IMvxWinRTView winRTView, MvxShowViewModelRequest viewModelRequest) { if (viewModelRequest.ClearTop) { #warning TODO! //phoneView.ClearBackStack(); } var loaderService = winRTView.GetService<IMvxViewModelLoader>(); var viewModel = loaderService.LoadViewModel(viewModelRequest); return (IMvxViewModel)viewModel; }
private static IMvxViewModel LoadViewModel(this IMvxMacView macView, MvxShowViewModelRequest viewModelRequest) { if (viewModelRequest.ClearTop) { #warning TODO - BackStack not cleared for Mac //phoneView.ClearBackStack(); } var loaderService = Mvx.Resolve<IMvxViewModelLoader>(); var viewModel = loaderService.LoadViewModel(viewModelRequest); return viewModel; }
public void Show(MvxShowViewModelRequest request) { try { var loader = this.GetService<IMvxSimpleWpfViewLoader>(); var view = loader.CreateView(request); Present(view); } catch (Exception exception) { MvxTrace.Trace("Error seen during navigation request to {0} - error {1}", request.ViewModelType.Name, exception.ToLongString()); } }
public void Show(MvxShowViewModelRequest request) { try { var requestTranslator = this.GetService<IMvxViewsContainer>(); var viewType = requestTranslator.GetViewType(request.ViewModelType); _rootFrame.Navigate(viewType, request); } catch (Exception exception) { MvxTrace.Trace("Error seen during navigation request to {0} - error {1}", request.ViewModelType.Name, exception.ToLongString()); } }
public IMvxMacView CreateView (MvxShowViewModelRequest request) { var viewType = GetViewType(request.ViewModelType); if (viewType == null) throw new MvxException("View Type not found for " + request.ViewModelType); var view = Activator.CreateInstance(viewType) as IMvxMacView; if (view == null) throw new MvxException("View not loaded for " + viewType); var requestProperty = view.GetType().GetProperty("ViewModelRequest"); if (requestProperty == null) throw new MvxException("ViewModelRequest Property missing for " + view.GetType()); requestProperty.SetValue(view, request, null); return view; }
public override void Navigate(MvxShowViewModelRequest request) { lock (this) { var viewType = GetViewType(request.ViewModelType); if (viewType == null) { throw new MvxException("View Type not found for " + request.ViewModelType); } var view = (IMvxConsoleView) Activator.CreateInstance(viewType); var viewModelLoader = this.GetService<IMvxViewModelLoader>(); var viewModel = viewModelLoader.LoadViewModel(request); view.HackSetViewModel(viewModel); this.GetService<IMvxConsoleCurrentView>().CurrentView = view; _navigationStack.Push(request); } }
public override void Show(MvxShowViewModelRequest request) { try { var view = GetView(request); var viewController = view as NSViewController; if (viewController == null) throw new MvxException("Passed in IMvxTouchView is not a NSViewController"); PlaceView(request, viewController); } catch (Exception exception) { MvxTrace.Trace("Error seen during navigation request to {0} - error {1}", request.ViewModelType.Name, exception.ToLongString()); } }
public bool RequestNavigate(MvxShowViewModelRequest request) { var requestTranslator = this.GetService<IMvxWindowsPhoneViewModelRequestTranslator>(); var xamlUri = requestTranslator.GetXamlUriFor(request); return RequestMainThreadAction(() => { try { _rootFrame.Navigate(xamlUri); } catch (ThreadAbortException) { throw; } catch (Exception exception) { MvxTrace.Trace("Error seen during navigation request to {0} - error {1}", request.ViewModelType.Name, exception.ToLongString()); } }); }
public IMvxViewModel LoadViewModel(MvxShowViewModelRequest request) { if (request.ViewModelType == typeof (MvxNullViewModel)) return new MvxNullViewModel(); var viewModelLocatorFinder = this.GetService<IMvxViewModelLocatorFinder>(); var viewModelLocator = viewModelLocatorFinder.FindLocator(request); if (viewModelLocator == null) throw new MvxException("Sorry - somehow there's no viewmodel locator registered for {0}", request.ViewModelType); IMvxViewModel model = null; if (!viewModelLocator.TryLoad(request.ViewModelType, request.ParameterValues, out model)) throw new MvxException( "Failed to load ViewModel for type {0} from locator {1}", request.ViewModelType, viewModelLocator.GetType().Name); if (model != null) model.RequestedBy = request.RequestedBy; return model; }
public FrameworkElement CreateView(MvxShowViewModelRequest request) { var viewType = GetViewType(request.ViewModelType); if (viewType == null) throw new MvxException("View Type not found for " + request.ViewModelType); // , request var viewObject = Activator.CreateInstance(viewType); if (viewObject == null) throw new MvxException("View not loaded for " + viewType); var wpfView = viewObject as IMvxWpfView; if (wpfView == null) throw new MvxException("Loaded View does not have IMvxWpfView interface " + viewType); var viewControl = viewObject as FrameworkElement; if (viewControl == null) throw new MvxException("Loaded View is not a FrameworkElement " + viewType); var viewModelLoader = this.GetService<IMvxViewModelLoader>(); wpfView.ViewModel = viewModelLoader.LoadViewModel(request); return viewControl; }
public abstract void Navigate(MvxShowViewModelRequest request);
public bool RequestNavigate(MvxShowViewModelRequest request) { var navigation = this.GetService<IMvxConsoleNavigation>(); return InvokeOrBeginInvoke(() => navigation.Navigate(request)); }
protected virtual IMvxMacView GetView(MvxShowViewModelRequest request) { var creator = Mvx.Resolve<IMvxMacViewCreator>(); return creator.CreateView(request); }
protected virtual void PlaceView(MvxShowViewModelRequest request, NSViewController viewController) { Window.ContentView.AddSubview(viewController.View); }
public static void OnViewCreate(this IMvxWinRTView winRTView, MvxShowViewModelRequest viewModelRequest) { winRTView.OnViewCreate(() => { return winRTView.LoadViewModel(viewModelRequest); }); }
public MvxTranslatedIntent(MvxShowViewModelRequest showViewModelRequest) { ShowViewModelRequest = showViewModelRequest; Result = TranslationResult.Request; }
public virtual void Show(MvxShowViewModelRequest request) { var requestTranslator = this.GetService<IMvxAndroidViewModelRequestTranslator>(); var intent = requestTranslator.GetIntentFor(request); Activity.StartActivity(intent); }
public static void OnViewCreate(this IMvxMacView macView, MvxShowViewModelRequest viewModelRequest) { macView.OnViewCreate(() => { return macView.LoadViewModel(viewModelRequest); }); }
private IMvxTouchView CreateView(MvxShowViewModelRequest request) { return this.GetService<IMvxTouchViewCreator>().CreateView(request); }
public bool RequestNavigate(MvxShowViewModelRequest request) { NavigateRequests.Add(request); return true; }
public virtual void Show(MvxShowViewModelRequest view) { }
public virtual Intent GetIntentFor(MvxShowViewModelRequest request) { var viewType = GetViewType(request.ViewModelType); if (viewType == null) { throw new MvxException("View Type not found for " + request.ViewModelType); } var converter = this.GetService<IMvxTextSerializer>(); var requestText = converter.SerializeObject(request); var intent = new Intent(_applicationContext, viewType); intent.PutExtra(ExtrasKey, requestText); #warning ClearTop is not enough :/ Need to work on an Intent based scheme like http://stackoverflow.com/questions/3007998/on-logout-clear-activity-history-stack-preventing-back-button-from-opening-l if (request.ClearTop) intent.AddFlags(ActivityFlags.ClearTop); intent.AddFlags(ActivityFlags.NewTask); return intent; }
public bool RequestNavigate(MvxShowViewModelRequest request) { return RequestMainThreadAction(() => _presenter.Show(request)); }
public bool RequestNavigate(MvxShowViewModelRequest request) { return InvokeOrBeginInvoke(() => _presenter.Show(request)); }