Files
Chat/ChatController/OwnChatMessageBox.xaml.cs

77 lines
2.1 KiB
C#
Raw Permalink Normal View History

using System.ComponentModel;
using System.Runtime.CompilerServices;
using System.Windows;
using ChatController.Annotations;
namespace ChatController
{
public partial class OwnChatMessageBox : INotifyPropertyChanged
{
private string _MessageBoxText;
public string MessageBoxText
{
get => _MessageBoxText;
set
{
_MessageBoxText = value;
OnPropertyChanged(nameof(MessageBoxText));
}
}
private string _PositiveButtonText;
public string PositiveButtonText
{
get => _PositiveButtonText;
set
{
_PositiveButtonText = value;
OnPropertyChanged(nameof(PositiveButtonText));
}
}
private string _CloseButtonText;
public string CloseButtonText
{
get => _CloseButtonText;
set
{
_CloseButtonText = value;
OnPropertyChanged(nameof(CloseButtonText));
}
}
public OwnChatMessageBox(string positiveButtonText, string closeButtonText, string messageBoxText, string title)
{
InitializeComponent();
DataContext = this;
PositiveButtonText = positiveButtonText;
CloseButtonText = string.IsNullOrWhiteSpace(closeButtonText) ? "Schließen" : closeButtonText;
MessageBoxText = messageBoxText;
Title = title;
}
public event PropertyChangedEventHandler PropertyChanged;
[NotifyPropertyChangedInvocator]
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
private void PositiveButton_OnClick(object sender, RoutedEventArgs e)
{
DialogResult = true;
Close();
}
private void CloseButton_OnClick(object sender, RoutedEventArgs e)
{
DialogResult = false;
Close();
}
}
}