public static ContentPage ResolveByContext(EbMobileVisualization vis, EbDataRow row, EbMobilePage page)
        {
            ContentPage       renderer  = null;
            EbMobileContainer container = page.Container;

            try
            {
                if (container is EbMobileForm form)
                {
                    if (vis.FormMode == WebFormDVModes.New_Mode)
                    {
                        string msg = GetFormRenderInvalidateMsg(page.NetworkMode);
                        if (msg != null && !form.RenderAsFilterDialog)
                        {
                            renderer = new Redirect(msg, MessageType.disconnected);
                        }
                        else
                        {
                            renderer = new FormRender(page, vis.LinkFormParameters, row);
                        }
                    }
                    else
                    {
                        EbMobileDataColToControlMap map = vis.FormId;
                        if (map == null)
                        {
                            EbLog.Info("form id must be set");
                            throw new Exception("Form rendering exited! due to null value for 'FormId'");
                        }
                        else
                        {
                            int id = Convert.ToInt32(row[map.ColumnName]);
                            if (id <= 0)
                            {
                                EbLog.Info($"formid has invalid value {id}, switching to new mode");
                                renderer = new FormRender(page, vis.LinkFormParameters, row);
                            }
                            else
                            {
                                EbLog.Info($"formid has value {id}, rendering edit mode");
                                renderer = new FormRender(page, id);
                            }
                        }
                    }
                }
                else if (container is EbMobileVisualization)
                {
                    renderer = new LinkedListRender(page, vis, row);
                }
                else if (container is EbMobileDashBoard)
                {
                    renderer = new DashBoardRender(page);
                }
            }
            catch (Exception ex)
            {
                EbLog.Error(ex.Message);
            }
            return(renderer);
        }
        public FormRenderVMR(EbMobilePage page, EbMobileVisualization source, EbDataRow contextrow) : base(page)
        {
            this.Mode = FormMode.REF;

            context    = source;
            contextRow = contextrow;
        }
        protected void SetFrameStyle(EbMobileVisualization viz)
        {
            if (!IsHeader)
            {
                EbThickness pd = viz.Padding ?? new EbThickness(10);
                EbThickness mr = viz.Margin ?? new EbThickness();

                this.Padding = new Thickness(pd.Left, pd.Top, pd.Right, pd.Bottom);
                this.Margin  = new Thickness(mr.Left, mr.Top, mr.Right, mr.Bottom);

                DynamicGrid.XAllocated = App.ScreenX - (pd.Left + pd.Right + mr.Left + mr.Right);
            }
            try
            {
                this.BackgroundColor = Color.FromHex(viz.BackgroundColor ?? "#ffffff");
                this.CornerRadius    = viz.BorderRadius;
                if (!IsHeader)
                {
                    this.BorderColor = Color.FromHex(viz.BorderColor ?? "#ffffff");
                    this.HasShadow   = viz.BoxShadow;
                }
            }
            catch (Exception ex)
            {
                EbLog.Info("Frame style issue");
                EbLog.Error(ex.Message);
            }
        }
        public DynamicFrame(EbDataRow row, EbMobileVisualization viz, bool isHeader = false)
        {
            this.IsHeader = isHeader;
            this.DataRow  = row;

            this.Initialize(viz);
        }
        public LinkedListRender(EbMobilePage page, EbMobileVisualization context, EbDataRow row)
        {
            InitializeComponent();
            BindingContext     = ViewModel = new LinkedListViewModel(page, context, row);
            ViewModel.EbLayout = EbLayout;

            this.DrawContextHeader(row, context);
            EbLayout.ShowLoader();
        }
        private void DrawContextHeader(EbDataRow row, EbMobileVisualization context)
        {
            var header = new DynamicFrame(row, context, true)
            {
                BackgroundColor = Color.Transparent,
                Padding         = new Thickness(20, 10, 20, 0),
                Margin          = 0
            };

            HeaderContainer.Children.Add(header);
        }
        protected void Initialize(EbMobileVisualization viz)
        {
            DynamicGrid = new DynamicGrid(viz.DataLayout);
            DynamicGrid.SetSpacing(viz.RowSpacing, viz.ColumnSpacing);

            this.SetFrameStyle(viz);

            this.FillData(viz.DataLayout.CellCollection);

            if (viz.ShowLinkIcon && !this.IsHeader)
            {
                DynamicGrid.ShowLinkIcon();
            }
            this.Content = DynamicGrid;
        }
Пример #8
0
 public LinkedListViewModel(EbMobilePage page, EbMobileVisualization context, EbDataRow row) : base(page)
 {
     this.Context       = context;
     this.ContextRecord = row;
 }
 //reference mode
 public FormRender(EbMobilePage page, EbMobileVisualization context, EbDataRow contextRow)
 {
     InitializeComponent();
     BindingContext = viewModel = new FormRenderVMR(page, context, contextRow);
 }
 public StaticLSFrame(EbMobileStaticListItem item, EbMobileVisualization viz, bool isHeader = false)
 {
     StaticItem = item;
     IsHeader   = isHeader;
     Initialize(viz);
 }