This project has moved and is read-only. For the latest updates, please go here.


Jan 3, 2016 at 10:05 PM
I love what you did with webhelper, having progress reporting is very nice.

I am a little confused though the options.values comment says
This can be an object with the properties as parameters (recommend anonymous object) or it can be a WebParameterDictionary.
I cannot find a WebParameterDictionary object, and the code doesn't suggest it would work any differently if there was (unless it had a custom type descriptor to provide its entries as properties), and i tried supplying a pre configured webParameters as the value to not avail.

Would it not be better to check if the values object is already of type webParameters if so skip the conversion process.

While also allowing to add a (name, object) directly to webParameters (which would be the guts of the existing add, just without the property search) so we can dynamically add the items (eg one could have an array of named files,strings etc instead of a fixed collection of properties (i did write my own version of webParameters.add that took care of this part but it would be nice to have it baked in)
Jan 4, 2016 at 7:54 AM
Thank you for your comment. I joined this project at a late state and less familiar with the code you mentioned. I'll let the original author and the owner of BizArk to address this: Brian
Jan 5, 2016 at 2:59 AM
Edited Jan 5, 2016 at 3:03 AM
The comment doesn't look correct. The documentation page for this object seems to have some examples of how to call the object, though it doesn't include setting the WebHelperOptions.Values property directly (it passes in an argument object to a method that eventually sets that value).

I always use an anonymous object when setting it, like this (from memory in an email editor, you will want to verify the code is correct)...
var web = new WebHelper(url); 
web.Options.Values = new  { 
    Test = "Hello", 
    File1 = new UploadFile(@"text\plain", "file1.txt", new MemoryStream(Encoding.UTF8.GetBytes("Hello World"))), 
    File2 = new FileInfo("MyFile.txt") 
I've done some interesting things with property bags in the version I maintain for my work (a lot more flexible, supporting dictionaries, dynamics, etc.). I'll have to fold those in to BizArk. Unfortunately I don't have access to my development environment for BizArk right now, so, until I get the chance to make the change, you will probably just want to use an anonymous object.

If you want to make a small change to the code, you can update WebHelper.cs, so that if Options.Values is already a WebParameters object, it just uses that instead of creating a new WebParameters object (it's in private WebHelperResponse MakeRequest_Internal()). If you submit a pull request for that, I should be able to review it and accept it pretty quickly (as long as it doesn't require my dev env).