private void CreateWorkViews() { _workViews = new Dictionary <ViewType, IWorkView>(); _workViews.Add(ViewType.Pagina_1, _locator.GetView(ViewType.Pagina_1) as IWorkView); _workViews.Add(ViewType.Pagina_2, _locator.GetView(ViewType.Pagina_2) as IWorkView); }
private void CreateWorkViews() { _workViews = new Dictionary <ViewType, IWorkView>(); _workViews.Add(ViewType.StockInsumos, _locator.GetView(ViewType.StockInsumos) as IWorkView); _workViews.Add(ViewType.StockAlquilables, _locator.GetView(ViewType.StockAlquilables) as IWorkView); }
public static UITabBarController CreateForViewModels( IEnumerable <IViewModelBase> viewModels, IList <UITabBarItem> tabBarItems, Func <UITabBarController>?tabBarControllerFactory = null) { return(CreateForViewModels(viewModels, tabBarItems, x => ViewLocator.GetView(x), tabBarControllerFactory)); }
/// <summary> /// Creates the <see cref="Page"/> for the specified view model. /// </summary> /// <param name="viewModel">The view model.</param> /// <param name="context">The context.</param> /// <returns>The <see cref="Page"/>.</returns> protected virtual Page CreatePage(object viewModel, object context) { var view = _viewLocator?.GetView(viewModel, null, context); var page = EnsurePage(viewModel, view); page.DataContext = viewModel; var activatable = viewModel as IActivatable; if (activatable != null) { activatable.OnActivate(); page.Unloaded += (s, e) => activatable.OnDeactivate(true); } return(page); }
protected void OnSelectedWorkViewTypeChanged(ViewType oldType) { Debug.WriteLine("OnSelectedWorkViewTypeChanged: oldType = {0}", oldType); // aca tenemos que ver si la vista en realidad necesita otra... // lo tiene que decidir el locator SelectedWorkView = _locator.GetView(SelectedWorkViewType); // RaiseSelectedViewTypeChanged() // esto tambien es mio... si la vista es tipo navegador, los eventos de navegación deberian replicarse .... }
private static object CreateView(object model) { if (_viewLocator != null) { return(_viewLocator.GetView(model)); } Type viewType = RuleProvider.GetViewType(model.GetType()); return(Activator.CreateInstance(viewType)); }
public async Task NavigateToViewAsync <TView>( object parameter = null, bool modalNavigation = false, bool clearStack = false, bool animated = true) where TView : class, IBindablePage { if (clearStack) { var viewType = typeof(TView); var rootPage = FormsNavigation.NavigationStack.First(); if (viewType != rootPage.GetType()) { var newRootView = (Page)_viewLocator.GetView <TView>(); // Make the new view the root of our navigation stack FormsNavigation.InsertPageBefore(newRootView, rootPage); rootPage = newRootView; } // Then we want to go back to root page and clear the stack await NavigationPage.PopToRootAsync(animated); ((ANavigableViewModel)rootPage.BindingContext).OnNavigated(parameter); return; } var view = _viewLocator.GetView <TView>(); if (modalNavigation) { await FormsNavigation.PushModalAsync((Page)view, animated); } else { await NavigationPage.PushAsync((Page)view, animated); } ((ANavigableViewModel)view.BindingContext).OnNavigated(parameter); }
public virtual void NavigateToViewModel <TViewModel>( bool clearBackStack = false, IReadOnlyList <NavigationParameterModel>?parameters = null) where TViewModel : IViewModelBase { var viewModel = CreateViewModel <TViewModel>(parameters); if (clearBackStack && !IsEmptyBackStack) { ClearBackStack(); } var fragment = (Fragment)_viewLocator.GetView(viewModel, ViewType.Fragment); NavigateInternal(fragment, viewModel); }
private IItemSearchResultOverlayView CreateView() { var view = viewLocator.GetView(itemSearchResultOverlayViewModel); if (view is IItemSearchResultOverlayView itemSearchResultOverlay) { if (view is IControl control) { control.DataContext = itemSearchResultOverlayViewModel; } return(itemSearchResultOverlay); } throw new ArgumentException($"Could not find view for {nameof(IItemSearchResultOverlayViewModel)} that implements {nameof(IItemSearchResultOverlayView)}"); }
protected void OnSelectedViewTypeChanged(ViewType oldType) { Debug.WriteLine("OnSelectedViewTypeChanged: oldType = {0}", oldType); // aca tenemos que ver si la vista en realidad necesita otra... // lo tiene que decidir el locator SelectedView = _locator.GetView(SelectedViewType); // RaiseSelectedViewTypeChanged() // esto es mio... si soporta vista anterior, coloco oldView para que quede registrado donde tiene que volver if (SelectedView is ISupportPreviousView) { ((ISupportPreviousView)SelectedView).PreviousViewType = oldType; } // esto tambien es mio... si la vista es tipo navegador, los eventos de navegación deberian replicarse .... }
public async Task Handle(HttpRequest req, HttpResponse res, object model, CancellationToken cancellationToken) { var source = viewLocator.GetView(model, res.HttpContext); if (string.IsNullOrEmpty(source)) { res.StatusCode = 500; res.ContentType = "text/plain"; await res.WriteAsync("View not found", cancellationToken); } var template = Handlebars.Compile(source); res.ContentType = "text/html"; res.StatusCode = (int)HttpStatusCode.OK; await res.WriteAsync(template(model), cancellationToken); }
public async Task Handle(HttpRequest req, HttpResponse res, object model, CancellationToken cancellationToken) { var source = viewLocator.GetView(model, res.HttpContext); if (string.IsNullOrEmpty(source)) { res.StatusCode = 500; res.ContentType = "text/plain"; await res.WriteAsync("View not found", cancellationToken); } var stubble = new StubbleBuilder().Build(); res.ContentType = "text/html"; res.StatusCode = (int)HttpStatusCode.OK; var output = await stubble.RenderAsync(source, model); await res.WriteAsync(output, cancellationToken); }
public object GetView(Type type) { return(serviceProvider.GetService(viewLocator.GetView(type))); }