Example #1
0
        public async virtual Task OnControlAction(EbDataRow row)
        {
            if (string.IsNullOrEmpty(this.LinkRefId))
            {
                return;
            }

            EbMobilePage page = EbPageHelper.GetPage(this.LinkRefId) ?? EbPageHelper.GetExternalPage(this.LinkRefId);

            if (page != null)
            {
                EbMobileContainer container = page.Container;

                if (container is EbMobileForm)
                {
                    if (this.FormMode == WebFormDVModes.New_Mode)
                    {
                        await App.Navigation.NavigateMasterAsync(new FormRender(page, this.LinkFormParameters, row));
                    }
                    else
                    {
                        try
                        {
                            var map = this.FormId;
                            if (map == null)
                            {
                                EbLog.Info("form id should 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("id has ivalid value" + id);
                                    throw new Exception("Form rendering exited! due to invalid id");
                                }
                                await App.Navigation.NavigateMasterAsync(new FormRender(page, id));
                            }
                        }
                        catch (Exception ex)
                        {
                            EbLog.Error(ex.Message);
                        }
                    }
                }
                else if (container is EbMobileVisualization)
                {
                    await App.Navigation.NavigateMasterAsync(new ListRender(page, row));
                }
            }
        }
        private async void OnClick(object sender, EventArgs e)
        {
            if (isTapped)
            {
                return;
            }

            try
            {
                isTapped = true;

                EbMobilePage page = EbPageHelper.GetPage(LinkRefId);

                if (page != null)
                {
                    EbPageRenderer renderer = await EbPageHelper.GetRenderer(page);

                    if (renderer.IsReady)
                    {
                        EbLog.Info(renderer.Message);
                        await App.Navigation.NavigateMasterAsync(renderer.Renderer);
                    }
                    else
                    {
                        EbLog.Error("unable to create renderer, [DataLink] " + renderer.Message);
                    }
                }
                else
                {
                    EbLog.Warning("page not found in [DataLink], Check permission");
                }
            }
            catch (Exception ex)
            {
                EbLog.Info("[EbMobileDashboard] click navigation error");
                EbLog.Error(ex.Message);
            }

            isTapped = false;
        }