diff --git a/src/BreCalClient/App.config b/src/BreCalClient/App.config
index 5cb87a6..9b96e2e 100644
--- a/src/BreCalClient/App.config
+++ b/src/BreCalClient/App.config
@@ -4,6 +4,9 @@
+
+
+
@@ -21,4 +24,11 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/BreCalClient/BreCalClient.csproj b/src/BreCalClient/BreCalClient.csproj
index 825a7a8..3c6b607 100644
--- a/src/BreCalClient/BreCalClient.csproj
+++ b/src/BreCalClient/BreCalClient.csproj
@@ -7,7 +7,7 @@
true
True
BreCalClient.App
- E:\gitlager\git_brcal\misc\brecal.snk
+ ..\..\misc\brecal.snk
0.6.0.0
0.6.0.0
Bremen calling client
diff --git a/src/BreCalClient/MainWindow.xaml.cs b/src/BreCalClient/MainWindow.xaml.cs
index 971e0f5..a765d2f 100644
--- a/src/BreCalClient/MainWindow.xaml.cs
+++ b/src/BreCalClient/MainWindow.xaml.cs
@@ -85,7 +85,7 @@ namespace BreCalClient
labelVersion.Text = "V. " + System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;
if (!string.IsNullOrEmpty(Properties.Settings.Default.APP_TITLE))
this.Title = Properties.Settings.Default.APP_TITLE;
- searchFilterControl.SearchFilterChanged += SearchFilterControl_SearchFilterChanged;
+ searchFilterControl.SearchFilterChanged += SearchFilterControl_SearchFilterChanged;
searchFilterControl.LogoImageClicked += () =>
{
Process.Start("explorer", Properties.Settings.Default.LOGO_IMAGE_URL);
@@ -95,6 +95,9 @@ namespace BreCalClient
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
+ // serialize filter settings
+ Properties.Settings.Default.FilterCriteria = this.searchFilterControl.SearchFilter.Serialize();
+ Properties.Settings.Default.Save();
_tokenSource.Cancel();
}
@@ -119,7 +122,7 @@ namespace BreCalClient
this.busyIndicator.IsBusy = false;
this._api.Configuration.ApiKey["Authorization"] = _loginResult.Token;
this.LoadStaticLists();
- this.labelUsername.Text = $"{_loginResult.FirstName} {_loginResult.LastName}";
+ this.labelUsername.Text = $"{_loginResult.FirstName} {_loginResult.LastName}";
}
}
labelGeneralStatus.Text = $"Connection {ConnectionStatus.SUCCESSFUL}";
@@ -253,7 +256,14 @@ namespace BreCalClient
agencies.Add(participant);
}
this.searchFilterControl.SetAgencies(agencies);
-
+
+ if (!string.IsNullOrEmpty(Properties.Settings.Default.FilterCriteria))
+ {
+ SearchFilterModel? sfm = SearchFilterModel.Deserialize(Properties.Settings.Default.FilterCriteria);
+ if (sfm != null)
+ this.searchFilterControl.SetFilterFromModel(sfm);
+ }
+
_ = Task.Run(() => RefreshShipcalls());
}
diff --git a/src/BreCalClient/Properties/Settings.Designer.cs b/src/BreCalClient/Properties/Settings.Designer.cs
index ffe9b78..78d6206 100644
--- a/src/BreCalClient/Properties/Settings.Designer.cs
+++ b/src/BreCalClient/Properties/Settings.Designer.cs
@@ -12,7 +12,7 @@ namespace BreCalClient.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.5.0.0")]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.6.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
@@ -58,5 +58,17 @@ namespace BreCalClient.Properties {
return ((string)(this["LOGO_IMAGE_URL"]));
}
}
+
+ [global::System.Configuration.UserScopedSettingAttribute()]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Configuration.DefaultSettingValueAttribute("")]
+ public string FilterCriteria {
+ get {
+ return ((string)(this["FilterCriteria"]));
+ }
+ set {
+ this["FilterCriteria"] = value;
+ }
+ }
}
}
diff --git a/src/BreCalClient/Properties/Settings.settings b/src/BreCalClient/Properties/Settings.settings
index 3560eda..4833674 100644
--- a/src/BreCalClient/Properties/Settings.settings
+++ b/src/BreCalClient/Properties/Settings.settings
@@ -14,5 +14,8 @@
https://www.textbausteine.net/
+
+
+
\ No newline at end of file
diff --git a/src/BreCalClient/SearchFilterControl.xaml.cs b/src/BreCalClient/SearchFilterControl.xaml.cs
index bee9ed4..11c6d65 100644
--- a/src/BreCalClient/SearchFilterControl.xaml.cs
+++ b/src/BreCalClient/SearchFilterControl.xaml.cs
@@ -79,6 +79,40 @@ namespace BreCalClient
this.upDownShiplengthTo.Value = null;
}
+
+ internal void SetFilterFromModel(SearchFilterModel sfm)
+ {
+ this.ClearFilters();
+
+ if(sfm.Berths != null)
+ {
+ foreach(Berth berth in this.comboBoxBerths.ItemsSource)
+ {
+ if (sfm.Berths.Contains(berth.Id)) this.comboBoxBerths.SelectedItems.Add(berth);
+ }
+ }
+ if(sfm.Agencies != null)
+ {
+ foreach(Participant p in this.comboBoxAgencies.ItemsSource)
+ {
+ if(sfm.Agencies.Contains(p.Id)) this.comboBoxAgencies.SelectedItems.Add(p);
+ }
+ }
+ if(sfm.Categories != null)
+ {
+ foreach(int category in sfm.Categories)
+ this.comboBoxCategories.SelectedItems.Add((Extensions.TypeEnum)category);
+ }
+ if (sfm.SearchString != null) this.textBoxSearch.Text = sfm.SearchString;
+ this.upDownShiplengthFrom.Value = sfm.ShipLengthFrom;
+ this.upDownShiplengthTo.Value = sfm.ShipLengthTo;
+ this.datePickerETAFrom.SelectedDate = sfm.EtaFrom;
+ this.datePickerETATo.SelectedDate = sfm.EtaTo;
+
+ this._model = sfm;
+ SearchFilterChanged?.Invoke();
+ }
+
#endregion
#region event handler
@@ -94,13 +128,14 @@ namespace BreCalClient
}
private void datePickerETAFrom_SelectedDateChanged(object sender, SelectionChangedEventArgs e)
- {
+ {
+ this._model.EtaFrom = this.datePickerETAFrom.SelectedDate;
SearchFilterChanged?.Invoke();
}
private void datePickerETATo_SelectedDateChanged(object sender, SelectionChangedEventArgs e)
{
- //_model.EtaTo = datePickerETATo.SelectedDate;
+ this._model.EtaTo = datePickerETATo.SelectedDate;
SearchFilterChanged?.Invoke();
}
@@ -115,11 +150,13 @@ namespace BreCalClient
private void upDownShiplengthFrom_ValueChanged(object sender, System.Windows.RoutedPropertyChangedEventArgs