1#if !NETFX_CORE && !XAMARIN
11using System.Windows.Controls;
27 this.DataContextChanged += ErrorDialog_DataContextChanged;
30 void ErrorDialog_DataContextChanged(
object sender, DependencyPropertyChangedEventArgs e)
32 DetachSource(e.OldValue);
33 AttachSource(e.NewValue);
84 "ShowExceptionDetail",
107 typeof(MessageBoxImage),
121 internal void Register(
object source)
123 AttachSource(source);
126 private void AttachSource(
object source)
128 var dp = source as System.Windows.Data.DataSourceProvider;
130 dp.DataChanged += source_DataChanged;
133 private void DetachSource(
object source)
135 var dp = source as System.Windows.Data.DataSourceProvider;
137 dp.DataChanged -= source_DataChanged;
140 private void source_DataChanged(
object sender, EventArgs e)
142 var dp = sender as System.Windows.Data.DataSourceProvider;
143 if (dp !=
null && dp.Error !=
null)
147 error = dp.Error.ToString();
149 error = dp.Error.Message;
155 output =
string.Format(
"{0}{1}{2}", this.
DialogFirstLine, Environment.NewLine, error);
165#region IErrorDialog Members
167 void IErrorDialog.Register(
object source)
169 AttachSource(source);
Displays an error dialog for any exceptions that occur in a CslaDataProvider.
bool ShowExceptionDetail
Gets or sets the first line of text displayed within the error dialog (before the exception message).
string DialogFirstLine
Gets or sets the first line of text displayed within the error dialog (before the exception message).
ErrorDialog()
Creates a new instance of the control.
string DialogTitle
Gets or sets the title of the error dialog.
static readonly DependencyProperty DialogTitleProperty
Gets or sets the title of the error dialog.
MessageBoxImage DialogIcon
Gets or sets the icon displayed in the dialog.
static readonly DependencyProperty DialogIconProperty
Gets or sets a value indicating whether the dialog should include exception details or just the excep...
static readonly DependencyProperty DialogFirstLineProperty
Gets or sets the first line of text displayed within the error dialog (before the exception message).
static readonly DependencyProperty ShowExceptionDetailProperty
Gets or sets a value indicating whether the dialog should include exception details or just the excep...
Interface defining the interaction between a CslaDataSource and an error dialog control.