I’m re-evaluating WiseJ post full-release and currently very impressed with how the platform has progressed since Beta.
It would help me if you could suggest the best approach to developing a custom control that has high drawing frequency.
The control in question is one we have developed ourselves as a .NET control. It is a time-line bar that smoothly scrolls horizontally with additional zoom in/out. I am currently pondering how one would best convert this for use in WiseJ, obviously the actual GDI logic would probably be identical but:
(I am assuming there is no magic available to convert .NET graphics drawing code into something that would execute on the client-side?)
Thanks for your update Mark !
To use C# 6 with Visual Studio 2012 or 2013 you can take a look here: http://alextselevich.com/2015/08/using-c-6-0-in-visual-studio-2012-and-2013/
Hope that helps.
Just thought I’d keep the thread up to date.
Just one minor niggle… (hardly)
The example way to wrap Widget events seem to be to use C# 6.0 features, including nameof(). Is there an pre-6.0 C# pattern that could work? (for example if using WiseJ on Visual Studio 2012)?
Very interesting. I’ll take a look into DuoCode for sure.
The Canvas control has a LiveUpdate property, when set to true, all canvas calls are pushed to the client. Otherwise it collects the calls into a list and sends them back when the canvas widget “asks” for an update. Usually when the widget asks for a set of records we use http because we can match request/response and process the incoming data.
So the trade off in the Canvas control is to either update the widget on each canvas instructions, or updated it all at once at the end of the processing cycle.
Try also the BackgroundTasks example . It uses 3 Canvas controls to draw the lines as they are sorted in background tasks.
I have now run “IsWebSocket” on a button press rather than in the Load and is it returning True.
I have incorporated the ProgressCircle example code and that is another interesting method, so thanks for mentioning that. Just one question, should the canvas updates come via web-sockets now that it appears that web-sockets are enabled? It appears to be updating via post-backs.
Thanks for your help so far, I will continue to experiment.
If you check IsWebSocket when the application is loaded in Program.Main() it will always be false since the first load is always http and the protocol hasn’t switched yet. You can check Application.Browser.Features.webSocket to see if the client supports it. In subsequent requests Application.IsWebSocket will return true.
However, not all requests coming in from Wisej are always websocket. Data requests from paged/cached data stores (datagrid, listview, fullcalendar, …) are all http requests. All image resources and postbacks are http requests since they are managed by the browser. And the UserPaint technique is simply an image request so while processing the Paint event you will always have IsWebSocket = false.
I don’t know what kind of update speed you need. User paint may not be the right approach. Wisej also supports canvas (HTML5) drawing (see the ProgressCircle extension. You can also try the Wisej.Web.Canvas control. It’s different from user painting, it uses a canvas element on the client and sends actual drawing instructions to the client.
With regards to the required update frequency, yes the demo at:
Is pretty much the type of frequency required, however maybe slightly less than that as most the updates occur because of a mouse drag operation or a mouse zoom in/out operation.
I have tried to build a simple test project to see how fast the WiseJ control paint initiated drawing code operates (over web-sockets). I am running the project under IIS on Windows 10 (although was built using Visual Studio 2017 on Windows 7) and no matter what I try I can’t get the ‘Application.IsWebSocket’ property to become TRUE and the updates are falling-back to using standard HTTP.
Can you give me any other ideas what to try?
Luca it would be cool if you turn this in extension!
it is possible to have a tutorial how do you have create this demo using this external js?
thanks for your feedback. 😉
I do also see these two approaches, both should work really nice with Wisej. Which one to pick is a matter of discussing the pros and cons of each approach. I am not aware of a tool that converts C# to JS as you describe it.
Can you explain a bit further what you mean with “high frequency”? Maybe you can simply give it a try because I suspect that the GDI drawing part will indeed be the same in Wisej. Alternatively, you might want to evaluate D3, which is commonly used for such tasks:
Please login first to submit.