using System; using System.ComponentModel; using System.Runtime.CompilerServices; using System.Windows; namespace ChatController { public partial class ExceptionViewControl : INotifyPropertyChanged { public event EventHandler OkButtonClicked; private Exception _Exception; public Exception Exception { get => _Exception; set { _Exception = value; OnPropertyChanged(); } } public ExceptionViewControl() { InitializeComponent(); DataContext = this; } public event PropertyChangedEventHandler PropertyChanged; protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null) { PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); } private void OkButton_OnClick(object sender, RoutedEventArgs args) { OkButtonClicked?.Invoke(this, args); } private void CopyToClipboardButton_OnClick(object sender, RoutedEventArgs args) { Clipboard.SetText(Exception.StackTrace); } } }