git_bsmd/ENI2/EditControls/ShowIdDialog.xaml.cs

72 lines
2.0 KiB
C#

// Copyright (c) 2017 schick Informatik
// Description: Info-Dialog wenn eine Id erhalten wird
//
using System;
using System.Windows;
using System.Windows.Input;
using System.Windows.Media;
using bsmd.database;
namespace ENI2.EditControls
{
/// <summary>
/// Interaction logic for ShowIdDialog.xaml
/// </summary>
public partial class ShowIdDialog : Window
{
public ShowIdDialog(MessageCore core)
{
InitializeComponent();
this.Core = core;
}
public string DisplayId
{
set { this.textBoxId.Text = value; }
get { return this.textBoxId.Text; }
}
public bool OpenCore { get; private set; }
public MessageCore Core { get; private set; }
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);
}
private void Button_Click(object sender, RoutedEventArgs e)
{
this.Close();
}
private void Button_Click_1(object sender, RoutedEventArgs e)
{
this.OpenCore = true;
this.Close();
}
private void Window_Loaded(object sender, RoutedEventArgs e)
{
if(this.Core != null)
{
this.labelETA.Content = this.Core.ETADisplay;
this.labelPoC.Content = this.Core.PoC;
this.labelIMO.Content = this.Core.IMO.IsNullOrEmpty() ? this.Core.ENI : this.Core.IMO;
}
}
}
}