Exemple #1
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="cfg"></param>
 private void SetValue(INetCommuniPortConfig cfg)
 {
     if (cfg is RemoteIPAddressConfig)
     {
         RemoteIPAddressConfig ipCfg = cfg as RemoteIPAddressConfig;
         this.txtStationIP.Text = ipCfg.RemoteIPAddress.ToString();
     }
     else if (cfg is RemotePortConfig)
     {
         RemotePortConfig rpCfg = cfg as RemotePortConfig;
         this.numRemotePort.Value = rpCfg.RemotePort;
     }
     else if (cfg is LocalPortConfig)
     {
         LocalPortConfig lpCfg = cfg as LocalPortConfig;
         this.numLocalPort.Value = lpCfg.LocalPort;
     }
     else if (cfg is RemoteIPAddressAndPortConfig)
     {
         RemoteIPAddressAndPortConfig ipPortCfg = cfg as RemoteIPAddressAndPortConfig;
         this.txtRemoteIPAddress.Text         = ipPortCfg.RemoteIPAddress.ToString();
         this.numRemotePort2.Value            = ipPortCfg.RemotePort;
         this.cmbConnectionType.SelectedValue = ipPortCfg.ConnectionType;
     }
     else
     {
         throw new NotSupportedException(cfg.ToString());
     }
 }
Exemple #2
0
        public override bool Equals(object obj)
        {
            //return base.Equals(obj);
            if (obj == null)
            {
                return(false);
            }

            //if (obj is RemoteIPAddressAndPortConfig)
            if (this.GetType() == obj.GetType())
            {
                RemoteIPAddressAndPortConfig v2 = obj as RemoteIPAddressAndPortConfig;
                return(v2.ConnectionType == this.ConnectionType &&
                       v2.RemoteIPAddress.Equals(this.RemoteIPAddress) &&
                       v2.RemotePort == this.RemotePort);
            }
            else
            {
                return(false);
            }
        }