예제 #1
0
        /// <summary>
        ///     Static method, which configures the form to show "Error" and opens this form as a dialog.
        /// </summary>
        /// <param name="ex">Exception object</param>
        /// <param name="parent">Parent control of the caller.</param>
        public static void ShowError(Exception ex, Control parent = null)
        {
            var form = new ErrorViewerForm
            {
                _exWrapper = new ExceptionWrapper(ex),
                Text       = parent == null
                    ? "Error -  Sql to C# Code generator"
                    : $"Error - {parent.Text}",
                errorControl =
                {
                    Text = ex.Message
                },
                moreDetails =
                {
                    Visible = true
                },
                ShowIcon    = true,
                Icon        = SystemIcons.Error,
                pictureBox1 =
                {
                    Image = SystemIcons.Error.ToBitmap()
                }
            };

            form.ShowDialog(parent);
        }
예제 #2
0
        /// <summary>
        /// Static method, which configures the form to show "Success" and opens this form as a dialog.
        /// </summary>
        /// <param name="message">Success message to be shown on form.</param>
        /// <param name="parent">Parent control of the caller.</param>
        public static void ShowSuccess(string message, Form parent)
        {
            var form = new ErrorViewerForm();

            form.Text = $"Success - {parent.Text}";
            form.errorControl.Text = message;
            form.Icon = Resources.ok;
            form.pictureBox1.Image = Resources.ok.ToBitmap();
            form.ShowDialog(parent);
        }
예제 #3
0
        /// <summary>
        /// Static method, which configures the form to show "Warning" and opens this form as a dialog.
        /// </summary>
        /// <param name="message">Warning to be shown on form.</param>
        /// <param name="parent">Parent control of the caller.</param>
        public static void ShowWarning(string message, Form parent)
        {
            var form = new ErrorViewerForm();

            form.Text = $"Warning - {parent.Text}";
            form.errorControl.Text = message;
            form.Icon = SystemIcons.Warning;
            form.pictureBox1.Image = SystemIcons.Warning.ToBitmap();
            form.ShowDialog(parent);
        }
예제 #4
0
        /// <summary>
        /// Static method, which configures the form to show "Information" and opens this form as a dialog.
        /// </summary>
        /// <param name="message">Information to be shown on form.</param>
        /// <param name="parent">Parent control of the caller.</param>
        public static void ShowInformation(string message, Control parent)
        {
            var form = new ErrorViewerForm();

            form.Text = $"Information - {parent.Text}";
            form.errorControl.Text = message;
            form.Icon = SystemIcons.Information;
            form.pictureBox1.Image = SystemIcons.Information.ToBitmap();
            form.ShowDialog(parent);
        }
예제 #5
0
        /// <summary>
        /// Static method, which configures the form to show "Error" and opens this form as a dialog.
        /// </summary>
        /// <param name="ex">Exception object</param>
        /// <param name="parent">Parent control of the caller.</param>
        public static void ShowError(Exception ex, Control parent = null)
        {
            var form = new ErrorViewerForm();

            form.exWrapper           = new ExceptionWrapper(ex);
            form.Text                = parent == null ? "Error -  Sql to C# Code generator" : $"Error - {parent.Text}";
            form.errorControl.Text   = ex.Message;
            form.moreDetails.Visible = true;
            form.ShowIcon            = true;
            form.Icon                = SystemIcons.Error;
            form.pictureBox1.Image   = SystemIcons.Error.ToBitmap();
            form.ShowDialog(parent);
        }
예제 #6
0
        /// <summary>
        ///     Static method, which configures the form to show "Success" and opens this form as a dialog.
        /// </summary>
        /// <param name="message">Success message to be shown on form.</param>
        /// <param name="parent">Parent control of the caller.</param>
        public static void ShowSuccess(string message, Form parent)
        {
            var form = new ErrorViewerForm
            {
                Text         = $@"Success - {parent.Text}",
                errorControl =
                {
                    Text = message
                },
                Icon        = Resources.ok,
                pictureBox1 =
                {
                    Image = Resources.ok.ToBitmap()
                }
            };

            form.ShowDialog(parent);
        }
예제 #7
0
        /// <summary>
        ///     Static method, which configures the form to show "Information" and opens this form as a dialog.
        /// </summary>
        /// <param name="message">Information to be shown on form.</param>
        /// <param name="parent">Parent control of the caller.</param>
        public static void ShowInformation(string message, Control parent)
        {
            var form = new ErrorViewerForm
            {
                Text         = $@"Information - {parent.Text}",
                errorControl =
                {
                    Text = message
                },
                Icon        = SystemIcons.Information,
                pictureBox1 =
                {
                    Image = SystemIcons.Information.ToBitmap()
                }
            };

            form.ShowDialog(parent);
        }
예제 #8
0
        /// <summary>
        ///     Static method, which configures the form to show "Warning" and opens this form as a dialog.
        /// </summary>
        /// <param name="message">Warning to be shown on form.</param>
        /// <param name="parent">Parent control of the caller.</param>
        public static void ShowWarning(string message, Form parent)
        {
            var form = new ErrorViewerForm
            {
                Text         = $@"Warning - {parent.Text}",
                errorControl =
                {
                    Text = message
                },
                Icon        = SystemIcons.Warning,
                pictureBox1 =
                {
                    Image = SystemIcons.Warning.ToBitmap()
                }
            };

            form.ShowDialog(parent);
        }