make ETA/ETD the default sort order
This commit is contained in:
parent
b254759562
commit
f2ecc7ca2e
@ -46,7 +46,7 @@ namespace BreCalClient
|
|||||||
private bool _refreshImmediately = false;
|
private bool _refreshImmediately = false;
|
||||||
|
|
||||||
private bool? _showCanceled = null;
|
private bool? _showCanceled = null;
|
||||||
private SortOrder? _sortOrder;
|
private SortOrder _sortOrder = SortOrder.ETA_ETD;
|
||||||
private int searchPastDays = 0;
|
private int searchPastDays = 0;
|
||||||
|
|
||||||
// private bool _filterChanged = false;
|
// private bool _filterChanged = false;
|
||||||
@ -90,6 +90,7 @@ namespace BreCalClient
|
|||||||
Process.Start("explorer", Properties.Settings.Default.LOGO_IMAGE_URL);
|
Process.Start("explorer", Properties.Settings.Default.LOGO_IMAGE_URL);
|
||||||
};
|
};
|
||||||
this.comboBoxSortOrder.ItemsSource = Enum.GetValues(typeof(Extensions.SortOrder));
|
this.comboBoxSortOrder.ItemsSource = Enum.GetValues(typeof(Extensions.SortOrder));
|
||||||
|
this.comboBoxSortOrder.SelectedIndex = (int)_sortOrder;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
|
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
|
||||||
@ -511,31 +512,28 @@ namespace BreCalClient
|
|||||||
{
|
{
|
||||||
_ = this._visibleControlModels.RemoveAll(x => x.Shipcall?.Canceled ?? false);
|
_ = this._visibleControlModels.RemoveAll(x => x.Shipcall?.Canceled ?? false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this._sortOrder != null)
|
switch(this._sortOrder)
|
||||||
{
|
{
|
||||||
switch(this._sortOrder)
|
case Extensions.SortOrder.SHIP_NAME:
|
||||||
{
|
this._visibleControlModels.Sort((x, y) => { if (x.Ship == null) return 0; if (y.Ship == null) return 0; return x.Ship.Name.CompareTo(y.Ship.Name); });
|
||||||
case Extensions.SortOrder.SHIP_NAME:
|
break;
|
||||||
this._visibleControlModels.Sort((x, y) => { if (x.Ship == null) return 0; if (y.Ship == null) return 0; return x.Ship.Name.CompareTo(y.Ship.Name); });
|
case Extensions.SortOrder.MODIFIED:
|
||||||
break;
|
this._visibleControlModels.Sort((x, y) => { if (x.Shipcall == null) return 0; if (y.Shipcall == null) return 0; return DateTime.Compare(x.Shipcall.Modified ?? x.Shipcall.Created, y.Shipcall.Modified ?? x.Shipcall.Created); });
|
||||||
case Extensions.SortOrder.MODIFIED:
|
break;
|
||||||
this._visibleControlModels.Sort((x, y) => { if (x.Shipcall == null) return 0; if (y.Shipcall == null) return 0; return DateTime.Compare(x.Shipcall.Modified ?? x.Shipcall.Created, y.Shipcall.Modified ?? x.Shipcall.Created); });
|
case Extensions.SortOrder.ETA_ETD:
|
||||||
break;
|
this._visibleControlModels.Sort((x, y) =>
|
||||||
case Extensions.SortOrder.ETA_ETD:
|
{
|
||||||
this._visibleControlModels.Sort((x, y) =>
|
if (x.Shipcall == null) return 0;
|
||||||
{
|
if (y.Shipcall == null) return 0;
|
||||||
if (x.Shipcall == null) return 0;
|
DateTime xDate = (x.Shipcall.Type == (int) Extensions.TypeEnum.Incoming) ? x.Shipcall.Eta ?? DateTime.Now : x.Shipcall.Etd ?? DateTime.Now;
|
||||||
if (y.Shipcall == null) return 0;
|
DateTime yDate = (y.Shipcall.Type == (int) Extensions.TypeEnum.Incoming) ? y.Shipcall.Eta ?? DateTime.Now : y.Shipcall.Etd ?? DateTime.Now;
|
||||||
DateTime xDate = (x.Shipcall.Type == (int) Extensions.TypeEnum.Incoming) ? x.Shipcall.Eta ?? DateTime.Now : x.Shipcall.Etd ?? DateTime.Now;
|
return DateTime.Compare(xDate, yDate);
|
||||||
DateTime yDate = (y.Shipcall.Type == (int) Extensions.TypeEnum.Incoming) ? y.Shipcall.Eta ?? DateTime.Now : y.Shipcall.Etd ?? DateTime.Now;
|
});
|
||||||
return DateTime.Compare(xDate, yDate);
|
break;
|
||||||
});
|
default:
|
||||||
break;
|
break;
|
||||||
default:
|
}
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user