Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic diagramLite silverlight How to save a image (Read 10902 times)
rain
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 4
Joined: Feb 10th, 2012
diagramLite silverlight How to save a image
Feb 10th, 2012 at 9:56am
Print Post  
Hello!
I have a question:
when i use SaveToPng(stream),there are a message show below:Not enough space available execution of this operation.
my OS is win7(64bit)

I want to save diagram,but when i use SaveToPng(stream),there are a message show below:Not enough space available execution of this operation.
this is the problem of software or problem of os limit?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: diagramLite silverlight How to save a image
Reply #1 - Feb 10th, 2012 at 11:15am
Print Post  
Hi,

Silverlight applies some storage quota to applications. You can ask the user to increase the quota as shown here:
http://blogs.silverlight.net/blogs/msnow/archive/2008/07/17/tip-of-the-day-20-ho...

For security reasons this must be done from a user initated event.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
rain
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 4
Joined: Feb 10th, 2012
Re: diagramLite silverlight How to save a image
Reply #2 - Feb 12th, 2012 at 12:48pm
Print Post  
hi,
thank you for reply,but i find this on MSDN:Currently, none of the hosts in the .NET Framework provide this customization, so IncreaseQuotaTo always returns false.

and i test the code,it return false,so it didn't worked.
there are any solution?
  
Back to top
 
IP Logged
 
rain
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 4
Joined: Feb 10th, 2012
Re: diagramLite silverlight How to save a image
Reply #3 - Feb 12th, 2012 at 1:11pm
Print Post  
hi,
i wrote code like this:
private void mnPrint_Click(object sender, RadRoutedEventArgs e)
        {
          
            long spaceRequest = Convert.ToInt64(10485760);
            using (IsolatedStorageFile isf = IsolatedStorageFile.GetUserStoreForApplication())
            {               
                if (isf.IncreaseQuotaTo(spaceRequest))
                {
                    System.Windows.MessageBox.Show("Current Quota=" + isf.Quota.ToString() + " bytes");
                }
                using (IsolatedStorageFileStream os = new IsolatedStorageFileStream(this.DataContext.TaskBillMst.TaskBillCD + ".png", FileMode.Create, isf))
                {
                    this.diagram.SaveToPng(os);
                }

            }
        }

is there any mistakes?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: diagramLite silverlight How to save a image
Reply #4 - Feb 13th, 2012 at 7:30am
Print Post  
What Silverlight version are you using? In older versions it was possible to enter quotas from the Silverlight Properties window shown from the Silverlight app' s context menu.

Your code works fine in my test app calling it code from a button's Click handler. It shows a confirmation dialog asking to allow increasing the quota, and then the message box shows 10MB.

Note that quotas can be increased only from user initiated events, and the runtime might not consider events raised by telerik's menu control to be user-imitated. Check if the code will work for you from a standard button's click handler.

Stoyan
  
Back to top
 
IP Logged
 
rain
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 4
Joined: Feb 10th, 2012
Re: diagramLite silverlight How to save a image
Reply #5 - Feb 13th, 2012 at 9:58am
Print Post  
hi,
Thank you for your help!
It didn't work because of telerik control,when i use normal button control ,it worked!
thank you very much!
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: diagramLite silverlight How to save a image
Reply #6 - Feb 13th, 2012 at 12:00pm
Print Post  
Ok, that's great Cool You might also check this topic about creating compressed images:
http://mindfusion.eu/Forum/YaBB.pl?num=1328022990

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint