My first trial - custom controls & HTTP calls

Please post public support tickets here. Note: for private support tickets, please send an email to support@cshtml5.com instead.
pashaz03
Posts: 5
Joined: Sun Nov 02, 2014 7:45 am

My first trial - custom controls & HTTP calls

Postby pashaz03 » Sun Nov 02, 2014 8:04 am

Dear Development Team,

Please guide me whether you are going to support the http schema in the Image element? Now the ms-appx is supported only.

Another relating question: is it possible to interit a custom control from FrameworkElement and implement an HTML tag (e.g. <img> with a http-like reference inside)? I tried to inherit Class1 from FrameworkElement (located in another library) however your XAML parser cannot find it when I reference to lib:Class1 in XAML.

Thanks for your job,
Many people wait for the next release with the coming features!

Pavel

JS-Support @Userware
Site Admin
Posts: 1142
Joined: Tue Apr 08, 2014 3:42 pm

Re: My first trial

Postby JS-Support @Userware » Mon Nov 03, 2014 11:38 am

Dear Pavel,

Thanks a lot for your message!

Please guide me whether you are going to support the http schema in the Image element? Now the ms-appx is supported only.


Yes, Beta 2 will support the http schema in the Image element.

is it possible to interit a custom control from FrameworkElement and implement an HTML tag (e.g. <img> with a http-like reference inside)


Beta 2 will let you define your own custom controls and implement HTML tags.

This is what a custom Image control (built from scratch) looks like in the Beta 2:

Code: Select all

public class MyCustomImageControl : FrameworkElement
{
    public MyCustomImageControl()
    {
        // Specify the HTML representation of the control
        CSharpXamlForHtml5.DomManagement.SetHtmlRepresentation(this, "<img/>");
    }

    // Dependency Property to store the Image Source URL
    public string Source
    {
        get { return (string)GetValue(SourceProperty); }
        set { SetValue(SourceProperty, value); }
    }
    public static readonly DependencyProperty SourceProperty =
        DependencyProperty.Register("Source", typeof(string), typeof(MyCustomImageControl), new PropertyMetadata("", Source_Changed));

    // Called when the "Source" property changes
    static void Source_Changed(DependencyObject sender, DependencyPropertyChangedEventArgs e)
    {
        var control = (MyCustomImageControl)sender;
        var newValue = (string)e.NewValue;

        // Always check that the control is in the Visual Tree before modifying its HTML representation
        if (CSharpXamlForHtml5.DomManagement.IsControlInVisualTree(control))
        {
            // Update the "src" property of the <img> tag
            CSharpXamlForHtml5.DomManagement.GetDomElementFromControl(control).src = newValue;
        }
    }
}


The Beta 2 will be released in just a few weeks. Stay tuned :-)

Thanks for your job


Thanks a lot! Please feel free to provide further feedback. The earliest we receive feedback, the more chances that the features will be implemented in time for the v1.0.

Regards,
JS-Support

pashaz03
Posts: 5
Joined: Sun Nov 02, 2014 7:45 am

Re: My first trial

Postby pashaz03 » Tue Nov 04, 2014 7:52 am

It sounds amazing! I will look forward the coming beta 2 where I would try to implement our medical image viewer.

May I ask you when you are going to release it?

Best regards,
Pavel

JS-Support @Userware
Site Admin
Posts: 1142
Joined: Tue Apr 08, 2014 3:42 pm

Re: My first trial

Postby JS-Support @Userware » Fri Nov 07, 2014 10:34 am

Thanks a lot Pavel.

As far as the release date is concerned, we are working hard to release the Beta2 as soon as possible, but we may need some more time to fine-tuned the new features.

I will keep you updated as soon as possible.

Thanks again,

Best regards,
JS-Support

pashaz03
Posts: 5
Joined: Sun Nov 02, 2014 7:45 am

Re: My first trial

Postby pashaz03 » Sun Nov 30, 2014 6:49 pm

Dear Team,

I have downloaded the Beta 2 and enjoy with the http schema in Images.

Now I have to access a back-end by HTTP in order to know image URLs. How to call the HTTP service returning data in JSON?

Thanks,
Pavel

JS-Support @Userware
Site Admin
Posts: 1142
Joined: Tue Apr 08, 2014 3:42 pm

Re: My first trial

Postby JS-Support @Userware » Thu Dec 04, 2014 5:35 am

Hi Pavel,

Thanks a lot for the follow up!

I am glad you like the Beta 2.

As for HTTP calls, we are working hard to implement this feature as soon as possible. We plan to release it as an optional Business feature in time for the release of the v1.0, which is expected in the coming months.

Thanks again, and please do not hesitate to suggest more features.

Best regards,

JS-Support

pashaz03
Posts: 5
Joined: Sun Nov 02, 2014 7:45 am

Re: My first trial

Postby pashaz03 » Sun Dec 07, 2014 8:41 pm

Dear Support Team,

Nice to hear the release is coming soon! I understand you are going to release two versions, I definitly need the Bussiness one.

Let me summarize the main points of the planned application:
- Images IDs are specified in the query string like ?Uid=xxx&... I must know the query parameters in the C# code
- Then the specified images download from an HTTP service in the 8-bit JPEG or 8/16-bit PNG or 8/16-bit RAW format
- The images are placed onto the Grid
- The user can manipulate with images by applying:
* Transformations (I suppose to change the RenderTransform)
* Brightness/contrast conversion and inversion (16 bits convert to 8 bits by the linear LUT)
* Overlay like Line, Rectangle, etc.

Please look at the mentioned points, especially at the brightness/contrast item, I have no guess how to do it. As soon as your software implements these features, I am going to involve it into commerical deals of my company. We can provide you a lot of references world-wide.

Thanks,
Pavel

JS-Support @Userware
Site Admin
Posts: 1142
Joined: Tue Apr 08, 2014 3:42 pm

Re: My first trial

Postby JS-Support @Userware » Fri Dec 12, 2014 4:53 am

Thanks Pavel for your reply!

Ok, we are going to think about those features and start working on them. Please feel free to add them also to cshtml5.UserVoice.com so that other people can also vote for them and post comments.

For the brightness/contrast item, we will probably need an implementation of the "WritableBitmap" class. We are going to look into that.

Our current main area of focus is HTTP request, which we are trying to include in the v1.0. Can you please provide as many details as possible regarding your needs for this feature? (I am referring to when you said: "access a back-end by HTTP in order to know image URLs")
  • How do you currently call the service? (if you could provide us with the bit of source code that you currently use to call the service, that would be great for us to make sure we implement the same API)
  • Is the service REST? Do you call it with GET, POST, or PUT?
  • Does the service require authentication? What type is it? (basic HTTP authentication?)
  • Does the service take any arguments? How do you currently pass them?
  • Can you please provide an example of JSON response that the service returns? (That would be great for us to make sure that it is possible to parse it correctly)
  • If needed, would it be an issue for you to replace the service with a SOAP one?

Thanks again.

If other people have other scenarios for HTTP request, please feel free to join the discussion and share your thoughts.

Best regards,

JS-Support

pashaz03
Posts: 5
Joined: Sun Nov 02, 2014 7:45 am

Re: My first trial

Postby pashaz03 » Tue Dec 16, 2014 1:49 pm

Dear Support Team!

You are right, we need the WritableBitmap class to convert 8/16 original data into output RGBs.

About the HTTP service: I call a method (HTTP-GET) to get the image tags in JSON format. ID is included into the tags. Then I call another method and pass the ID, it returns a binary stream which is JPEG now. I can return 16-bits ZIP data in the future (after you implement WritableBitmap), apply the brightness/contrast conversion and generate the data in RGB format.

This is not a problem to use SOAP instead of HTTP, of course.

Regards,
Pavel

JS-Support @Userware
Site Admin
Posts: 1142
Joined: Tue Apr 08, 2014 3:42 pm

Re: My first trial

Postby JS-Support @Userware » Fri Dec 19, 2014 9:20 am

Thanks a lot Pavel.

We are making good progress. I will keep you updated as soon as possible. Hopefully we will have a new version in January.

Best regards,
JS-Support

JS-Support @Userware
Site Admin
Posts: 1142
Joined: Tue Apr 08, 2014 3:42 pm

Re: My first trial

Postby JS-Support @Userware » Tue Mar 31, 2015 4:14 am

Hi Pavel,

I am pleased to inform you that HTTP calls have been implemented in Beta 3. You will find the full list of new features here.

Please make sure to also check out the current list of WCF limitations and tutorials, which also includes information about REST calls.

Let me know if I can help.

Thanks.
Regards,
JS-Support

labbr01
Posts: 6
Joined: Fri Jul 17, 2015 10:20 am

Re: My first trial - HTTP calls

Postby labbr01 » Fri Dec 04, 2015 5:06 am

I am evaluating the WebClient with beta 6.
With this post and example (Tutorial to easily create a REST-based client/server app in CSHTML5), i have been able to make your sample work. Unfortunatly for me, the real url i need to call is external to the project localhost web site, and it's also secure using Active Directory security, because services on that site are base on credentials to get roles and tasks.

So when i try WebCall with the url, response object return is an error (401) and i see the same when tracing with fiddler.
I would have hope the call been made with the current (or default) credential, but it does not seem to be the case.
The WebClient Credential property does not exist. Do you have plan to support http request with authentification soon or later, or the only solution would be to create a proxy class in the hosting website?


Return to “Technical Support”

Who is online

Users browsing this forum: No registered users and 34 guests