Пример #1
0
        /// <summary>
        /// Puts the config controls in the flowlayoutpanel, where they are displayed for the user.
        /// Is called after all elements have been created and added.
        /// </summary>
        public void DisplayElements()
        {
            // Add InterfaceConfigControls first
            foreach (var icc in interfaceConfigControls)
            {
                flpContents.Controls.Add(icc);
            }
            var addInterfaceButton = new AddInterfaceButton();

            addInterfaceButton.Click += AddInterfaceButton_Click;
            flpContents.Controls.Add(addInterfaceButton);
            flpContents.Controls.Add(new Separator());
            // Add various singular controls
            foreach (var c in tempControls)
            {
                flpContents.Controls.Add(c);
            }
            flpContents.Controls.Add(new Separator());
            // Add RouteConfigControls and an AddButton, if necessary
            foreach (var rcc in routeConfigControls)
            {
                flpContents.Controls.Add(rcc);
            }
            var addRouteButton = new AddRouteButton();

            addRouteButton.Click += AddRouteButton_Click;
            flpContents.Controls.Add(addRouteButton);
            if (RetainScrollPosition)
            {
                flpContents.VerticalScroll.Value = scrollPosition;
                flpContents.VerticalScroll.Value = scrollPosition;
                scrollPosition = 0;
            }
        }
Пример #2
0
 /// <summary>
 /// Clears the controls in the property control.
 /// </summary>
 public void ClearControls()
 {
     if (RetainScrollPosition)
     {
         scrollPosition = flpContents.VerticalScroll.Value;
     }
     foreach (Control c in flpContents.Controls)
     {
         if (c is InterfaceConfigControl)
         {
             InterfaceConfigControl icc = c as InterfaceConfigControl;
             icc.InterfaceChanged -= InterfaceConfigControl_InterfaceChanged;
             icc.Closing          -= ConfigControl_Closing;
         }
         else if (c is RouteConfigControl)
         {
             RouteConfigControl rcc = c as RouteConfigControl;
             rcc.RouteChanged -= RouteConfigControl_RouteChanged;
             rcc.Closing      -= ConfigControl_Closing;
         }
         else if (c is GwConfigControl)
         {
             GwConfigControl gcc = c as GwConfigControl;
             gcc.GatewayChanged -= GWConfigControl_GatewayChanged;
             gcc.Closing        -= ConfigControl_Closing;
         }
         else if (c is LayerstackConfigControl)
         {
             LayerstackConfigControl lscc = c as LayerstackConfigControl;
             lscc.LayerAdded        -= LayerStackConfigControl_LayerAdded;
             lscc.LayerRemoved      -= LayerStackConfigControl_LayerRemoved;
             lscc.LayerNameChanged  -= LayerStackConfigControl_LayerNameChanged;
             lscc.LayerIndexChanged -= LayerStackConfigControl_LayerIndexChanged;
             lscc.Closing           -= ConfigControl_Closing;
         }
         else if (c is AddInterfaceButton)
         {
             AddInterfaceButton aib = c as AddInterfaceButton;
             aib.Click -= AddInterfaceButton_Click;
         }
         else if (c is AddRouteButton)
         {
             AddRouteButton arb = c as AddRouteButton;
             arb.Click -= AddRouteButton_Click;
         }
     }
     flpContents.Controls.Clear();
     interfaceConfigControls.Clear();
     routeConfigControls.Clear();
     tempControls.Clear();
 }