Beispiel #1
0
            public AlertWindow Create()
            {
                var window = new AlertWindow();

                if (!string.IsNullOrEmpty(_message))
                {
                    window.AlertMessage.Text = _message;
                }

                if (!string.IsNullOrEmpty(_positiveButtonText))
                {
                    window.PositiveButton.Content = _positiveButtonText;
                }

                if (!string.IsNullOrEmpty(_negativeButtonText))
                {
                    window.NegativeButton.Content = _negativeButtonText;
                }

                if (_onPositiveButtonClick != null)
                {
                    window.PositiveButton.Click += (obj, e) =>
                    {
                        _onPositiveButtonClick(obj, e, window);
                    };
                }

                if (_onNegativeButtonClick != null)
                {
                    window.NegativeButton.Click += (obj, e) =>
                    {
                        _onNegativeButtonClick(obj, e, window);
                    };
                }

                return(window);
            }
 private void OnDirNotExistsAlertCancel(object sender, RoutedEventArgs e, AlertWindow window)
 {
     Console.WriteLine("用户取消了");
     window.Close();
 }