コード例 #1
0
ファイル: CodeBlocksTemplate.cs プロジェクト: 569550384/Rafy
        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;
        }
コード例 #2
0
ファイル: CodeBlocksTemplate.cs プロジェクト: 569550384/Rafy
        protected override AggtBlocks DefineBlocks()
        {
            var entityType = this.EntityType;

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

            var mainBlock = new Block(entityType);

            return this.ReadCode(em, mainBlock);
        }
コード例 #3
0
ファイル: BlocksTemplate.cs プロジェクト: 569550384/Rafy
 /// <summary>
 /// 当每一个界面块对应的视图元数据生成完成后发生的事件。
 /// </summary>
 /// <param name="block"></param>
 protected virtual void OnViewMetaCreated(Block block)
 {
 }
コード例 #4
0
ファイル: LogicalViewFactory.cs プロジェクト: 569550384/Rafy
        /// <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);
        }
コード例 #5
0
ファイル: PermissionProvider.cs プロジェクト: 569550384/Rafy
 /// <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;
 }
コード例 #6
0
ファイル: PermissionProvider.cs プロジェクト: 569550384/Rafy
 /// <summary>
 /// 控制某一个块是否可以显示
 /// </summary>
 /// <param name="module"></param>
 /// <param name="block"></param>
 /// <returns></returns>
 protected internal virtual bool CanShowBlock(ModuleMeta module, Block block)
 {
     return true;
 }
コード例 #7
0
ファイル: Commands.cs プロジェクト: 569550384/Rafy
        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);
            }
        }
コード例 #8
0
 protected override bool HasCommand(ModuleMeta module, Block block, string commandKey)
 {
     return HasModuleOperation(module.KeyLabel, block.KeyLabel, commandKey);
 }
コード例 #9
0
 protected override bool CanShowBlock(ModuleMeta module, Block block)
 {
     return HasModuleOperation(module.KeyLabel, block.KeyLabel, SystemOperationKeys.Read);
 }
コード例 #10
0
        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
                    );
            }
        }
コード例 #11
0
        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);
            }
        }
コード例 #12
0
ファイル: PermissionMgr.cs プロジェクト: 569550384/Rafy
 /// <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);
 }
コード例 #13
0
ファイル: PermissionMgr.cs プロジェクト: 569550384/Rafy
 /// <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);
 }