locked
How do I Programatically Open MSAGL file an Asign to Graph Editor using MSAGL? RRS feed

  • Question

  • Hi All,

    I would like to know If i can use a open method to asign a msagl file to graph editor so that I see the previously saved graph.

    MSAGL provides this option in the toolbar open button, but i would like write my won method and have some customization, is it possible? if yes, please give me sample code to proceed further.

    Thanks
    Antony
    Wednesday, January 27, 2010 2:15 PM

Answers

  • Hi Antony,
    That is how the file open method looks like in MSAGL, so you can do similar.

     

    private void OpenButtonPressed() {

     

    OpenFileDialog openFileDialog = new OpenFileDialog();

    openFileDialog.RestoreDirectory =

    true;

    openFileDialog.Filter =

    "MSAGL Files(*.msagl)|*.msagl"; ;

     

    try {

     

    if (openFileDialog.ShowDialog() == DialogResult.OK) {

     

    this.NeedToCalculateLayout = false;

     

    this.Graph = Graph.Read(openFileDialog.FileName);

    }

    }

    catch (Exception e) {

     

    MessageBox.Show(e.Message);

     

    throw;

    }

    finally {

     

    this.NeedToCalculateLayout = true;

    }

    }
    Thanks,
    Lev


    Lev Nachmanson
    Thursday, January 28, 2010 12:17 AM