Ejemplo n.º 1
0
        /// <summary>
        /// Creates an InterfaceConfigControl and adds it to the list of interfaces to be displayed.
        /// </summary>
        /// <param name="InterfaceName">The name of the interface</param>
        /// <param name="IpAddress">The current IP address of the interface</param>
        /// <param name="SubnetMask">The current subnet mask of the interface</param>
        public void AddInterfaceConfigControl(string InterfaceName, IPAddress IpAddress, IPAddress SubnetMask)
        {
            var newControl = new InterfaceConfigControl(IpAddress, SubnetMask, InterfaceName);

            newControl.Closing          += ConfigControl_Closing;
            newControl.InterfaceChanged += InterfaceConfigControl_InterfaceChanged;
            interfaceConfigControls.Add(newControl);
        }
Ejemplo n.º 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();
 }