private void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
     else if (instance != null)
     {
         Destroy(this.gameObject);
     }
     DontDestroyOnLoad(this.gameObject);
 }
 void CreateCanvases()
     {
     // Remove any canvas we might already have (useful in 'relayout' case)
     //
     this.canvases = new List<GraphComponentCanvas>();
     this.systemCanvasContainer.Children.Clear();
     //
     // We add in a stack panel to keep the canvases centered horizontally in the window.
     // And we use another stack panel to provide the spacing between molecules
     //
     foreach (GraphComponent component in this.graphComponents)
         {
         StackPanel   vertSpacingPanel   = new StackPanel() { Orientation = Orientation.Vertical,   VerticalAlignment  =VerticalAlignment.Center, Margin=new Thickness(0,Constants.RenderComponentSpacing,0,Constants.RenderComponentSpacing) };
         StackPanel   horzCenteringPanel = new StackPanel() { Orientation = Orientation.Horizontal, HorizontalAlignment=HorizontalAlignment.Center };
         SystemCanvas systemCanvas       = new SystemCanvas();
         GraphComponentCanvas canvas     = new GraphComponentCanvas(component, this, systemCanvas);
         // 
         systemCanvas.Height = canvas.NeededCanvasHeight;
         //
         this.canvases.Add(canvas);
         //
         horzCenteringPanel.Children.Add(systemCanvas);
         vertSpacingPanel.Children.Add(horzCenteringPanel);
         this.systemCanvasContainer.Children.Add(vertSpacingPanel);
         }
     }