Click here to Skip to main content
Click here to Skip to main content

Silverlight Online Plotter

By , 12 Apr 2013
 

Today I'd like to tell you about one of my old projects Silverlight Online Plotter. This is a tool that allows you to create function graphs right in the browser, compare them, export and import. 

Live demo is not allow to export because I have not implemented web service that saves data. In Silverlight 3.0 there is no way to create save dialog, so I exported data with http-handler. I created web request to web-service that saved data to a file and set session variable with filename. Than I made browser redirect to http-handler that returned this file.

There is code of web-service in PHP:

<?php

session_start();

if ($_GET['file']) {
$filename = $_SERVER['DOCUMENT_ROOT'].'/files/'.$_GET['file']; 
$f = fopen($filename, 'r');

if (!$f) { 
header('HTTP/1.0 404 Not Found');
exit();
}

header('Content-type: application/xplt');
header('Content-Disposition: attachment; filename="plots.xplt"');
header('Content-Length: '.filesize($filename));
echo fread($f, filesize($filename));
fclose($f);

@unlink($filename);
exit();
} 

if ($_POST['data']) {
$f = fopen($_SERVER['DOCUMENT_ROOT'].'/files/'.session_id().'.xml', 'w');
fwrite($f, stripslashes($_POST['data']));
fclose($f);

header('Content-type: text/xml');
echo '<?xml version="1.0" encoding="utf-8" ?><data status="0" file="'.session_id().'.xml" />';
exit();
}

header('Content-type: text/xml');
echo '<?xml version="1.0" encoding="utf-8" ?><data status="1" />';

?>

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

Dmitriy Kozlov
Unknown
Member
Expert in SharePoint
The leader of SharePoint Forms Designer Team: http://spform.com
Co-founder of PlumSail: http://plumsail.com
My blog: http://formsdesigner.blogspot.com

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
Hint: For improved responsiveness ensure Javascript is enabled and choose 'Normal' from the Layout dropdown and hit 'Update'.
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page   
-- There are no messages in this forum --
Permalink | Advertise | Privacy | Mobile
Web03 | 2.6.130513.1 | Last Updated 12 Apr 2013
Article Copyright 2013 by Dmitriy Kozlov
Everything else Copyright © CodeProject, 1999-2013
Terms of Use
Layout: fixed | fluid