Create() public static méthode

Creates a blank vertical stack of controls.
public static Create ( bool isStandard, IEnumerable tailUpdateRegions = null, IEnumerable itemInsertionUpdateRegions = null ) : ControlStack
isStandard bool Sets whether or not this control stack will have standard styling.
tailUpdateRegions IEnumerable
itemInsertionUpdateRegions IEnumerable
Résultat ControlStack
Exemple #1
0
        private void createChildControlsAndWireUpEvents()
        {
            captionTable          = TableOps.CreateUnderlyingTable();
            captionTable.CssClass = "ewfStandardDynamicTableCaption";
            captionTable.Visible  = false;
            var row = new TableRow();

            var captionCell = new TableCell();

            captionCell.Controls.Add(captionStack = ControlStack.Create(false));
            row.Cells.Add(captionCell);

            var actionLinksCell = new TableCell {
                CssClass = "ewfAddItemLink"
            };

            actionLinksCell.Controls.Add(actionLinkStack = ControlStack.Create(false));
            row.Cells.Add(actionLinksCell);

            captionTable.Rows.Add(row);
            Controls.Add(captionTable);

            table = TableOps.CreateUnderlyingTable();
            Controls.Add(table);

            PreRender += ewfTable_PreRender;

            dataModifications = FormState.Current.DataModifications;
        }
        // NOTE: EVERYTHING should be done here. We shouldn't have LoadData. We should audit everyone using this control and see if we can improve things.
        // NOTE: This should also be full of delegates that run when events (such as deleting a file) are occurring.
        // NOTE: There should be a way to tell if a file was uploaded.
        void ControlTreeDataLoader.LoadData()
        {
            if (fileCollectionId != null)
            {
                file = BlobFileOps.GetFirstFileFromCollection(fileCollectionId.Value);
            }

            var controlStack = ControlStack.Create(true);

            if (file != null)
            {
                var download = new PostBackButton(
                    PostBack.CreateFull(
                        id: PostBack.GetCompositeId("ewfFile", file.FileId.ToString()),
                        actionGetter: () => {
                    // Refresh the file here in case a new one was uploaded on the same post-back.
                    return
                    (new PostBackAction(
                         new SecondaryResponse(new BlobFileResponse(BlobFileOps.GetFirstFileFromCollection(fileCollectionId.Value).FileId, () => true), false)));
                }),
                    new TextActionControlStyle(Translation.DownloadExisting + " (" + file.FileName + ")"),
                    false);
                controlStack.AddControls(download);
            }
            else if (!HideNoExistingFileMessage)
            {
                controlStack.AddControls(new Label {
                    Text = Translation.NoExistingFile
                });
            }

            uploadedFile = new EwfFileUpload();
            if (file != null)
            {
                uploadedFile.SetInitialDisplay(false);
                var replaceExistingFileLink = new ToggleButton(
                    uploadedFile.ToSingleElementArray(),
                    new TextActionControlStyle(Translation.ClickHereToReplaceExistingFile))
                {
                    AlternateText = ""
                };
                controlStack.AddControls(replaceExistingFileLink);
            }

            controlStack.AddControls(uploadedFile);

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

            if (thumbnailControl != null)
            {
                Controls.Add(thumbnailControl);
            }
            Controls.Add(controlStack);
        }
Exemple #3
0
        public BlobFileManager(int?fileCollectionId)
        {
            this.fileCollectionId = fileCollectionId;

            if (fileCollectionId != null)
            {
                file = BlobFileOps.GetFirstFileFromCollection(fileCollectionId.Value);
            }

            var controlStack = ControlStack.Create(true);

            if (file != null)
            {
                var download = new PostBackButton(
                    new TextActionControlStyle(Translation.DownloadExisting + " (" + file.FileName + ")"),
                    usesSubmitBehavior: false,
                    postBack: PostBack.CreateFull(
                        id: PostBack.GetCompositeId("ewfFile", file.FileId.ToString()),
                        actionGetter: () => {
                    // Refresh the file here in case a new one was uploaded on the same post-back.
                    return
                    (new PostBackAction(
                         new SecondaryResponse(new BlobFileResponse(BlobFileOps.GetFirstFileFromCollection(fileCollectionId.Value).FileId, () => true), false)));
                }));
                controlStack.AddControls(download);
            }
            else if (!HideNoExistingFileMessage)
            {
                controlStack.AddControls(new Label {
                    Text = Translation.NoExistingFile
                });
            }

            uploadedFile = new EwfFileUpload();
            if (file != null)
            {
                uploadedFile.SetInitialDisplay(false);
                var replaceExistingFileLink = new ToggleButton(
                    uploadedFile.ToCollection(),
                    new TextActionControlStyle(Translation.ClickHereToReplaceExistingFile),
                    false,
                    (postBackValue, validator) => { })
                {
                    AlternateText = ""
                };
                controlStack.AddControls(replaceExistingFileLink);
            }

            controlStack.AddControls(uploadedFile);

            this.AddControlsReturnThis(BlobFileOps.GetThumbnailControl(file, ThumbnailResourceInfoCreator));
            Controls.Add(controlStack);
        }
        void ControlTreeDataLoader.LoadData()
        {
            CssClass = CssClass.ConcatenateWithSpace(CssElementCreator.CssClass);
            var controlStack = ControlStack.Create(false);

            if (label != null)
            {
                controlStack.AddControls(label);
            }
            if (validation != null)
            {
                controlStack.AddModificationErrorItem(validation, new ListErrorDisplayStyle());
            }
            controlStack.AddControls(new PlaceHolder().AddControlsReturnThis(wrappedControls));
            Controls.Add(controlStack);
        }