Merge branch 'feature/win_client_changes_sprint_1' of ssh://lager/mnt/ext/git/git_brcal into feature/win_client_changes_sprint_1
This commit is contained in:
commit
e7614a085c
@ -4,6 +4,9 @@
|
||||
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
|
||||
<section name="BreCalClient.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
|
||||
</sectionGroup>
|
||||
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
|
||||
<section name="BreCalClient.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
|
||||
</sectionGroup>
|
||||
</configSections>
|
||||
<applicationSettings>
|
||||
<BreCalClient.Properties.Settings>
|
||||
@ -21,4 +24,11 @@
|
||||
</setting>
|
||||
</BreCalClient.Properties.Settings>
|
||||
</applicationSettings>
|
||||
<userSettings>
|
||||
<BreCalClient.Properties.Settings>
|
||||
<setting name="FilterCriteria" serializeAs="String">
|
||||
<value />
|
||||
</setting>
|
||||
</BreCalClient.Properties.Settings>
|
||||
</userSettings>
|
||||
</configuration>
|
||||
@ -7,7 +7,7 @@
|
||||
<UseWPF>true</UseWPF>
|
||||
<SignAssembly>True</SignAssembly>
|
||||
<StartupObject>BreCalClient.App</StartupObject>
|
||||
<AssemblyOriginatorKeyFile>E:\gitlager\git_brcal\misc\brecal.snk</AssemblyOriginatorKeyFile>
|
||||
<AssemblyOriginatorKeyFile>..\..\misc\brecal.snk</AssemblyOriginatorKeyFile>
|
||||
<AssemblyVersion>0.6.0.0</AssemblyVersion>
|
||||
<FileVersion>0.6.0.0</FileVersion>
|
||||
<Title>Bremen calling client</Title>
|
||||
|
||||
@ -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());
|
||||
}
|
||||
|
||||
|
||||
14
src/BreCalClient/Properties/Settings.Designer.cs
generated
14
src/BreCalClient/Properties/Settings.Designer.cs
generated
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -14,5 +14,8 @@
|
||||
<Setting Name="LOGO_IMAGE_URL" Type="System.String" Scope="Application">
|
||||
<Value Profile="(Default)">https://www.textbausteine.net/</Value>
|
||||
</Setting>
|
||||
<Setting Name="FilterCriteria" Type="System.String" Scope="User">
|
||||
<Value Profile="(Default)" />
|
||||
</Setting>
|
||||
</Settings>
|
||||
</SettingsFile>
|
||||
@ -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<object> e)
|
||||
{
|
||||
this._model.ShipLengthFrom = this.upDownShiplengthFrom.Value;
|
||||
SearchFilterChanged?.Invoke();
|
||||
}
|
||||
|
||||
private void upDownShiplengthTo_ValueChanged(object sender, System.Windows.RoutedPropertyChangedEventArgs<object> e)
|
||||
{
|
||||
this._model.ShipLengthTo = this.upDownShiplengthTo.Value;
|
||||
SearchFilterChanged?.Invoke();
|
||||
}
|
||||
|
||||
@ -147,12 +184,13 @@ namespace BreCalClient
|
||||
|
||||
private void textBoxSearch_PreviewTextInput(object sender, TextCompositionEventArgs e)
|
||||
{
|
||||
this.SearchFilter.SearchString = e.Text;
|
||||
this.SearchFilter.SearchString = this.textBoxSearch.Text + e.Text;
|
||||
SearchFilterChanged?.Invoke();
|
||||
}
|
||||
|
||||
private void textBoxSearch_TextChanged(object sender, TextChangedEventArgs e)
|
||||
{
|
||||
this.SearchFilter.SearchString = this.textBoxSearch.Text;
|
||||
SearchFilterChanged?.Invoke();
|
||||
}
|
||||
|
||||
|
||||
@ -5,6 +5,7 @@
|
||||
using BreCalClient.misc.Model;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace BreCalClient
|
||||
{
|
||||
@ -30,7 +31,17 @@ namespace BreCalClient
|
||||
|
||||
public double? ShipLengthTo { get; set; }
|
||||
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
public static SearchFilterModel? Deserialize(string json)
|
||||
{
|
||||
return (SearchFilterModel?) JsonConvert.DeserializeObject(json, typeof(SearchFilterModel));
|
||||
}
|
||||
|
||||
public string Serialize()
|
||||
{
|
||||
return JsonConvert.SerializeObject(this, Formatting.Indented);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user