Exemplo n.º 1
0
 private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (listBox1.SelectedItem != null)
     {
         var tmp = (PLCTag)listBox1.SelectedItem;
         txtByteAddress.Text = tmp.S7FormatAddress;
         EnumListBoxExtensions.SelectEnumListItem(cmbDataType, (int)tmp.LibNoDaveDataType);
     }
 }
Exemplo n.º 2
0
        private void Form1_Load(object sender, EventArgs e)
        {
            //cmbSource.AddEnumToList(typeof (LibNoDaveDataSource));
            EnumListBoxExtensions.AddEnumToList(cmbSource, typeof(TagDataSource));
            //cmbType.AddEnumToList(typeof (LibNoDaveDataType));
            EnumListBoxExtensions.AddEnumToList(cmbType, typeof(TagDataType));
            EnumListBoxExtensions.AddEnumToList(cmbDataType, typeof(TagDataType));
            cmbSource.SelectedIndex = 9;
            cmbType.SelectedIndex   = 4;

            label10.Text = (new PLCConnectionConfiguration("JFK-TestConnection")).ToString();
        }
Exemplo n.º 3
0
        //private PLCTag backupPLCTag = null;

        private void LibNoDaveValueEditor_Load(object sender, EventArgs e)
        {
            EnumListBoxExtensions.AddEnumToList(cmbSource, typeof(MemoryArea));
            EnumListBoxExtensions.AddEnumToList(cmbType, typeof(TagDataType));

            if (_libnodavevalue == null)
            {
                startWasNull    = true;
                _libnodavevalue = new PLCTag();
            }
            //else
            //    backupPLCTag = new PLCTag(_libnodavevalue);

            _libnodavevalue.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(_libnodavevalue_PropertyChanged);
            _libnodavevalue_PropertyChanged(null, null);
        }
        private void LoadSettings()
        {
            String name;

            if (lblConnectionName.Visible)
            {
                name = lblConnectionName.Text;
            }
            else
            {
                name = lstConnectionList.Text;
            }

            if (InternalConnectionList != null)
            {
                PLCConnectionConfiguration akConfig = null;
                foreach (var plcConnectionConfiguration in InternalConnectionList)
                {
                    if (plcConnectionConfiguration.ConnectionName == name)
                    {
                        akConfig = plcConnectionConfiguration;
                        break;
                    }
                }
                if (akConfig == null)
                {
                    akConfig = new PLCConnectionConfiguration();
                }
                akConfig.ConnectionName    = name;
                akConfig.ConfigurationType = LibNodaveConnectionConfigurationType.ObjectSavedConfiguration;
                myConfig = akConfig;
            }
            else if (!ObjectSavedConfiguration)
            {
                myConfig = new PLCConnectionConfiguration(name);
            }

            lstListEntryPoints.SelectedItem = myConfig.EntryPoint;

            txtLIBNODAVECPURack.Text              = myConfig.CpuRack.ToString();
            txtLIBNODAVECPUSlot.Text              = myConfig.CpuSlot.ToString();
            txtLIBNODAVECPUMPI.Text               = myConfig.CpuMpi.ToString();
            txtLIBNODAVECPUIP.Text                = myConfig.CpuIP;
            txtLIBNODAVECPUPort.Text              = myConfig.Port.ToString();
            txtWritePort.Text                     = myConfig.WritePort.ToString();
            txtLIBNODAVELokalMPI.Text             = myConfig.LokalMpi.ToString();
            lstLIBNODAVELokalCOMPort.SelectedItem = myConfig.ComPort;
            if (myConfig.ComPortParity == LibNodaveConnectionBusParity.even)
            {
                lstLIBNODAVELokalComParity.SelectedItem = "even";
            }
            else if (myConfig.ComPortParity == LibNodaveConnectionBusParity.odd)
            {
                lstLIBNODAVELokalComParity.SelectedItem = "odd";
            }
            else
            {
                lstLIBNODAVELokalComParity.SelectedItem = "none";
            }
            lstLIBNODAVELokalComSpeed.SelectedItem = myConfig.ComPortSpeed;

            EnumListBoxExtensions.SelectEnumListItem(lstLIBNODAVEConnectionType, (int)myConfig.ConnectionType);
            EnumListBoxExtensions.SelectEnumListItem(lstLIBNODAVEBusSpeed, (int)myConfig.BusSpeed);

            txtRoutingDestination.Text  = myConfig.RoutingDestination;
            txtRoutingRack.Text         = myConfig.RoutingDestinationRack.ToString();
            txtRoutingSlot.Text         = myConfig.RoutingDestinationSlot.ToString();
            chkRouting.Checked          = myConfig.Routing;
            txtRoutingSubnetFirst.Text  = myConfig.RoutingSubnet1.ToString("X");
            txtRoutingSubnetSecond.Text = myConfig.RoutingSubnet2.ToString("X");

            txtTimeout.Text          = myConfig.Timeout.TotalMilliseconds.ToString();
            txtTimeoutIPConnect.Text = myConfig.TimeoutIPConnect.TotalMilliseconds.ToString();

            chkNetlinkReset.Checked = myConfig.NetLinkReset;

            chkUseShortRequest.Checked = myConfig.UseShortDataBlockRequest;

            lstConnType.SelectedIndex        = (int)myConfig.PLCConnectionType;
            lstConnTypeRouting.SelectedIndex = (int)myConfig.RoutingPLCConnectionType;

            cmdUndo.Visible = false;
            cmdSave.Visible = false;
        }