private void DrawingCanvas_MouseClick(object sender, MouseEventArgs e)
 {
     // If a floating connector exists, remove it when non-subsystem clicked
     if (floater != null)
     {
         floater = null;
     }
 }
        public void SubsystemClicked(object sender, MouseEventArgs e)
        {
            try
            {
                SubsystemIcon icon = (SubsystemIcon)sender;
                if (floater != null)
                {
                    // Connect other end
                    if (floater.IndependentIcon == null)
                    {
                        floater.IndependentIcon = icon;
                    }
                    else
                    {
                        floater.DependentIcon = icon;
                    }

                    // Add to list and reset floater reference
                    Connections.Add(floater);
                    floater = null;
                    RefreshConnections();
                    return;
                }
                if (icon.IsOverLeft)
                {
                    // Create floating dependency from left side
                    floater               = new DependencyConnection();
                    floater.Parent        = this;
                    floater.Location      = new Point(0, 0);
                    floater.Height        = Height;
                    floater.Width         = Width;
                    floater.DependentIcon = icon;
                    floater.OpenPoint     = e.Location;
                    floater.Refresh();
                }
                if (icon.IsOverRight)
                {
                    // Create floating (in)dependency from right side
                    floater                 = new DependencyConnection();
                    floater.Parent          = this;
                    floater.Location        = new Point(0, 0);
                    floater.Height          = Height;
                    floater.Width           = Width;
                    floater.IndependentIcon = icon;
                    floater.OpenPoint       = e.Location;
                    floater.Refresh();
                }
            }
            catch (InvalidCastException)
            {
                // Subsystem click not sent by subsystem
                MessageBox.Show("Subsystem click not sent by subsystem");
            }
        }