/// <summary> /// Initializes a new instance of the <see cref="UploadAsyncSettings" /> class. /// </summary> public UploadAsyncSettings(Upload uploadComponent) { upload = uploadComponent; Save = new RequestSettings(); Remove = new RequestSettings(); AutoUpload = true; }
public void SerializeTo(string key, IClientSideObjectWriter writer, IEditorUrlBuilder urlBuilder) { Func <string, string> encoder = url => owner.IsSelfInitialized ? HttpUtility.UrlDecode(url) : url; var json = new Dictionary <string, string>(); if (Select.HasValue()) { json["selectUrl"] = encoder(urlBuilder.PrepareUrl(Select)); } if (Thumbnail.HasValue()) { json["thumbUrl"] = encoder(urlBuilder.PrepareUrl(Thumbnail)); } if (Image.HasValue()) { json["imageUrl"] = encoder(urlBuilder.PrepareUrl(Image)); } if (Upload.HasValue()) { json["uploadUrl"] = encoder(urlBuilder.PrepareUrl(Upload)); } if (DeleteFile.HasValue()) { json["deleteFileUrl"] = encoder(urlBuilder.PrepareUrl(DeleteFile)); } if (DeleteDirectory.HasValue()) { json["deleteDirectoryUrl"] = encoder(urlBuilder.PrepareUrl(DeleteDirectory)); } if (CreateDirectory.HasValue()) { json["createDirectoryUrl"] = encoder(urlBuilder.PrepareUrl(CreateDirectory)); } if (Filter.HasValue() && Filter != DefaultFilter) { json["filter"] = Filter; } writer.AppendObject(key, json); }
public UploadSerializationTests() { textWriter = new Mock<TextWriter>(); textWriter.Setup(tw => tw.Write(It.IsAny<string>())).Callback<string>(s => output += s); var urlGeneratorMock = new Mock<IUrlGenerator>(); urlGeneratorMock.Setup(g => g.Generate(It.IsAny<RequestContext>(), It.IsAny<INavigatable>())) .Returns<RequestContext, INavigatable>( (context, navigatable) => navigatable.ControllerName + "/" + navigatable.ActionName ); localizationServiceMock = new Mock<ILocalizationService>(); localizationServiceMock.SetupGet(ls => ls.IsDefault).Returns(true); localizationServiceMock.Setup(l => l.All()).Returns(() => new Dictionary<string, string> { { "Remove", "Entfernen" } }); upload = UploadTestHelper.CreateUpload(urlGeneratorMock.Object, localizationServiceMock.Object); upload.Name = "Upload"; }
public UploadBuilderTests() { upload = UploadTestHelper.CreateUpload(); builder = new UploadBuilder(upload); }