Silverlight diagram application and export import using Aspose.Diagram library

Hi,


Currently I’m working on Silverlight diagram application.
I’m looking for a way to add Visio export/import features using Aspose.Diagram library.
My concerns:

1. Import - Can I use Aspose.Diagram library directly in Silverlight 4 application? For example, user clicks on Import button, choose .VSD file and then app do imports using Aspose.Diagram library?

2. Export - Can I export my diagrams into .VSD file, using Aspose.Diagram. For example, user clicks “Export”, choose file name and then app do Export using Aspose.Diagram library

Is this possible or only way to do Export/Import is client/server model(Generation of files on server?)

Thank you,
Marko

Hi Makro,

Yes, you can use Aspose.Diagram library in your Silverlight applications. You can write code to upload file to server and then pass uploaded file to Diagram class and then call Save method to render that diagram to any supported format.

I have used following code on a button click in a Silverlight application:

private void SaveToVDX_Click(object sender, RoutedEventArgs e)
{

    var client = new SilverlightApplication1.ServiceReference1.DiagramServicesClient();

    client.SaveToVDXCompleted += (s, ea) =>

    {

        TextBox1.Text = ea.Result;

    };

    client.SaveToVDXAsync();

}

and following service is used to convert a VSD file to VDX using Aspose.Diagram library:

namespace SilverlightApplication1.Web.Services

{

    [ServiceContract(Namespace = "")]

    [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]

    public class DiagramServices

    {

        [OperationContract]

        public string SaveToVDX()

        {

            // Add your operation implementation here

            Diagram diagram = new Diagram(System.Web.HttpContext.Current.Server.MapPath(@"Basic Flowchart.vsd"));

            diagram.Save(System.Web.HttpContext.Current.Server.MapPath("Output.vdx"), SaveFileFormat.VDX);

            return "Saved Successfully";

        }

        // Add more operations here and mark them with [OperationContract]

    }

}

Please check product documentation http://www.aspose.com/docs/display/diagramnet/Home for available features and code examples and feel free to contact us in case you have further comments or questions.

Best Regards,