using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace SilverlightDataApp
{
    public partial class ErrorWindow : ChildWindow
    {
        SilverlightDataApp.MainPage mp = new MainPage();

        //The constructor of the Error Window is accepting string variables, so it can be used to pass error messages. 
        public ErrorWindow(string m)
        {
            InitializeComponent();
            
            //The error message is bound to ErrorDetails so it could be displayed in the text box.
            ErrorDetails = m;
        }

        //The properties of ErrorDetails are defined here, for the binding to work correctly.
        public static DependencyProperty ErrorDetailsProperty = DependencyProperty.Register("ErrorDetails", typeof(String), typeof(ErrorWindow), null);

        string ErrorDetails
        {
            get { return (string)GetValue(ErrorDetailsProperty); }
            set { SetValue(ErrorDetailsProperty, value); }
        }

        //The method for the OK button. 
        private void OKButton_Click(object sender, RoutedEventArgs e)
        {
            this.DialogResult = true;
        }
    }
}

