Skip to main content

Microsoft Silverlight

Answered Question Save changes on inkpresenterRSS Feed

(1)

sheetalsarfare
sheetals...

Member

Member

6 points

16 Posts

Save changes on inkpresenter


Hi,

  I used inkpresenter to draw. User able to  draw  on  ink presenter.

 Now I want to save text written with ink presenter. All the coding done with C#.

 Please guide me for storing this text on server.

 

Thanks ,

Sheetal
 

simbuaarumugam
simbuaar...

Participant

Participant

1172 points

405 Posts

Re: Save changes on inkpresenter

You Go through this one for developing ink presenter by using silverlight beta 1

http://pendsevikram.blogspot.com/2008/05/ink-presenter-using-microsoft_09.html

 

SimbuAarumugam India
http://simbusoftwareengineer.blogspot.com
(Mark As Answer If its Satisfy your needs)

simbuaarumugam
simbuaar...

Participant

Participant

1172 points

405 Posts

Answered Question

Re: Save changes on inkpresenter

 Hi You also Go through these all

surely you will get a solutions

Normal 0 false false false EN-US X-NONE X-NONE /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-qformat:yes; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin:0in; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-fareast-font-family:"Times New Roman"; mso-fareast-theme-font:minor-fareast; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin; mso-bidi-font-family:"Times New Roman"; mso-bidi-theme-font:minor-bidi;}

http://www.thedatafarm.com/silverlightink/

http://www.thedatafarm.com/blog/2008/01/31/ConvertingSilverlightInkPresenterImagesToAPNGFile.aspx

http://blogs.devsource.com/devlife/content/silverlight/drawing_in_silverlight_a_quick_comparison_between_10_and_11.html

http://blogs.devsource.com/devlife/content/silverlight/silverlight_inkpresenter_staying_inside_the_lines_1.html

http://msdn.microsoft.com/en-us/magazine/cc721604.aspx

http://silverlight.net/forums/p/15940/53113.aspx 

SimbuAarumugam India
http://simbusoftwareengineer.blogspot.com
(Mark As Answer If its Satisfy your needs)

StefanWick
StefanWick

Contributor

Contributor

2864 points

438 Posts

Microsoft
Answered Question

Re: Save changes on inkpresenter

To answer the specific question about saving the ink:

Unlike WPF, Silverlight does not currently support ISF (Ink Serialized Format), which is Microsoft's standard format to persist ink. So in order to persist your user's handwriting and ink drawings, you will have to write code to persist all relevant properties of the strokes in the InkPresenter's stroke collection. So in pseudo-code, here is what you do:

For-each stroke in Inkpresenter.Strokes:

    Serialize stroke.DrawingAttributes property values (to save the appearance of the stroke, like color, thickness)

    For-each stylusPoint in stroke.StylusPoints

          Serialize X, Y, PressureFacture property values (to save the geometry of the stroke)

    End-for

End-for

Then you can send the serialized ink data to the server for storage.

Thanks, Stefan Wick

 

Microsoft Silverlight | http://blogs.msdn.com/swick/

sheetalsarfare
sheetals...

Member

Member

6 points

16 Posts

Re: Re: Save changes on inkpresenter

 Hi,

   Thanks for your reply. I work on serialization and deserialization but I stuck inbetween. I won't be able to collect strokecollection eg:  var tempstroke = strokeCollection.GetItem(i); 

It gives me error on getitem(i). State that system.windows.ink.stroke does not contain definition of getitem.

Please help me to resolve this.

 

Thanks,

Sheetal

 

StefanWick
StefanWick

Contributor

Contributor

2864 points

438 Posts

Microsoft

Re: Re: Save changes on inkpresenter

Are you writing C# code? In that case you should use 'strokeCollectionIdea' to access individual stroke objects from the collection.

Thanks, Stefan Wick

Microsoft Silverlight | http://blogs.msdn.com/swick/

sheetalsarfare
sheetals...

Member

Member

6 points

16 Posts

Re: Re: Re: Save changes on inkpresenter

 Thanx Stefan.

 My code i sin C#. I am handlig strokeCollection.

 While handling strokeCollection, I don't hav access on getitem.

As I mentioned earlier I used strokeCollection.Getitem(i);

How to resolve it?

Thanks,

Sheetal 

StefanWick
StefanWick

Contributor

Contributor

2864 points

438 Posts

Microsoft
Answered Question

Re: Re: Re: Save changes on inkpresenter

Looks like the HTML interface of the forum software messed up my previous post Smile

Here is how you do the equivalent in C#, to access an individual stroke object from the collection:

Stroke stroke = strokeCollection[ i ];

Thanks, Stefan Wick

Microsoft Silverlight | http://blogs.msdn.com/swick/

sheetalsarfare
sheetals...

Member

Member

6 points

16 Posts

Re: Re: Re: Save changes on inkpresenter

Hi Stefan,

  Once again I need your help. I got the idea of serialization and deserilaization. After serialization we need to send xml as a string to web-service.

  Instead of using web service Is it ok to use exe file? How to handle exe in silverlight?

  I want to save changes on the image we need to handle WPF ink. At this point I am confused. How to handle WPF with the exe file. 

 The code is in C#. Please guide me on the same.

 

Thanks,

Sheetal 


 

 


 

StefanWick
StefanWick

Contributor

Contributor

2864 points

438 Posts

Microsoft

Re: Re: Re: Save changes on inkpresenter

I am not sure I understand your scenario. Please explain a bit more.

Do you want to run the WPF exe on the client computer or on the server computer?

Thanks, Stefan Wick

Microsoft Silverlight | http://blogs.msdn.com/swick/

sheetalsarfare
sheetals...

Member

Member

6 points

16 Posts

Re: Re: Re: Save changes on inkpresenter

 Hi Stefan,

   My application's basic need is save editted image on the server. After saving image user must be able to see those editted image.

  I plan that after creating xml of the generated stroke I want to pass this on server and server do all the saving of new image.

 * Here new Image = original image + user's drawing.

  So I want to run WPF exe on server. cause I thimk that calling service will slow down the server.

  Please suggest me the best way to perform task.  I am newbie so I don't have any idea regarding performance and effective working of silverlight.

  I am referring following  link :

  http://msdn.microsoft.com/en-gb/magazine/cc721604.aspx?pr=blog  and     

  http://www.thedatafarm.com/blog/2008/01/31/ConvertingSilverlightInkPresenterImagesToAPNGFile.aspx

 But still I am cofused with sending stroke collection's xml file on service.

 Please help me to resolve this.

 Thanks ,

 Sheetal. 


 

StefanWick
StefanWick

Contributor

Contributor

2864 points

438 Posts

Microsoft

Re: Re: Re: Save changes on inkpresenter

I would recommend using a webservice (like in Julie's example). Otherwise you would have to write all the communication logic yourself for little or no benefit.

What problem are you facing with sending strokes a stroke collection to the server? Once you have serialized the strokes to a string, you just need to send that string to server.

Thanks, Stefan Wick

Microsoft Silverlight | http://blogs.msdn.com/swick/

sheetalsarfare
sheetals...

Member

Member

6 points

16 Posts

Re: Re: Re: Save changes on inkpresenter

Thanks Stefan,

   I created a cross domain WCF web service. I am trying to use it with silverlight application. Include a crossdomainaccesspolicy.xml file in the root    directory . Still I am not able to handle the web-service in my application I get an error.

ERROR :

 An error occurred while trying to make a request to URI 'http://~/WCFServiceDZC/Service.svc'. This could be due to attempting to access a service in a cross-domain way without a proper cross-domain policy in place, or a policy that is unsuitable for SOAP services. You may need to contact the owner of the service to publish a cross-domain policy file and to ensure it allows SOAP-related HTTP headers to be sent. Please see the inner exception for more details.

I don't have ne idea to resolve it. 

StefanWick
StefanWick

Contributor

Contributor

2864 points

438 Posts

Microsoft

Re: Re: Re: Save changes on inkpresenter

Since this problem appears to be unrelated to the original topic of this thread, I would suggest opening a new thread to discuss this one. From the information you provided so far it's a bit hard to diagnose, so any additional information or code snippets would be helpful.

Out of curiosity: why does this have to be cross-domain? Couldn't you run the service on the same site where the Silverlight app resides?

Thanks, Stefan Wick

Microsoft Silverlight | http://blogs.msdn.com/swick/

sheetalsarfare
sheetals...

Member

Member

6 points

16 Posts

Re: Re: Re: Save changes on inkpresenter

 I prefer cross domain because in future I am able to access the service for various applicatins.

 Thanks for your guidance.

 Hope this issue resolve early ......

Thanks , sheetal
 

  • Unanswered Question
  • Answered Question
  • Announcement
Microsoft Communities