Label durch Button ersetzt für bessere Benutzerrückmeldung

This commit is contained in:
Daniel Schick 2022-12-09 09:43:27 +01:00
parent c29a936fa2
commit ad5f873d04
2 changed files with 13 additions and 7 deletions

View File

@ -29,7 +29,7 @@
<Label Name="labelIMO" Grid.Column="1" Grid.Row="2"/> <Label Name="labelIMO" Grid.Column="1" Grid.Row="2"/>
<Label Name="statusLabel" HorizontalAlignment="Center" Content="{x:Static p:Resources.textWaitForId}" Background="LemonChiffon" Grid.Row="3" Grid.ColumnSpan="2"/> <Label Name="statusLabel" HorizontalAlignment="Center" Content="{x:Static p:Resources.textWaitForId}" Background="LemonChiffon" Grid.Row="3" Grid.ColumnSpan="2"/>
<TextBox IsReadOnly="True" Name="textBoxId" MouseDown="textBoxId_MouseDown" FontWeight="Bold" HorizontalAlignment="Center" VerticalContentAlignment="Center" Margin="2" Grid.Row="4" Grid.ColumnSpan="2"/> <TextBox IsReadOnly="True" Name="textBoxId" MouseDown="textBoxId_MouseDown" FontWeight="Bold" HorizontalAlignment="Center" VerticalContentAlignment="Center" Margin="2" Grid.Row="4" Grid.ColumnSpan="2"/>
<Label Name="clickToCopyLabel" Content=" -> click to copy" HorizontalAlignment="Center" Grid.Row="5" Grid.ColumnSpan="2" MouseDown="textBoxId_MouseDown" Visibility="Hidden"/> <Button Name="clickToCopyButton" Content=" -&gt; click to copy &lt;- " HorizontalAlignment="Center" Grid.Row="5" Grid.ColumnSpan="2" Click="clickToCopyButton_Click" Visibility="Hidden" Margin="2"/>
<Button Grid.Row="6" Grid.Column="0" HorizontalAlignment="Left" Content="Close and open Id" Margin="2" Width="100" Click="Button_Click_1" /> <Button Grid.Row="6" Grid.Column="0" HorizontalAlignment="Left" Content="Close and open Id" Margin="2" Width="100" Click="Button_Click_1" />
<Button Grid.Row="6" Grid.Column="1" HorizontalAlignment="Right" Content="Close" Margin="2" Width="100" Click="Button_Click" /> <Button Grid.Row="6" Grid.Column="1" HorizontalAlignment="Right" Content="Close" Margin="2" Width="100" Click="Button_Click" />
</Grid> </Grid>

View File

@ -38,15 +38,10 @@ namespace ENI2.EditControls
this.DisplayId = id; this.DisplayId = id;
this.statusLabel.Content = Properties.Resources.textIdReceived; this.statusLabel.Content = Properties.Resources.textIdReceived;
this.statusLabel.Background = Brushes.LightGreen; this.statusLabel.Background = Brushes.LightGreen;
this.clickToCopyLabel.Visibility = Visibility.Visible; this.clickToCopyButton.Visibility = Visibility.Visible;
})); }));
} }
private void textBoxId_MouseDown(object sender, MouseButtonEventArgs e)
{
Clipboard.SetText(this.textBoxId.Text);
}
private void Button_Click(object sender, RoutedEventArgs e) private void Button_Click(object sender, RoutedEventArgs e)
{ {
this.Close(); this.Close();
@ -67,5 +62,16 @@ namespace ENI2.EditControls
this.labelIMO.Content = this.Core.IMO.IsNullOrEmpty() ? this.Core.ENI : this.Core.IMO; this.labelIMO.Content = this.Core.IMO.IsNullOrEmpty() ? this.Core.ENI : this.Core.IMO;
} }
} }
private void clickToCopyButton_Click(object sender, RoutedEventArgs e)
{
Clipboard.SetText(this.textBoxId.Text);
this.clickToCopyButton.Background = Brushes.LightGreen;
}
private void textBoxId_MouseDown(object sender, MouseButtonEventArgs e)
{
Clipboard.SetText(this.textBoxId.Text);
}
} }
} }