microsoft/winforms-designer-extensibility

Response to blog post

Closed this issue ยท 2 comments

I understand the general principle and problems of the new designer - I understand why the client-server architecture is needed.
The main problem that we need to solve is the transfer of data between the editor (studio - client on net472) and the designer (server process on .Net6+).
I understand that passing a custom (new) type should be more difficult than a type that is already known (there is both in the .net framework and in the .Net).
With all this in mind and with some experience with the new sdk, I'm going to read the blog post...
I read, I understand the general meaning, but I cannot take any new practical sense out of the article :(
I can not catch the causal relationship, why what and when to write. What and for what is necessary. I have never been able to figure out what the minimum set of code is needed to pass data of a known type.

Note: In some circumstances it is necessary that you display a rendered result from a control or component, which is only available server-side. In that case, you would need to create an endpoint which renders that result into a bitmap, and then implement a respective transport class, which would serialize and transfer the content of that bitmap between the processes by byte array.

Alternatively (or in addition), implement results which need to be rendered on the Type Editor UI by providing bitmaps, and transport those as byte-arrays back to the client, where they can converted back to bitmaps and rendered on the surface of the Type Editor dialog.

Ok, this is exactly what I need - I can't get from the article how to achieve this ๐Ÿ˜ฅ

I don't really know how to convey all this information in a way that is clear and doesn't scare people away at the same time. But I'm just trying to give my guesses...
I think that example in the post is overcomplicated as the first example. We have a custom modal form, custom type to transfer and control in place actions. May be start from standard property grid editors with some customizations, remove excess water and give out in small portions from simple to complex (with obligatory migration example - was in .net framework - became in .Net)?

For example:

  1. Some examples when we need client and server parts but don't need client server relation.
  2. Minimum code to create basic client server relation.
  3. Minimum code to create basic client server relation and transfer (both sides) some data of known types.
  4. More complex example with transfer data of known types. I think that UITypeEditor with some GetPaintValueSupported will be great (on the subject of your note about bitmaps).
  5. Transfer some data of custom type.
  6. And so on...

I want to inform you that after spending a lot of time studying the article and the code of the examples, I was able to understand what kind of minimal code we need to exchange information between the client and the server. ๐Ÿ™ As I expected, the ViewModel is completely unnecessary for this.
More of it, in many cases we don't need even client/server protocol, because on client we can get values of simple properties from ObjectProxy directly.
I have successfully ported all non collection editors from the chart control ๐Ÿ™„

Everything that I wrote in the first post remains valid - if the first example had not been so complex and overloaded with information, it would have saved me a lot of time and nerves :)

-----------UPD1-----------
About collections editors.

The sample here: https://github.com/KlausLoeffelmann/NetControlDesigners/tree/main/src/Samples/Previous%20Versions/Sophisticated%20-%20CollectionEditor again is over complicated :(

And based on my experience with the rest of the editors, I think there must be a way to solve problems above without such complications.

With ILSpy I found that we have 2 collection editors: Microsoft.DotNet.DesignTools.Client.Editors.CollectionEditor and Microsoft.DotNet.DesignTools.Editors.CollectionEditor. And with this knowledge in mind, studying the example above - helped ๐Ÿ‘

-----------UPD2-----------

I've completely ported all designer staff for System.Windows.Forms.DataVisualization.
Thank you @KlausLoeffelmann for all your help ๐Ÿ‘

Thanks.

Want to close this then?