Ejemplo n.º 1
0
 protected override void loadData()
 {
     pb = PostBack.CreateFull();
     ph.AddControlsReturnThis(
         FormItemBlock.CreateFormItemTable(heading: "Radio Button List, Vertical", formItems: getRadioItems(false)),
         FormItemBlock.CreateFormItemTable(heading: "Radio Button List, Horizontal", formItems: getRadioItems(true)),
         getSelect2UpgradeTestingInfo(),
         FormItemBlock.CreateFormItemTable(heading: "Drop-Down List", formItems: getDropDownItems()));
     EwfUiStatics.SetContentFootActions(new ActionButtonSetup("Submit", new PostBackButton(pb)));
 }
        private void addFileRow(DynamicTable table, BlobFile file, ActionPostBack deletePb, List <Func <bool> > deleteModMethods)
        {
            var cells = new List <EwfTableCell>();

            var thumbnailControl = BlobFileOps.GetThumbnailControl(file, ThumbnailResourceInfoCreator);

            if (thumbnailControl != null)
            {
                cells.Add(thumbnailControl);
            }

            var fileIsUnread = fileIdsMarkedAsRead != null && !fileIdsMarkedAsRead.Contains(file.FileId);

            cells.Add(
                new PostBackButton(
                    PostBack.CreateFull(
                        id: PostBack.GetCompositeId(postBackIdBase, file.FileId.ToString()),
                        firstModificationMethod: () => {
                if (fileIsUnread && markFileAsReadMethod != null)
                {
                    markFileAsReadMethod(file.FileId);
                }
            },
                        actionGetter: () => new PostBackAction(new SecondaryResponse(new BlobFileResponse(file.FileId, () => true), false))),
                    new TextActionControlStyle(file.FileName),
                    false)
            {
                ToolTip = file.FileName
            });

            cells.Add(file.UploadedDate.ToDayMonthYearString(false));
            cells.Add((fileIsUnread ? "New!" : "").ToCell(new TableCellSetup(classes: "ewfNewness".ToSingleElementArray())));

            var delete         = false;
            var deleteCheckBox =
                FormItem.Create(
                    "",
                    new EwfCheckBox(false, postBack: deletePb),
                    validationGetter: control => new EwfValidation((pbv, v) => { delete = control.IsCheckedInPostBack(pbv); }, deletePb)).ToControl();

            cells.Add(ReadOnly ? null : deleteCheckBox);
            deleteModMethods.Add(
                () => {
                if (!delete)
                {
                    return(false);
                }
                BlobFileOps.SystemProvider.DeleteFile(file.FileId);
                return(true);
            });

            table.AddRow(cells.ToArray());
        }
        private void addFileRow( DynamicTable table, BlobFile file, ActionPostBack deletePb, List<Func<bool>> deleteModMethods )
        {
            var cells = new List<EwfTableCell>();

            var thumbnailControl = BlobFileOps.GetThumbnailControl( file, ThumbnailResourceInfoCreator );
            if( thumbnailControl != null )
                cells.Add( thumbnailControl );

            var fileIsUnread = fileIdsMarkedAsRead != null && !fileIdsMarkedAsRead.Contains( file.FileId );

            cells.Add(
                new PostBackButton(
                    PostBack.CreateFull(
                        id: PostBack.GetCompositeId( postBackIdBase, file.FileId.ToString() ),
                        firstModificationMethod: () => {
                            if( fileIsUnread && markFileAsReadMethod != null )
                                markFileAsReadMethod( file.FileId );
                        },
                        actionGetter: () => new PostBackAction( new SecondaryResponse( new BlobFileResponse( file.FileId, () => true ), false ) ) ),
                    new TextActionControlStyle( file.FileName ),
                    false ) { ToolTip = file.FileName } );

            cells.Add( file.UploadedDate.ToDayMonthYearString( false ) );
            cells.Add( ( fileIsUnread ? "New!" : "" ).ToCell( new TableCellSetup( classes: "ewfNewness".ToSingleElementArray() ) ) );

            var delete = false;
            var deleteCheckBox =
                FormItem.Create(
                    "",
                    new EwfCheckBox( false, postBack: deletePb ),
                    validationGetter: control => new EwfValidation( ( pbv, v ) => { delete = control.IsCheckedInPostBack( pbv ); }, deletePb ) ).ToControl();
            cells.Add( ReadOnly ? null : deleteCheckBox );
            deleteModMethods.Add(
                () => {
                    if( !delete )
                        return false;
                    BlobFileOps.SystemProvider.DeleteFile( file.FileId );
                    return true;
                } );

            table.AddRow( cells.ToArray() );
        }