c# - GeometryDrawing serialization/deserialization -


there need provide sort of interface(save/edit/load) dynamically generated styles formed geometrydrawings. problem distinction between them in situation lack name property. i've tried :

// dummy predefined style, has more drawings keep first 1 const string templatexaml = @"<drawingbrush xmlns=""http://schemas.microsoft.com/winfx/2006/xaml/presentation"" xmlns:x=""http://schemas.microsoft.com/winfx/2006/xaml"" stretch=""uniform"">                 <drawingbrush.drawing>                     <drawinggroup>                         <drawinggroup.children>                             <geometrydrawing geometry=""f1 m 77,92l 704,92l 704,517l 77,517l 77,92 z "" x:name=""test_name"">                                 <geometrydrawing.pen>                                     <pen thickness=""4"" linejoin=""round"" brush=""#ffff7d00""/>                                 </geometrydrawing.pen>                             </geometrydrawing>     <!--more drawings here -->                             </drawinggroup.children>                     </drawinggroup>                 </drawingbrush.drawing>             </drawingbrush>";         var drawingbrush = xamlreader.parse(templatexaml) drawingbrush;         var firstdrawing = (drawingbrush.drawing drawinggroup).children[0] geometrydrawing;         //..         var name = firstdrawing.getvalue(nameproperty);         //..         firstdrawing.setvalue(frameworkelement.nameproperty, "some value"); 

i have x:name here in name variable (or this) able change , serialize get, example, same style different names drawings (case named element1,2,3..., , have named according subject area, , processing have automatic not manual regarding fact there no ability wysiwyg'ly - each drawing put visual, visuals put custom frameworkelement etc.). of course, whole process of working drawings pain, system design requirement can't ignore. in advance.

didn't find better way wrap drawings in bl classes , serialize/deserialize them. lost consistency , violated requirements bit - have 2 entities (plain geometries , classes describes them) representing graphical objects, can converted/interchanged when needed.


Comments

Popular posts from this blog

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

php - How can I edit my code to echo the data of child's element where my search term was found in, in XMLReader? -