예제 #1
0
 /// <summary>
 /// Interpret the text content of the text field as graphml
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void ApplyGraphMLButton_Click(object sender, EventArgs e)
 {
     try {
         using (StringReader reader = new StringReader(graphMLText.Text)) {
             GraphControl.GraphMLIOHandler.Read(Graph, reader);
             GraphControl.FitGraphBounds();
         }
     } catch (Exception exc) {
         var exceptionDialog = new ExceptionDialog(exc)
         {
             Owner = this
         };
         exceptionDialog.ShowDialog();
     }
 }
예제 #2
0
        private void ShowGraphML()
        {
            bool includeGraphSettings = IncludeGraphSettingsButton.IsChecked ?? false;

            try {
                StringBuilder builder = new StringBuilder();
                using (StringWriter writer = new StringWriter(builder)) {
                    // set whether to make the handler write the graph settings.
                    GraphControl.GraphMLIOHandler.SerializationPropertyOverrides.Set(SerializationProperties.DisableGraphSettings, !includeGraphSettings);
                    GraphControl.GraphMLIOHandler.Write(Graph, writer);
                    // Use SelectAll and Paste to enable undoability
                    graphMLText.SelectAll();
                    graphMLText.Text = builder.ToString();
                }
            } catch (Exception exc) {
                var exceptionDialog = new ExceptionDialog(exc)
                {
                    Owner = this
                };
                exceptionDialog.ShowDialog();
            }
        }