상속: Wodsoft.ComBoost.Wpf.EntityPage
예제 #1
0
        public virtual EntityViewer GetViewer <TEntity>() where TEntity : class, IEntity, new()
        {
            IEntityQueryable <TEntity> context = EntityBuilder.GetContext <TEntity>();

            EntityMetadata metadata = EntityAnalyzer.GetMetadata <TEntity>();

            EntityViewModel <TEntity> model = new EntityViewModel <TEntity>(context.OrderBy());

            model.Headers = metadata.ViewProperties;
            model.UpdateItems();

            EntityViewer viewer = new EntityViewer(this);

            viewer.Model = model;

            WpfViewButton createButton = new WpfViewButton();

            createButton.Name    = "Create";
            createButton.Command = new EntityCommand(new EntityCommand.ExecuteDelegate(t =>
            {
                viewer.NavigationService.Navigate(GetEditor <TEntity>(context.Create()));
            }));
            model.Buttons = new EntityViewButton[] { createButton };

            return(viewer);
        }
예제 #2
0
        public virtual async Task <EntityViewer> GetViewer()
        {
            EntityViewModel <TEntity> model = await GetViewModel(EntityQueryable.OrderBy(), 1, 20);

            EntityViewer viewer = new EntityViewer();

            viewer.Model = model;

            return(viewer);
        }
예제 #3
0
        private static void ModelChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            EntityViewer viewer = (EntityViewer)d;

            if (e.NewValue == null)
            {
                viewer.NavigatePageCommand   = null;
                viewer.ChangePageSizeCommand = null;
            }
            else
            {
                viewer.NavigatePageCommand   = new NavigatePageCommand((EntityViewModel)e.NewValue);
                viewer.ChangePageSizeCommand = new ChangePageSizeCommand((EntityViewModel)e.NewValue);
            }
        }
예제 #4
0
        private static void ModelChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            EntityViewer viewer = (EntityViewer)d;

            if (e.NewValue == null)
            {
                viewer.NavigatePageCommand   = null;
                viewer.ChangePageSizeCommand = null;
                viewer.EntityViewCommand     = null;
                viewer.EntityItemCommand     = null;
            }
            else
            {
                IEntityViewModel model = (IEntityViewModel)e.NewValue;
                viewer.NavigatePageCommand   = new ViewerNavigatePageCommand(viewer.ServiceProvider);
                viewer.ChangePageSizeCommand = new ViewerChangePageSizeCommand(viewer.ServiceProvider);
                viewer.EntityViewCommand     = new ViewerEntityViewCommand(viewer.ServiceProvider);
                viewer.EntityItemCommand     = new ViewerEntityItemCommand(viewer.ServiceProvider);
                viewer.Title = "列表 " + model.Metadata.Name;
            }
        }
예제 #5
0
        public void SetTarget(IServiceProvider provider)
        {
            EntityViewer viewer = (EntityViewer)provider.GetService(typeof(EntityViewer));

            InvokeDelegate = GetInvokeDelegate(viewer);
        }
예제 #6
0
 public ViewerNavigatePageCommand(IServiceProvider serviceProvider)
     : base(serviceProvider)
 {
     _Viewer = (EntityViewer)serviceProvider.GetService(typeof(EntityViewer));
 }
예제 #7
0
 public ViewerChangePageSizeCommand(IServiceProvider serviceProvider)
     : base(serviceProvider)
 {
     _Viewer = (EntityViewer)serviceProvider.GetService(typeof(EntityViewer));
 }