Ejemplo n.º 1
0
        public MessageBox(string Title, string Message, MsgBoxButtons Buttons, MsgBoxIcon Icon, DialogClose oCallback)
        {
            InitializeComponent();

            ModalHost  = new ModalControl();
            _oCallback = oCallback;

            btOne.Click   += OneClick;
            btTwo.Click   += OneClick;
            btCross.Click += OneClick;

            //if (string.IsNullOrEmpty(Title))
            //    txtTitle.Text = "Error";
            //  else
            txtTitle.Text = Title;

            txtMessage.Text = Message;

            if (Buttons == MsgBoxButtons.YesNo)
            {
                btOne.Content = "Yes";
                btOne.Tag     = DialogExit.OK;

                btTwo.Content = "No";
                btTwo.Tag     = DialogExit.Cancel;
            }
            else
            {
                btOne.Visibility = Visibility.Collapsed;
                btTwo.Content    = "OK";
                btTwo.Tag        = DialogExit.Cancel;
            }

            btCross.Tag = DialogExit.Cancel;

            _lblIcon.Text = Icon.ToString();


            //string sImagePath = @"Resources\error_img.png";

            //if (Icon == MsgBoxIcon.Warning)
            //    sImagePath = "/images/warning.png";
            //else if (Icon == MsgBoxIcon.Error)
            //    sImagePath = "/images/error.png";

            //BitmapImage oImage = new BitmapImage();
            //oImage.UriSource = new Uri(sImagePath);
            ////oImage.SetSource(Application.GetResourceStream(new Uri(sImagePath)).Stream);
            //_imgIcon.Source = oImage;
        }