Ejemplo n.º 1
0
        /// <summary>
        /// Create new gateway with form values.
        /// </summary>
        /// <returns>
        /// gateway: formed by ip, port, model, brand and serial number.
        /// </returns>
        private gateway setGateway()
        {
            gateway newGateway = new gateway();

            newGateway.ip            = txt_ip.Text;
            newGateway.port          = txt_port.Text;
            newGateway.model         = txt_model.Text;
            newGateway.brand         = txt_brand.Text;
            newGateway.serial_number = txt_serial_number.Text;
            return(newGateway);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Add new gateway from validated form values.
 /// </summary>
 public void addGateway()
 {
     try
     {
         if (isRightFormat())
         {
             getewayAPI api = new getewayAPI();
             gateway    gW  = setGateway();
             if (!api.AddGateway(gW))
             {
                 validateDevice.throwValidateException("Gateway already exists");
             }
             closeRightForm();
         }
     }
     catch (ArgumentException a)
     {
         MessageBox.Show(a.Message, "Info Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Add new gateway.
 /// </summary>
 /// <param name="gW">gateway: Gateway added.</param>
 /// <returns>
 /// bool: True if gateway is added succesfully.
 /// </returns>
 public bool AddGateway(gateway gW)
 {
     return(controller.addItem(gW));
 }