Warte-Dialog nach ID Beantragung bleibt jetzt offen bzw. wird nicht erst angezeigt, wenn die Id da ist. Der Reiter mit der neuen Anmeldung wird erst gar nicht mehr angezeigt.

This commit is contained in:
Daniel Schick 2020-12-16 08:42:54 +00:00
parent cabb81de1f
commit 7ce4a89386
8 changed files with 82 additions and 17 deletions

View File

@ -1,12 +1,12 @@
extensions: designer.cs generated.cs
extensions: .cs .cpp .h
// Copyright (c) 2017 schick Informatik
// Copyright (c) 2017- schick Informatik
// Description:
//
extensions: .aspx .ascx
<%--
Copyright (c) 2017 Informatikbüro Daniel Schick
Copyright (c) 2017- Informatikbüro Daniel Schick
--%>
extensions: .vb
'Sample license text.

View File

@ -6,7 +6,7 @@
xmlns:local="clr-namespace:ENI2.EditControls"
xmlns:p="clr-namespace:ENI2.Properties"
mc:Ignorable="d"
Title="{x:Static p:Resources.textVisitTransitId}" Height="152" Width="300" WindowStyle="SingleBorderWindow">
Title="{x:Static p:Resources.textVisitTransitId}" Height="152" Width="300" WindowStyle="SingleBorderWindow" WindowStartupLocation="CenterOwner" >
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="28" />
@ -14,9 +14,9 @@
<RowDefinition Height="28" />
<RowDefinition Height="28" />
</Grid.RowDefinitions>
<Label Content="Id updated:" Grid.Row="0" />
<Label Name="statusLabel" HorizontalAlignment="Center" Content="{x:Static p:Resources.textWaitForId}" Background="LemonChiffon"/>
<TextBox IsReadOnly="True" Name="textBoxId" MouseDown="textBoxId_MouseDown" FontWeight="Bold" HorizontalAlignment="Center" VerticalContentAlignment="Center" Margin="2" Grid.Row="1"/>
<Label Content=" -> click to copy" HorizontalAlignment="Center" Grid.Row="2" MouseDown="textBoxId_MouseDown"/>
<Label Name="clickToCopyLabel" Content=" -> click to copy" HorizontalAlignment="Center" Grid.Row="2" MouseDown="textBoxId_MouseDown" Visibility="Hidden"/>
<Button Grid.Row="3" HorizontalAlignment="Right" Content="OK" Margin="2" Width="100" Click="Button_Click" />
</Grid>
</Window>

View File

@ -34,10 +34,20 @@ namespace ENI2.EditControls
get { return this.textBoxId.Text; }
}
public void UpdateId(string id)
{
this.Dispatcher.Invoke(new Action(() =>
{
this.DisplayId = id;
this.statusLabel.Content = Properties.Resources.textIdReceived;
this.statusLabel.Background = Brushes.LightGreen;
this.clickToCopyLabel.Visibility = Visibility.Visible;
}));
}
private void textBoxId_MouseDown(object sender, MouseButtonEventArgs e)
{
Clipboard.SetText(this.textBoxId.Text);
this.textBoxId.Background = Brushes.LightGreen;
}
private void Button_Click(object sender, RoutedEventArgs e)

View File

@ -48,6 +48,7 @@ namespace ENI2
private ReportingParty userEntity;
private readonly ILog _log = LogManager.GetLogger(typeof(MainWindow));
private readonly DatabaseEntityWatchdog _dbWatchDog;
private ShowIdDialog showIdDialog;
#endregion
@ -403,7 +404,19 @@ namespace ENI2
// Meldeklassen für neuen Anlauf erzeugen:
bsmd.database.Util.CreateMessagesForCore(closedDialog.Core, null, userEntity);
this.AnmeldungenControl_MessageCoreSelected(closedDialog.Core); // in einem neuen Reiter öffnen
// watchdog registrieren
this._dbWatchDog.Register(closedDialog.Core);
// Wartedialog anzeigen
this.showIdDialog = new ShowIdDialog();
this.showIdDialog.Closed += (showIdDialog, showIdArgs) =>
{
// wenn der Dialog vorzeitig geschlossen wird erkennt man später dass man die Id dort nicht updaten braucht
this.showIdDialog = null;
this._dbWatchDog.UnRegister(closedDialog.Core);
};
this.showIdDialog.ShowDialog();
// this.AnmeldungenControl_MessageCoreSelected(closedDialog.Core); // in einem neuen Reiter öffnen
}
};
visitIdDialog.Show();
@ -497,6 +510,10 @@ namespace ENI2
private void _dbWatchDog_VisitTransitIdUpdated(DatabaseEntity entity)
{
if (entity is MessageCore changedCore)
{
this.showIdDialog?.UpdateId(changedCore.VisitId.IsNullOrEmpty() ? changedCore.TransitId : changedCore.VisitId);
if (this.openTabs.ContainsKey(changedCore.Id.Value))
{
TabItem tabitem = this.openTabs[changedCore.Id.Value];
this.Dispatcher.BeginInvoke(new Action(() =>
@ -506,6 +523,7 @@ namespace ENI2
}));
}
}
}
#endregion

View File

@ -2360,6 +2360,15 @@ namespace ENI2.Properties {
}
}
/// <summary>
/// Looks up a localized string similar to Id received.
/// </summary>
public static string textIdReceived {
get {
return ResourceManager.GetString("textIdReceived", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to IGC item.
/// </summary>
@ -3800,6 +3809,15 @@ namespace ENI2.Properties {
}
}
/// <summary>
/// Looks up a localized string similar to Requested at.
/// </summary>
public static string textRequestedAt {
get {
return ResourceManager.GetString("textRequestedAt", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Requested position in port of call.
/// </summary>
@ -4772,6 +4790,15 @@ namespace ENI2.Properties {
}
}
/// <summary>
/// Looks up a localized string similar to Waiting for Id...
/// </summary>
public static string textWaitForId {
get {
return ResourceManager.GetString("textWaitForId", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Waste.
/// </summary>

View File

@ -1717,4 +1717,13 @@
<data name="textMaerskSeago" xml:space="preserve">
<value>Maersk / SeaGo</value>
</data>
<data name="textIdReceived" xml:space="preserve">
<value>Id received</value>
</data>
<data name="textRequestedAt" xml:space="preserve">
<value>Requested at</value>
</data>
<data name="textWaitForId" xml:space="preserve">
<value>Waiting for Id..</value>
</data>
</root>

View File

@ -27,6 +27,7 @@ namespace ENI2.Util
{
this.bgTimer = new Timer();
this.bgTimer.Elapsed += BgTimer_Elapsed;
this.bgTimer.AutoReset = true;
this.bgTimer.Interval = Properties.Settings.Default.changeTimerTimeout;
}
@ -49,13 +50,13 @@ namespace ENI2.Util
if(entity.IsTransit)
{
if (!entity.TransitId.IsNullOrEmpty() && !watchedEntity.TransitId.IsNullOrEmpty() && !entity.TransitId.Equals(watchedEntity.TransitId))
if (!entity.TransitId.IsNullOrEmpty() && watchedEntity.TransitId.IsNullOrEmpty() && !entity.TransitId.Equals(watchedEntity.TransitId))
{
OnVisitTransitIdUpdated(entity);
watchedEntity.TransitId = entity.TransitId;
}
}
else if (!entity.VisitId.IsNullOrEmpty() && !watchedEntity.VisitId.IsNullOrEmpty() && !entity.VisitId.Equals(watchedEntity.VisitId))
else if (!entity.VisitId.IsNullOrEmpty() && watchedEntity.VisitId.IsNullOrEmpty() && !entity.VisitId.Equals(watchedEntity.VisitId))
{
OnVisitTransitIdUpdated(entity);
watchedEntity.VisitId = entity.VisitId;

Binary file not shown.