public void NavigateToSearchView <TViewModel>(Action <TViewModel> callBack) where TViewModel : ISearchableViewModel { var viewModel = Locator.Resolve <TViewModel>(); var view = _viewFactory.CreateView(viewModel); var viewController = _viewAdapter.GetSearchView(view); callBack?.Invoke(viewModel); _navigationController.PushViewController(viewController, false); }
public async Task <IndexViewModel> GetAttendancesIndexViewModelAsync() { IEnumerable <AttendanceDTO> attendances = await attendanceService.GetAllAsyncWithDayAndStudents(); var viewModelData = new IndexViewData(attendances); IndexViewModel viewModel = viewFactory.CreateView <IndexViewData, IndexViewModel>(viewModelData); return(viewModel); }
public async Task <MentorsHomeViewModel> GetHomeViewModelAsync(string mentorId) { MentorDTO mentor = await mentorService.GetByIdWithStudentsAndAssignmentsAsync(mentorId); var viewModelData = new HomeViewData(mentor); MentorsHomeViewModel viewModel = viewFactory.CreateView <HomeViewData, MentorsHomeViewModel>(viewModelData); return(viewModel); }
public void Run() { int choice = 0; do { ViewFactory.CreateView(0).Show(); choice = GetChoice(); if (choice == 5) { return; } ViewFactory.CreateView(choice).Show(); } while (choice != 5); }
public ActionResult Index() { var viewModel = new DashboardModel { LowStockColours = _viewFactory.CreateView <Filter <IEnumerable <ProductViewModel> >, IEnumerable <ProductViewModel> >( new ByTypeWithStockBelow(ProductType.Colour, 5)), NoStockColours = _viewFactory.CreateView <Filter <IEnumerable <ProductViewModel> >, IEnumerable <ProductViewModel> >( new ByTypeWithNoStock(ProductType.Colour)) }; return(View(viewModel)); }
// *** Private Methods *** private void CreatePage(NavigationEntry entry) { // Create the View IViewLifetimeContext viewLifetimeContext = viewFactory.CreateView(entry.PageName); entry.ViewLifetimeContext = viewLifetimeContext; // Activate the view model if it implements IActivatable<,> // NB: Use reflection as we do not know the generic parameter types object viewModel = entry.ViewLifetimeContext.ViewModel; Type activatableInterface = ReflectionHelper.GetClosedGenericType(viewModel, typeof(IActivatable <,>)); if (activatableInterface != null) { // If required deserialize the arguments and state entry.DeserializeData(activatableInterface.GenericTypeArguments[0], activatableInterface.GenericTypeArguments[1]); // Activate the view model MethodInfo activateMethod = activatableInterface.GetTypeInfo().GetDeclaredMethod("Activate"); activateMethod.Invoke(viewModel, new object[] { entry.Arguments, entry.State }); } }
private Fragment GetFragment <TViewModel>(TViewModel viewModel) { var view = _viewFactory.CreateView(viewModel); var fragment = _viewAdapter.GetView(view); return(fragment); }
public override NSView GetViewForItem(NSTableView tableView, NSTableColumn tableColumn, nint row) { var tableRow = _dataSource.GetRow((int)row); NSView view = null; if (tableRow.GroupItem) { view = _viewFactory.CreateView(tableRow, string.Empty); } else { view = _viewFactory.CreateView(tableRow, tableColumn.Identifier); } return(view); }
public override NSView GetView(NSOutlineView outlineView, NSTableColumn tableColumn, NSObject item) { var tableRow = (ITreeTableRow)item; NSView view = null; if (tableRow.GroupItem) { view = _viewFactory.CreateView(tableRow, string.Empty); } else { view = _viewFactory.CreateView(tableRow, tableColumn.Identifier); } return(view); }
public IHttpActionResult GetById(int id) { if (id < 1) { return(BadRequest()); } var product = _viewFactory.CreateView <Filter <ProductViewModel>, ProductViewModel>( new ByProductId(id)); if (product == null) { return(NotFound()); } return(Ok(product)); }
private void CreateCustomer(object param) { var customerView = _viewFactory.CreateView <ICustomerView>(); if (customerView.ShowDialog() == true) { // Refresh the list OnPropertyChanged(nameof(Customers)); } }
public async Task <IndexViewModel> GetIndexViewModelAsync() { IEnumerable <SubmissionDTO> submissions = await service.GetAllWithStudentAssignmentSubmitFileAsync(); var viewModelData = new IndexViewData(submissions); IndexViewModel viewModel = viewFactory.CreateView <IndexViewData, IndexViewModel>(viewModelData); return(viewModel); }
private DataTemplate ViewToTemplate <T>() where T : View { return(new DataTemplate(() => { var view = _viewFactory.CreateView(typeof(T)); Debug.Assert(view != null); view.BindingContext = BindingContext; return new ContentView { Content = view }; })); }
private void EditAlbum(Album album) { dynamic view = null; AlbumEditDialogViewModel viewModel = null; _viewFactory.CreateView <AlbumEditDialogView, AlbumEditDialogViewModel>(ref view, ref viewModel); viewModel.Initialize(album); view.Show(); viewModel.Completed += (s, e) => view.Close(); }
public void OpenView(object parameter) { try { _viewFactory.CreateView((Type)parameter); } catch (InvalidCastException exception) { _logger.Error("Invalid parameter was passed to create view method: {0} || Source: {1}", exception.Message, exception.Source); } }
public async Task <IndexViewModel> GetWorkDaysIndexViewModel() { IEnumerable <WorkDayDTO> workDayDTOs = await workDayService.GetAllAsync(); IEnumerable <WorkDayViewModel> workDayViewModels = viewModelFactory.CreateView <IEnumerable <WorkDayDTO>, IEnumerable <WorkDayViewModel> >(workDayDTOs); var viewModelData = new IndexViewData(workDayDTOs); IndexViewModel viewModel = viewModelFactory.CreateView <IndexViewData, IndexViewModel>(viewModelData); return(viewModel); }
public async Task <IndexViewModel> GetIndexViewModelAsync() { IEnumerable <StudentDTO> students = await studentService.GetAllAsync(); var pageData = new IndexViewData(students); IndexViewModel viewModel = viewFactory.CreateView <IndexViewData, IndexViewModel>(pageData); return(viewModel); }
public async Task <FillViewModel> GetFillViewModelAsync(int journalId) { JournalDTO journal = await service.GetByIdAsyncWithWorkDaysAndMentor(journalId); if (journal == null) { return(null); } var viewModelData = new FillViewData(journal); FillViewModel viewModel = viewFactory.CreateView <FillViewData, FillViewModel>(viewModelData); return(viewModel); }
public void ShowMainForm() { var presenter = new BuildListPresenter(mViewFactory.CreateView <IBuildListView>(), mManagersConfigurator.GetBuildOrdersManager()); SetCurrentPresenter(presenter, presenter.View); presenter.LoadBuildList(); presenter.ShowNormalView(); }
private void OnViewFactoryChanged() { // Determine if the value has actually changed. if (ViewFactory == viewFactoryValue) return; IsViewLoaded = false; // Update visual state. viewFactoryValue = ViewFactory; var view = ViewFactory == null ? null : viewFactoryValue.CreateView(); // Wire up events. if (view != null) view.Loaded += OnViewLoaded; // Insert into visual tree. viewModel.Content = view; }
/// <summary>Adds the view created from the given model to the host canvas.</summary> /// <param name="model">The model to add.</param> /// <returns>The view created for the model.</returns> public static IView AddModel(IViewFactory model) { if (Script.IsNullOrUndefined(model)) throw new Exception("A model was not specified."); IView control = model.CreateView(); AddControl(control); return control; }
public void NavigateTo <TViewModel>() where TViewModel : BaseViewModel { PushPage <TViewModel>(_viewFactory.CreateView <TViewModel>()); }
private void ShowSecondWindow() { var view = viewFactory.CreateView <ISecondView>(); view.Show(); }
public ActionResult Index() { return(View(viewFactory.CreateView <HomeView>())); }
public static object CreateView(this IViewFactory factory, ViewModel viewModel) { return(factory.CreateView(viewModel.GetPrefix(), viewModel.GetName())); }
public ActionResult Index() { var viewModel = _viewFactory.CreateView <IEnumerable <ProductViewModel> >(); return(View(viewModel)); }