Skip to content

Commit d4d570e

Browse files
Mark AustenMark Austen
authored andcommitted
Fixed issue #48. Added clear separator method to ship list combobox.
1 parent 87abb54 commit d4d570e

File tree

6 files changed

+35
-17
lines changed

6 files changed

+35
-17
lines changed

TradeDangerousGUI/Changelog.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
v2.1.0.3
2+
--------
3+
* Fixed bug in commander profile. Issue #48.
4+
* Added clear separator method in ship drop down list.
5+
16
v2.1.0.2
27
--------
38
* Removed any empty options in the update DB command. Fixes issue #47.

TradeDangerousGUI/Delegates.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1213,7 +1213,7 @@ private void UpdateCommanderAndShipDetails()
12131213

12141214
string availableShips = string.Empty;
12151215

1216-
JToken token = cmdrProfile["ships"];
1216+
JToken token = cmdrProfile["profile"]["ships"];
12171217
string listStructure = string.Empty;
12181218

12191219
if (token is JArray)

TradeDangerousGUI/MainClass.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -435,6 +435,7 @@ public void SetShipList(bool refreshList = false)
435435
validConfigs = SetAvailableShips();
436436

437437
cboCommandersShips.Items.Clear();
438+
cboCommandersShips.ClearSeparators();
438439

439440
foreach (ComboBoxItem item in validConfigs)
440441
{
@@ -448,7 +449,7 @@ public void SetShipList(bool refreshList = false)
448449

449450
if (index < cboCommandersShips.Items.Count)
450451
{
451-
cboCommandersShips.SetSeparator(index);
452+
cboCommandersShips.SetSeparator(cboCommandersShips.Items.Count - index);
452453
}
453454
}
454455

TradeDangerousGUI/Properties/AssemblyInfo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,4 @@
3131
// You can specify all the values or you can default the Build and Revision Numbers
3232
// by using the '*' as shown below:
3333
// [assembly: AssemblyVersion("1.0.*")]
34-
[assembly: AssemblyVersion("2.1.0.2")]
34+
[assembly: AssemblyVersion("2.1.0.3")]

TradeDangerousGUI/SeparatorCombobox.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,11 @@ public void SetSeparator(int pos)
6161
_separators.Add(pos);
6262
}
6363

64+
public void ClearSeparators()
65+
{
66+
_separators.Clear();
67+
}
68+
6469
protected override void OnDrawItem(DrawItemEventArgs e)
6570
{
6671
if (-1 == e.Index) return;

TradeDangerousGUI/mainForm.cs

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1252,23 +1252,30 @@ private void EventHandler_cApiTimer_Delegate(
12521252
object sender,
12531253
ElapsedEventArgs e)
12541254
{
1255-
Invoke(new Action(() =>
1255+
try
12561256
{
1257-
settingsRef.TimeOut -= 1;
1258-
1259-
if (settingsRef.TimeOut > 0)
1260-
{
1261-
btnCmdrProfile.Text = "({0})".With(settingsRef.TimeOut);
1262-
btnCmdrProfile.Enabled = false;
1263-
}
1264-
else
1257+
Invoke(new Action(() =>
12651258
{
1266-
cApiTimer.Stop();
1259+
settingsRef.TimeOut -= 1;
12671260

1268-
btnCmdrProfile.Text = "Cmdr Profile";
1269-
btnCmdrProfile.Enabled = true;
1270-
}
1271-
}));
1261+
if (settingsRef.TimeOut > 0)
1262+
{
1263+
btnCmdrProfile.Text = "({0})".With(settingsRef.TimeOut);
1264+
btnCmdrProfile.Enabled = false;
1265+
}
1266+
else
1267+
{
1268+
cApiTimer.Stop();
1269+
1270+
btnCmdrProfile.Text = "Cmdr Profile";
1271+
btnCmdrProfile.Enabled = true;
1272+
}
1273+
}));
1274+
}
1275+
catch (Exception ex)
1276+
{
1277+
// Do nothing.
1278+
}
12721279
}
12731280

12741281
/// <summary>

0 commit comments

Comments
 (0)