Exemple #1
0
        protected AggtBlocks ReadCode(EntityMeta em, Block mainBlock, ReadCodeTemplateOptions op = null)
        {
            op = op ?? new ReadCodeTemplateOptions
            {
                ReadChildren = true,
                ReadQueryPanels = true
            };

            AggtBlocks result = mainBlock;

            if (op.ReadChildren)
            {
                foreach (var property in em.ChildrenProperties)
                {
                    var childBlock = new ChildBlock(property.ManagedProperty as IListProperty);
                    var childAggt = this.ReadCode(property.ChildType, childBlock);

                    result.Children.Add(childAggt);
                }
            }

            if (op.ReadQueryPanels) { this.ReadQueryPanels(em, result); }

            return result;
        }
Exemple #2
0
        protected override AggtBlocks DefineBlocks()
        {
            var entityType = this.EntityType;

            var em = CommonModel.Entities.Get(entityType);

            var mainBlock = new Block(entityType);

            return this.ReadCode(em, mainBlock);
        }
Exemple #3
0
 /// <summary>
 /// 当每一个界面块对应的视图元数据生成完成后发生的事件。
 /// </summary>
 /// <param name="block"></param>
 protected virtual void OnViewMetaCreated(Block block)
 {
 }
Exemple #4
0
        /// <summary>
        /// 根据 blockInfo 中的 int 生成 LogicalView。
        /// </summary>
        /// <param name="block"></param>
        /// <returns></returns>
        public LogicalView CreateView(Block block)
        {
            var evm = block.ViewMeta as WPFEntityViewMeta;

            //如果是自定义视图,则自成该类的对象
            if (block.CustomViewType != null)
            {
                var viewType = Type.GetType(block.CustomViewType);
                var view = Activator.CreateInstance(viewType, evm) as LogicalView;

                this.OnViewCreated(view);

                return view;
            }

            //特殊处理环绕块
            var sur = block as SurrounderBlock;
            if (sur != null)
            {
                var surrounderType = sur.SurrounderType;
                if (surrounderType == NavigationBlock.Type)
                {
                    return this.CreateNavigationQueryView(evm);
                }

                if (surrounderType == ConditionBlock.Type)
                {
                    return this.CreateConditionQueryView(evm);
                }
            }

            //根据 BlockType 的值来生成 LogicalView
            var blockType = block.BlockType;
            if (blockType == BlockType.List) { return this.CreateListView(evm); }
            if (blockType == BlockType.Detail) { return this.CreateDetailView(evm); }
            if (blockType == BlockType.Report) { return this.CreateReportView(evm); }
            return this.CreateCustomBlockView(evm, blockType);
        }
Exemple #5
0
 /// <summary>
 /// 是否能执行某个命令
 /// </summary>
 /// <param name="module"></param>
 /// <param name="block"></param>
 /// <param name="commandName"></param>
 /// <returns></returns>
 protected internal virtual bool HasCommand(ModuleMeta module, Block block, string commandName)
 {
     return true;
 }
Exemple #6
0
 /// <summary>
 /// 控制某一个块是否可以显示
 /// </summary>
 /// <param name="module"></param>
 /// <param name="block"></param>
 /// <returns></returns>
 protected internal virtual bool CanShowBlock(ModuleMeta module, Block block)
 {
     return true;
 }
Exemple #7
0
        public override void Execute(ListLogicalView view)
        {
            var plan = LocateCurrentSummarizingMonth(view);
            if (plan == null)
            {
                App.MessageBox.Show("没有找到本月正在进行中的计划。", MessageBoxButton.OK, MessageBoxImage.Asterisk);
                return;
            }

            var block = new Block(typeof(WeekSummary));

            var ui = AutoUI.AggtUIFactory.GenerateControl(block);

            var weekView = ui.MainView as ListLogicalView;

            MPHelper.ModifyRowStyle(weekView, "WeekSummaryRowStyle");

            SetData(weekView, plan);

            weekView.ExpandAll();

            var btn = App.Windows.ShowDialog(ui.Control, win =>
            {
                win.Title = string.Format("第 {0} 周计划与总结", TimeHelper.CurrentWeekIndex + 1);
                win.Buttons = ViewDialogButtons.YesNo;
            });

            if (btn == WindowButton.Yes)
            {
                ReadData(weekView, plan);
            }
        }
 protected override bool HasCommand(ModuleMeta module, Block block, string commandKey)
 {
     return HasModuleOperation(module.KeyLabel, block.KeyLabel, commandKey);
 }
 protected override bool CanShowBlock(ModuleMeta module, Block block)
 {
     return HasModuleOperation(module.KeyLabel, block.KeyLabel, SystemOperationKeys.Read);
 }
        private void CreateCommandsUI(LogicalView view, Block block)
        {
            if (view == null) throw new ArgumentNullException("view");
            if (block == null) throw new ArgumentNullException("uiInfo");

            var commands = block.ViewMeta.AsWPFView().Commands.Where(c => c.IsVisible).ToList();
            if (commands.Count > 0)
            {
                if (this.NeedPermission)
                {
                    commands = commands.Where(c => PermissionMgr.HasCommand(this.PermissionModule, block, c.Name)).ToList();
                }

                //Toolbar
                view.CommandsContainer = this.CreateCommandsContainer();
                this._viewFactory.BlockUIFactory.AppendCommands(
                    view.CommandsContainer, view, commands
                    );
            }
        }
        private void PopupSelection()
        {
            var refInfo = this.Meta.SelectionViewMeta;

            //界面生成
            var block = new Block(refInfo.SelectionEntityType);
            var title = block.ViewMeta.TitleProperty;
            if (title == null) throw new InvalidOperationException("该实体没有标题属性,不能使用此控件进行编辑。");
            block.ViewMeta.DisableEditing();
            block.ViewMeta.AsWPFView().ClearCommands().UseCommands(typeof(ClearReferenceCommand), typeof(SearchListCommand));
            var ui = AutoUI.AggtUIFactory.GenerateControl(block);
            var listView = ui.MainView as ListLogicalView;
            listView.DataLoader.LoadDataAsync(() =>
            {
                this.SyncValueToSelection(listView);
            });

            //弹出
            var res = App.Windows.ShowDialog(ui.Control, w =>
            {
                w.Title = "选择".Translate() + " " + title.Label.Translate();
                w.Width = 600;
                w.Height = 300;

                listView.Control.MouseDoubleClick += (o, e) =>
                {
                    w.DialogResult = true;
                };
            });

            //确定
            if (res == WindowButton.Yes)
            {
                this.SyncSelectionToValue(listView.SelectedEntities);
            }
        }
Exemple #12
0
 /// <summary>
 /// 是否能执行某个命令
 /// </summary>
 /// <param name="module"></param>
 /// <param name="block"></param>
 /// <param name="commandName"></param>
 /// <returns></returns>
 public static bool HasCommand(ModuleMeta module, Block block, string commandName)
 {
     return Provider.HasCommand(module, block, commandName);
 }
Exemple #13
0
 /// <summary>
 /// 控制某一个块是否可以显示
 /// </summary>
 /// <param name="module"></param>
 /// <param name="block"></param>
 /// <returns></returns>
 public static bool CanShowBlock(ModuleMeta module, Block block)
 {
     return Provider.CanShowBlock(module, block);
 }