コード例 #1
0
 public CanvasContent Load( string file )
 {
     using ( var reader = new StreamReader( file ) )
     {
         var serializer = new CanvasXmlReader( reader );
         serializer.Location = Path.GetDirectoryName( file );
         return serializer.Deserialize();
     }
 }
コード例 #2
0
        public CanvasContent LoadFromClipboard()
        {
            if ( !Clipboard.ContainsData( DataFormats.Xaml ) )
            {
                return null;
            }

            var clipboardData = Clipboard.GetData( DataFormats.Xaml ) as string;
            if ( string.IsNullOrEmpty( clipboardData ) )
            {
                return null;
            }

            using ( var reader = new StringReader( clipboardData ) )
            {
                var serializer = new CanvasXmlReader( reader );
                return serializer.Deserialize();
            }
        }