Click here to Skip to main content
15,885,278 members
Articles / Silverlight
Technical Blog

Silverlight Online Plotter

Rate me:
Please Sign up or sign in to vote.
5.00/5 (1 vote)
12 Apr 2013CPOL 5.8K   3  
A tool that allows you to create function graphs right in the browser, compare them, export and import.

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. 

Image 1

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
<?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)


Written By
Technical Lead Plumsail
Russian Federation Russian Federation
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

Comments and Discussions

 
-- There are no messages in this forum --