diff --git a/src/BreCalClient/App.xaml.cs b/src/BreCalClient/App.xaml.cs index c44620d..6c98fd5 100644 --- a/src/BreCalClient/App.xaml.cs +++ b/src/BreCalClient/App.xaml.cs @@ -1,10 +1,4 @@ using BreCalClient.misc.Model; -using System; -using System.Collections.Generic; -using System.Configuration; -using System.Data; -using System.Linq; -using System.Threading.Tasks; using System.Windows; namespace BreCalClient diff --git a/src/BreCalClient/MainWindow.xaml.cs b/src/BreCalClient/MainWindow.xaml.cs index 8b86f92..b553096 100644 --- a/src/BreCalClient/MainWindow.xaml.cs +++ b/src/BreCalClient/MainWindow.xaml.cs @@ -129,7 +129,7 @@ namespace BreCalClient if (esc.ShowDialog() ?? false) { // create UI & save new dialog model - this.UpdateShipcallUI(esc.Shipcall); + this.UpdateShipcallUI(esc.Shipcall, new List()); this._api.ShipcallsPost(esc.Shipcall); } } @@ -230,7 +230,9 @@ namespace BreCalClient { foreach (Shipcall shipcall in shipcalls) { - this.UpdateShipcallUI(shipcall); + List currentTimes = await _api.TimesGetAsync(shipcall.Id); + + this.UpdateShipcallUI(shipcall, currentTimes); } List removeList = new(); @@ -254,7 +256,7 @@ namespace BreCalClient } } - private void UpdateShipcallUI(Shipcall shipcall) + private void UpdateShipcallUI(Shipcall shipcall, List times) { ShipcallControlModel? selectedSCMModel = null; @@ -270,13 +272,15 @@ namespace BreCalClient if (selectedSCMModel != null) { selectedSCMModel.Shipcall = shipcall; + selectedSCMModel.Times = times; } else { // no: create new entry selectedSCMModel = new() { - Shipcall = shipcall + Shipcall = shipcall, + Times = times }; if (this._shipLookupDict.ContainsKey(shipcall.ShipId)) selectedSCMModel.Ship = this._shipLookupDict[shipcall.ShipId]; @@ -291,7 +295,7 @@ namespace BreCalClient Height = 120, ShipcallControlModel = selectedSCMModel }; - sc.TimesRequested += Sc_TimesRequested; + sc.EditTimesRequested += Sc_EditTimesRequested; sc.EditRequested += Sc_EditRequested; this.stackPanel.Children.Add(sc); this._shipCallControlDict[shipcall.Id] = sc; @@ -333,9 +337,10 @@ namespace BreCalClient } } - private void Sc_TimesRequested(ShipcallControl obj) + private void Sc_EditTimesRequested(ShipcallControl obj, Times times) { - // TODO: get the shipcall, load and show a list of the times + // show a dialog that lets the user create / update times for the given shipcall + } diff --git a/src/BreCalClient/ShipcallControl.xaml b/src/BreCalClient/ShipcallControl.xaml index 068dbca..5c427c0 100644 --- a/src/BreCalClient/ShipcallControl.xaml +++ b/src/BreCalClient/ShipcallControl.xaml @@ -46,7 +46,7 @@ -