Click here to Skip to main content
15,894,017 members
Articles / Programming Languages / C#

Silver Draw - A Silverlight Based Collaboration White Board with Drawing and Chat

Rate me:
Please Sign up or sign in to vote.
4.98/5 (37 votes)
2 Nov 2009CPOL9 min read 140.2K   3.1K   137  
Silver Draw shows how to use Silverlight and WCF Polling Duplex services to create realtime collaboration apps.
  • silverdraw.zip
    • Client
      • .svn
        • all-wcprops
        • entries
        • format
        • prop-base
        • props
        • text-base
          • App.xaml.cs.svn-base
          • App.xaml.svn-base
          • Page.xaml.cs.svn-base
          • Page.xaml.svn-base
          • ScreenObject.cs.svn-base
          • ServiceReferences.ClientConfig.svn-base
          • Silverdraw.Client.csproj.svn-base
          • Silverdraw.Client.csproj.user.svn-base
        • tmp
          • prop-base
          • props
          • text-base
      • App.xaml
      • App.xaml.cs
      • Bin
        • .svn
          • all-wcprops
          • entries
          • format
          • prop-base
          • props
          • text-base
          • tmp
            • prop-base
            • props
            • text-base
        • Debug
          • .svn
            • all-wcprops
            • entries
            • format
            • prop-base
              • SilverPaintGadget.dll.svn-base
              • SilverPaintGadget.pdb.svn-base
              • SilverPaintGadget.xap.svn-base
              • System.Json.dll.svn-base
              • System.Runtime.Serialization.Json.dll.svn-base
              • System.ServiceModel.PollingDuplex.dll.svn-base
            • props
            • text-base
              • AppManifest.xaml.svn-base
              • SilverPaintGadget.dll.svn-base
              • SilverPaintGadget.pdb.svn-base
              • SilverPaintGadget.xap.svn-base
              • System.Json.dll.svn-base
              • System.Json.xml.svn-base
              • System.Runtime.Serialization.Json.dll.svn-base
              • System.Runtime.Serialization.Json.xml.svn-base
              • System.ServiceModel.PollingDuplex.dll.svn-base
              • System.ServiceModel.PollingDuplex.xml.svn-base
              • TestPage.html.svn-base
            • tmp
              • prop-base
              • props
              • text-base
          • AppManifest.xaml
          • de
            • .svn
              • all-wcprops
              • entries
              • format
              • prop-base
                • System.Json.resources.dll.svn-base
                • System.Runtime.Serialization.Json.resources.dll.svn-base
                • System.ServiceModel.PollingDuplex.resources.dll.svn-base
              • props
              • text-base
                • System.Json.resources.dll.svn-base
                • System.Runtime.Serialization.Json.resources.dll.svn-base
                • System.ServiceModel.PollingDuplex.resources.dll.svn-base
              • tmp
                • prop-base
                • props
                • text-base
            • System.Json.resources.dll
            • System.Runtime.Serialization.Json.resources.dll
            • System.ServiceModel.PollingDuplex.resources.dll
            • System.Windows.Controls.resources.dll
          • es
            • .svn
              • all-wcprops
              • entries
              • format
              • prop-base
                • System.Json.resources.dll.svn-base
                • System.Runtime.Serialization.Json.resources.dll.svn-base
                • System.ServiceModel.PollingDuplex.resources.dll.svn-base
              • props
              • text-base
                • System.Json.resources.dll.svn-base
                • System.Runtime.Serialization.Json.resources.dll.svn-base
                • System.ServiceModel.PollingDuplex.resources.dll.svn-base
              • tmp
                • prop-base
                • props
                • text-base
            • System.Json.resources.dll
            • System.Runtime.Serialization.Json.resources.dll
            • System.ServiceModel.PollingDuplex.resources.dll
            • System.Windows.Controls.resources.dll
          • fr
            • .svn
              • all-wcprops
              • entries
              • format
              • prop-base
                • System.Json.resources.dll.svn-base
                • System.Runtime.Serialization.Json.resources.dll.svn-base
                • System.ServiceModel.PollingDuplex.resources.dll.svn-base
              • props
              • text-base
                • System.Json.resources.dll.svn-base
                • System.Runtime.Serialization.Json.resources.dll.svn-base
                • System.ServiceModel.PollingDuplex.resources.dll.svn-base
              • tmp
                • prop-base
                • props
                • text-base
            • System.Json.resources.dll
            • System.Runtime.Serialization.Json.resources.dll
            • System.ServiceModel.PollingDuplex.resources.dll
            • System.Windows.Controls.resources.dll
          • it
            • .svn
              • all-wcprops
              • entries
              • format
              • prop-base
                • System.Json.resources.dll.svn-base
                • System.Runtime.Serialization.Json.resources.dll.svn-base
                • System.ServiceModel.PollingDuplex.resources.dll.svn-base
              • props
              • text-base
                • System.Json.resources.dll.svn-base
                • System.Runtime.Serialization.Json.resources.dll.svn-base
                • System.ServiceModel.PollingDuplex.resources.dll.svn-base
              • tmp
                • prop-base
                • props
                • text-base
            • System.Json.resources.dll
            • System.Runtime.Serialization.Json.resources.dll
            • System.ServiceModel.PollingDuplex.resources.dll
            • System.Windows.Controls.resources.dll
          • ja
            • .svn
              • all-wcprops
              • entries
              • format
              • prop-base
                • System.Json.resources.dll.svn-base
                • System.Runtime.Serialization.Json.resources.dll.svn-base
                • System.ServiceModel.PollingDuplex.resources.dll.svn-base
              • props
              • text-base
                • System.Json.resources.dll.svn-base
                • System.Runtime.Serialization.Json.resources.dll.svn-base
                • System.ServiceModel.PollingDuplex.resources.dll.svn-base
              • tmp
                • prop-base
                • props
                • text-base
            • System.Json.resources.dll
            • System.Runtime.Serialization.Json.resources.dll
            • System.ServiceModel.PollingDuplex.resources.dll
            • System.Windows.Controls.resources.dll
          • ko
            • .svn
              • all-wcprops
              • entries
              • format
              • prop-base
                • System.Json.resources.dll.svn-base
                • System.Runtime.Serialization.Json.resources.dll.svn-base
                • System.ServiceModel.PollingDuplex.resources.dll.svn-base
              • props
              • text-base
                • System.Json.resources.dll.svn-base
                • System.Runtime.Serialization.Json.resources.dll.svn-base
                • System.ServiceModel.PollingDuplex.resources.dll.svn-base
              • tmp
                • prop-base
                • props
                • text-base
            • System.Json.resources.dll
            • System.Runtime.Serialization.Json.resources.dll
            • System.ServiceModel.PollingDuplex.resources.dll
            • System.Windows.Controls.resources.dll
          • Silverdraw.Client.dll
          • SilverPaintGadget.dll
          • SilverPaintGadget.xap
          • System.Json.dll
          • System.Json.xml
          • System.Runtime.Serialization.Json.dll
          • System.Runtime.Serialization.Json.xml
          • System.ServiceModel.PollingDuplex.dll
          • System.ServiceModel.PollingDuplex.xml
          • System.Windows.Controls.dll
          • System.Windows.Controls.xml
          • TestPage.html
          • zh-Hans
            • .svn
              • all-wcprops
              • entries
              • format
              • prop-base
                • System.Json.resources.dll.svn-base
                • System.Runtime.Serialization.Json.resources.dll.svn-base
                • System.ServiceModel.PollingDuplex.resources.dll.svn-base
              • props
              • text-base
                • System.Json.resources.dll.svn-base
                • System.Runtime.Serialization.Json.resources.dll.svn-base
                • System.ServiceModel.PollingDuplex.resources.dll.svn-base
              • tmp
                • prop-base
                • props
                • text-base
            • System.Json.resources.dll
            • System.Runtime.Serialization.Json.resources.dll
            • System.ServiceModel.PollingDuplex.resources.dll
            • System.Windows.Controls.resources.dll
          • zh-Hant
            • .svn
              • all-wcprops
              • entries
              • format
              • prop-base
                • System.Json.resources.dll.svn-base
                • System.Runtime.Serialization.Json.resources.dll.svn-base
                • System.ServiceModel.PollingDuplex.resources.dll.svn-base
              • props
              • text-base
                • System.Json.resources.dll.svn-base
                • System.Runtime.Serialization.Json.resources.dll.svn-base
                • System.ServiceModel.PollingDuplex.resources.dll.svn-base
              • tmp
                • prop-base
                • props
                • text-base
            • System.Json.resources.dll
            • System.Runtime.Serialization.Json.resources.dll
            • System.ServiceModel.PollingDuplex.resources.dll
            • System.Windows.Controls.resources.dll
      • ColorPicker
        • .svn
          • all-wcprops
          • entries
          • format
          • prop-base
          • props
          • text-base
            • ColorPicker.xaml.cs.svn-base
            • ColorPicker.xaml.svn-base
          • tmp
            • prop-base
            • props
            • text-base
        • ColorPicker.xaml
        • ColorPicker.xaml.cs
      • Helpers
      • Page.xaml
      • Page.xaml.cs
      • Properties
        • .svn
          • all-wcprops
          • entries
          • format
          • prop-base
          • props
          • text-base
            • AppManifest.xml.svn-base
            • AssemblyInfo.cs.svn-base
          • tmp
            • prop-base
            • props
            • text-base
        • AppManifest.xml
        • AssemblyInfo.cs
      • Resources
        • .svn
          • all-wcprops
          • entries
          • format
          • prop-base
            • brush.jpg.svn-base
            • circle.PNG.svn-base
            • pen.jpg.svn-base
            • pencil.jpg.svn-base
            • rect.PNG.svn-base
            • sticky.jpg.svn-base
          • props
          • text-base
            • brush.jpg.svn-base
            • circle.PNG.svn-base
            • pen.jpg.svn-base
            • pencil.jpg.svn-base
            • rect.PNG.svn-base
            • sticky.jpg.svn-base
          • tmp
            • prop-base
            • props
            • text-base
        • brush.jpg
        • circle.PNG
        • pen.jpg
        • pencil.jpg
        • rect.PNG
        • sticky.jpg
      • ScreenObject.cs
      • Service References
        • .svn
          • all-wcprops
          • entries
          • format
          • prop-base
          • props
          • text-base
          • tmp
            • prop-base
            • props
            • text-base
        • Proxy
          • .svn
            • all-wcprops
            • entries
            • format
            • prop-base
            • props
            • text-base
              • configuration.svcinfo.svn-base
              • configuration91.svcinfo.svn-base
              • DuplexDrawService.disco.svn-base
              • DuplexDrawService.wsdl.svn-base
              • DuplexDrawService.xsd.svn-base
              • DuplexDrawService1.xsd.svn-base
              • DuplexDrawService2.xsd.svn-base
              • Reference.cs.svn-base
              • Reference.svcmap.svn-base
            • tmp
              • prop-base
              • props
              • text-base
          • configuration.svcinfo
          • configuration91.svcinfo
          • DuplexDrawService.disco
          • DuplexDrawService.wsdl
          • DuplexDrawService.xsd
          • DuplexDrawService1.xsd
          • DuplexDrawService2.xsd
          • Reference.cs
          • Reference.svcmap
      • ServiceReferences.ClientConfig
      • Silverdraw.Client.csproj
      • Silverdraw.Client.csproj.user
    • Server
      • .svn
        • all-wcprops
        • dir-prop-base
        • entries
        • format
        • prop-base
        • props
        • text-base
          • ClientAccessPolicy.xml.svn-base
          • DrawData.cs.svn-base
          • DuplexDrawService.svc.cs.svn-base
          • DuplexDrawService.svc.svn-base
          • IDuplexDrawCallback.cs.svn-base
          • IDuplexDrawService.cs.svn-base
          • Silverdraw.html.svn-base
          • Silverdraw.Publish.xml.svn-base
          • Silverdraw.Server.csproj.svn-base
          • Silverdraw.Server.csproj.user.svn-base
          • Silverlight.js.svn-base
          • Web.config.svn-base
          • Web.Debug.config.svn-base
          • Web.Release.config.svn-base
        • tmp
          • prop-base
          • props
          • text-base
      • App_Data
        • .svn
          • all-wcprops
          • entries
          • format
          • prop-base
          • props
          • text-base
          • tmp
            • prop-base
            • props
            • text-base
      • bin
        • Silverdraw.Server.dll
        • System.Data.DataSetExtensions.dll
        • System.ServiceModel.PollingDuplex.dll
        • System.Web.Extensions.dll
      • ClientAccessPolicy.xml
      • ClientBin
        • SilverPaintGadget.xap
      • default.htm
      • DrawData.cs
      • DuplexDrawService.svc
      • DuplexDrawService.svc.cs
      • IDuplexDrawCallback.cs
      • IDuplexDrawService.cs
      • Properties
        • .svn
          • all-wcprops
          • entries
          • format
          • prop-base
          • props
          • text-base
            • AssemblyInfo.cs.svn-base
          • tmp
            • prop-base
            • props
            • text-base
        • AssemblyInfo.cs
      • Service References
        • .svn
          • all-wcprops
          • entries
          • format
          • prop-base
          • props
          • text-base
          • tmp
            • prop-base
            • props
            • text-base
      • Silverdraw.Publish.xml
      • Silverdraw.Server.csproj
      • Silverdraw.Server.csproj.user
      • Silverdraw.Server.Publish.xml
      • Silverlight.js
      • Web.config
      • Web.Debug.config
      • Web.Release.config
    • Silverdraw.sln
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<!-- saved from url=(0014)about:internet -->
<head>
    <title>Silverdraw.Client</title>
    <style type="text/css">
    html, body {
	    height: 100%;
	    overflow: auto;
    }
    body {
	    padding: 0;
	    margin: 0;
    }
    #silverlightControlHost {
	    height: 100%;
	    text-align:center;
    }
    </style>
    
    <script type="text/javascript">
        function onSilverlightError(sender, args) {
            var appSource = "";
            if (sender != null && sender != 0) {
              appSource = sender.getHost().Source;
            }
            
            var errorType = args.ErrorType;
            var iErrorCode = args.ErrorCode;

            if (errorType == "ImageError" || errorType == "MediaError") {
              return;
            }

            var errMsg = "Unhandled Error in Silverlight Application " +  appSource + "\n" ;

            errMsg += "Code: "+ iErrorCode + "    \n";
            errMsg += "Category: " + errorType + "       \n";
            errMsg += "Message: " + args.ErrorMessage + "     \n";

            if (errorType == "ParserError") {
                errMsg += "File: " + args.xamlFile + "     \n";
                errMsg += "Line: " + args.lineNumber + "     \n";
                errMsg += "Position: " + args.charPosition + "     \n";
            }
            else if (errorType == "RuntimeError") {           
                if (args.lineNumber != 0) {
                    errMsg += "Line: " + args.lineNumber + "     \n";
                    errMsg += "Position: " +  args.charPosition + "     \n";
                }
                errMsg += "MethodName: " + args.methodName + "     \n";
            }

            throw new Error(errMsg);
        }
    </script>
</head>
<body>
    <form id="form1" runat="server" style="height:100%">
    <div id="silverlightControlHost">
        <object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="100%" height="100%">
		  <param name="source" value="SilverPaintGadget.xap"/>
		  <param name="onError" value="onSilverlightError" />
		  <param name="background" value="white" />
		  <param name="minRuntimeVersion" value="3.0.40624.0" />
		  <param name="autoUpgrade" value="true" />
		  <a href="http://go.microsoft.com/fwlink/?LinkID=149156&v=3.0.40624.0" style="text-decoration:none">
 			  <img src="http://go.microsoft.com/fwlink/?LinkId=108181" alt="Get Microsoft Silverlight" style="border-style:none"/>
		  </a>
	    </object><iframe id="_sl_historyFrame" style="visibility:hidden;height:0px;width:0px;border:0px"></iframe></div>
    </form>
</body>
</html>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

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


Written By
Architect
India India
Architect, Developer, Speaker | Wannabe GUT inventor & Data Scientist | Microsoft MVP in C#

Comments and Discussions