Skip to content

Commit

Permalink
Merge pull request #65 from StefanHasensperling/master
Browse files Browse the repository at this point in the history
New PLCException
  • Loading branch information
jogibear9988 authored Nov 13, 2016
2 parents 80c0ce3 + cd59c27 commit befc950
Show file tree
Hide file tree
Showing 10 changed files with 1,732 additions and 1,670 deletions.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -165,16 +165,16 @@ private void LoadSettings()
txtWritePort.Text = myConfig.WritePort.ToString();
txtLIBNODAVELokalMPI.Text = myConfig.LokalMpi.ToString();
lstLIBNODAVELokalCOMPort.SelectedItem = myConfig.ComPort;
if (myConfig.ComPortParity == 'e')
if (myConfig.ComPortParity == LibNodaveConnectionBusParity.even)
lstLIBNODAVELokalComParity.SelectedItem = "even";
else if (myConfig.ComPortParity == 'o')
else if (myConfig.ComPortParity == LibNodaveConnectionBusParity.odd)
lstLIBNODAVELokalComParity.SelectedItem = "odd";
else
lstLIBNODAVELokalComParity.SelectedItem = "none";
lstLIBNODAVELokalComSpeed.SelectedItem = myConfig.ComPortSpeed;

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

txtRoutingDestination.Text = myConfig.RoutingDestination;
txtRoutingRack.Text = myConfig.RoutingDestinationRack.ToString();
Expand All @@ -183,15 +183,15 @@ private void LoadSettings()
txtRoutingSubnetFirst.Text = myConfig.RoutingSubnet1.ToString("X");
txtRoutingSubnetSecond.Text = myConfig.RoutingSubnet2.ToString("X");

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

chkNetlinkReset.Checked = myConfig.NetLinkReset;

chkUseShortRequest.Checked = myConfig.UseShortDataBlockRequest;

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

cmdUndo.Visible = false;
cmdSave.Visible = false;
Expand Down Expand Up @@ -226,15 +226,15 @@ private void updateConfig()
myConfig.ComPortSpeed = lstLIBNODAVELokalComSpeed.SelectedItem.ToString();

if (lstLIBNODAVELokalComParity.SelectedItem.ToString() == "even")
myConfig.ComPortParity = 'e';
myConfig.ComPortParity = LibNodaveConnectionBusParity.even;
else if (lstLIBNODAVELokalComParity.SelectedItem.ToString() == "odd")
myConfig.ComPortParity = 'o';
myConfig.ComPortParity = LibNodaveConnectionBusParity.odd;
else
myConfig.ComPortParity = 'n';
myConfig.ComPortParity = LibNodaveConnectionBusParity.none;

myConfig.ConnectionType = lstLIBNODAVEConnectionType.SelectedItem != null ? ((EnumListItem)lstLIBNODAVEConnectionType.SelectedItem).Value : 0;
myConfig.ConnectionType = (LibNodaveConnectionTypes)(lstLIBNODAVEConnectionType.SelectedItem != null ? ((EnumListItem)lstLIBNODAVEConnectionType.SelectedItem).Value : 0);

myConfig.BusSpeed = lstLIBNODAVEBusSpeed.SelectedItem != null ? ((EnumListItem)lstLIBNODAVEBusSpeed.SelectedItem).Value : 0;
myConfig.BusSpeed = (LibNodaveConnectionBusSpeed)(lstLIBNODAVEBusSpeed.SelectedItem != null ? ((EnumListItem)lstLIBNODAVEBusSpeed.SelectedItem).Value : 0);

myConfig.NetLinkReset = chkNetlinkReset.Checked;

Expand All @@ -247,11 +247,11 @@ private void updateConfig()
myConfig.RoutingSubnet1 = Convert.ToInt32(txtRoutingSubnetFirst.Text, 16);
myConfig.RoutingSubnet2 = Convert.ToInt32(txtRoutingSubnetSecond.Text, 16);

myConfig.Timeout = Convert.ToInt32(txtTimeout.Text);
myConfig.TimeoutIPConnect = Convert.ToInt32(txtTimeoutIPConnect.Text);
myConfig.Timeout = TimeSpan.FromMilliseconds(Convert.ToInt32(txtTimeout.Text));
myConfig.TimeoutIPConnect = TimeSpan.FromMilliseconds(Convert.ToInt32(txtTimeoutIPConnect.Text));

myConfig.PLCConnectionType = lstConnType.SelectedIndex;
myConfig.RoutingPLCConnectionType = lstConnTypeRouting.SelectedIndex;
myConfig.PLCConnectionType = (LibNodaveConnectionResource)lstConnType.SelectedIndex;
myConfig.RoutingPLCConnectionType = (LibNodaveConnectionResource)lstConnTypeRouting.SelectedIndex;
}

private void SaveSettings()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ ADVERTENCIA: Conexiones de otros Software hacia Netlinka tambien seran desconect
<value>92, 13</value>
</data>
<data name="lblTimeout.Text" xml:space="preserve">
<value>Tiempo de espera</value>
<value>Timeout</value>
</data>
<data name="lblTimeout.ToolTip" xml:space="preserve">
<value>Tiempo de espera de los datos de la CPU</value>
Expand Down Expand Up @@ -325,15 +325,6 @@ ADVERTENCIA: Conexiones de otros Software hacia Netlinka tambien seran desconect
<data name="lblLIBNODAVELokalComParity.ToolTip" xml:space="preserve">
<value />
</data>
<data name="lstLIBNODAVELokalComParity.Items" xml:space="preserve">
<value>Ninguno</value>
</data>
<data name="lstLIBNODAVELokalComParity.Items1" xml:space="preserve">
<value>par</value>
</data>
<data name="lstLIBNODAVELokalComParity.Items2" xml:space="preserve">
<value>impar</value>
</data>
<data name="lstLIBNODAVELokalComParity.ToolTip" xml:space="preserve">
<value />
</data>
Expand Down
Loading

0 comments on commit befc950

Please sign in to comment.