C# ;Error when displaying flow graph

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mylog
    New Member
    • Sep 2007
    • 20

    C# ;Error when displaying flow graph

    I have downloaded a GLEE(Graph Layout Execution Engine) and written the following code to display a windows form from a web page but i am encountering with a small problem on displaying the graph into the display and I am getting the following error when I run the web page.Can anybody solve this problem. I would be very grateful. Thanks

    Error:
    System.InvalidO perationExcepti on: Showing a modal dialog box or form when the application is not running in UserInteractive mode is not a valid operation. Specify the ServiceNotifica tion or DefaultDesktopO nly style to display a notification from a service application.

    Code:
    using System;
    using System.Data;
    using System.Configur ation;
    using System.Collecti ons;
    using System.Web;
    using System.Web.Secu rity;
    using System.Web.UI;
    using System.Web.UI.W ebControls;
    using System.Web.UI.W ebControls.WebP arts;
    using System.Web.UI.H tmlControls;
    using System.Windows. Forms;
    using System.Componen tModel;
    using System.Drawing;
    using System.Text;
    using Microsoft.Glee;
    using Microsoft.Glee. Splines;

    public partial class Flow : System.Web.UI.P age
    {
    protected void Page_Load(objec t sender, EventArgs e)
    {
    //create a form
    System.Windows. Forms.Form form = new System.Windows. Forms.Form();

    //create a viewer object
    Microsoft.Glee. GraphViewerGdi. GViewer viewer = new Microsoft.Glee. GraphViewerGdi. GViewer();

    //create a graph object
    Microsoft.Glee. Drawing.Graph graph = new Microsoft.Glee. Drawing.Graph(" graph");
    //create the graph content
    graph.AddEdge(" A", "B");
    graph.AddEdge(" B", "C");
    graph.AddEdge(" A", "C").EdgeAttr.C olor = Microsoft.Glee. Drawing.Color.G reen;
    graph.FindNode( "A").Attr.Fillc olor = Microsoft.Glee. Drawing.Color.M agenta;
    graph.FindNode( "B").Attr.Fillc olor = Microsoft.Glee. Drawing.Color.M istyRose;
    Microsoft.Glee. Drawing.Node c = graph.FindNode( "C");
    c.Attr.Fillcolo r = Microsoft.Glee. Drawing.Color.P aleGreen;
    c.Attr.Shape = Microsoft.Glee. Drawing.Shape.D iamond;

    //bind the graph to the viewer
    viewer.Graph = graph;

    //associate the viewer with the form
    form.SuspendLay out();

    viewer.Dock = System.Windows. Forms.DockStyle .Fill;
    form.Controls.A dd(viewer);
    form.ResumeLayo ut();

    //show the form
    form.ShowDialog ();

    }
    }
Working...