public DialogResult ShowMessage(ButtonPatern buttonPatern, MessageKind messageKind, string message, MessageBoxDefaultButton defaultButton)
        {
            switch (messageKind)
            {
                case MessageKind.Information:
                    this.Text = "Private Terminal Software";
                    this.icon = SystemIcons.Information;
                    this.pictureBoxIcon.Image = this.icon.ToBitmap();
                    break;

                case MessageKind.Error:
                    this.Text = "Private Terminal Software";
                    this.icon = SystemIcons.Error;
                    this.pictureBoxIcon.Image = this.icon.ToBitmap();
                    break;

                case MessageKind.Warning:
                    this.Text = "Private Terminal Software";
                    this.icon = SystemIcons.Warning;
                    this.pictureBoxIcon.Image = this.icon.ToBitmap();
                    break;

                case MessageKind.Confirmation:
                    this.Text = "Private Terminal Software";
                    this.icon = SystemIcons.Question;
                    this.pictureBoxIcon.Image = this.icon.ToBitmap();
                    break;

                default:
                    return MessageBox.Show(string.Format(Resources.ResourceManager.GetString("CORE13"), messageKind));
            }
            switch (buttonPatern)
            {
                case ButtonPatern.OK_ONLY:
                    this.btnOK.TabIndex = 1;
                    this.flwPnlDown.Controls.Add(this.btnOK);
                    this.btnCANCEL.Size = new Size(0, 0);
                    this.btnCANCEL.TabStop = false;
                    this.flwPnlDown.Controls.Add(this.btnCANCEL);
                    base.CancelButton = this.btnCANCEL;
                    break;

                case ButtonPatern.OK_CANCEL:
                    this.btnOK.TabIndex = 1;
                    this.flwPnlDown.Controls.Add(this.btnOK);
                    this.btnCANCEL.TabIndex = 2;
                    this.flwPnlDown.Controls.Add(this.btnCANCEL);
                    base.CancelButton = this.btnCANCEL;
                    break;

                case ButtonPatern.YES_NO:
                    this.btnOK.TabIndex = 1;
                    this.flwPnlDown.Controls.Add(this.btnYES);
                    this.btnNO.TabIndex = 2;
                    this.flwPnlDown.Controls.Add(this.btnNO);
                    base.CancelButton = this.btnNO;
                    break;

                case ButtonPatern.YES_NO_CANCEL:
                    this.btnOK.TabIndex = 1;
                    this.flwPnlDown.Controls.Add(this.btnYES);
                    this.btnNO.TabIndex = 2;
                    this.flwPnlDown.Controls.Add(this.btnNO);
                    this.btnCANCEL.TabIndex = 3;
                    this.flwPnlDown.Controls.Add(this.btnCANCEL);
                    base.CancelButton = this.btnCANCEL;
                    break;

                default:
                    return MessageBox.Show(string.Format(Resources.ResourceManager.GetString("CORE14"), buttonPatern));
            }
            int num = 0;
            MessageBoxDefaultButton button = defaultButton;
            if (button == MessageBoxDefaultButton.Button2)
            {
                num = 1;
            }
            else if (button == MessageBoxDefaultButton.Button3)
            {
                num = 2;
            }
            else
            {
                num = 0;
            }
            if (num < this.flwPnlDown.Controls.Count)
            {
                this.flwPnlDown.Controls[num].Select();
            }
            this.rTxbMessage.Text = message;
            if (this.AutoSize)
            {
                Size size = new Size(base.Size.Width, base.Size.Height);
                if (this.rTxbMessage.Size.Width < (this.rTxbMessage.PreferredSize.Width + this.rTxbMessage.Margin.Horizontal))
                {
                    size.Width += (this.rTxbMessage.PreferredSize.Width + this.rTxbMessage.Margin.Horizontal) - this.rTxbMessage.Size.Width;
                }
                if (this.rTxbMessage.Lines.Length > 0)
                {
                    int num2 = this.rTxbMessage.GetPositionFromCharIndex(this.rTxbMessage.Lines[0].Length + 1).Y - this.rTxbMessage.GetPositionFromCharIndex(0).Y;
                    int num3 = (this.rTxbMessage.Lines.Length + 1) * num2;
                    if (this.rTxbMessage.Size.Height < (num3 + this.rTxbMessage.Margin.Vertical))
                    {
                        size.Height += (num3 + this.rTxbMessage.Margin.Vertical) - this.rTxbMessage.Size.Height;
                    }
                }
                this.MinimumSize = size;
            }
            return base.ShowDialog();
        }
Exemplo n.º 2
0
 private void ShowErrMessage(ButtonPatern bp, MessageKind mk, string err_str)
 {
     MessageDialog dialog = new MessageDialog();
     dialog.ShowMessage(bp, mk, err_str);
     dialog.Dispose();
 }
 public DialogResult ShowMessage(ButtonPatern buttonPatern, MessageKind messageKind, string message)
 {
     return this.ShowMessage(buttonPatern, messageKind, message, MessageBoxDefaultButton.Button1);
 }
Exemplo n.º 4
0
 private void ShowEditErrMessage(ButtonPatern bp, MessageKind mk, string err_str, TextBox txb)
 {
     MessageDialog dialog = new MessageDialog();
     dialog.ShowMessage(bp, mk, string.Concat(new object[] { txb.Tag.ToString(), "は", txb.MaxLength, err_str }));
     dialog.Dispose();
 }
Exemplo n.º 5
0
        private void buttonSet(ButtonPatern buttonPatern, MessageKind messageKind)
        {
            switch (messageKind)
            {
                case MessageKind.Information:
                {
                    this.Text = "Private Terminal Software";
                    this.icon = SystemIcons.Information;
                    using (MemoryStream stream = new MemoryStream())
                    {
                        this.icon.ToBitmap().Save(stream, ImageFormat.Png);
                        this.pictureBoxIcon.Image = Image.FromStream(stream);
                        break;
                    }
                }
                case MessageKind.Error:
                {
                    this.Text = "Private Terminal Software";
                    this.icon = SystemIcons.Error;
                    using (MemoryStream stream4 = new MemoryStream())
                    {
                        this.icon.ToBitmap().Save(stream4, ImageFormat.Png);
                        this.pictureBoxIcon.Image = Image.FromStream(stream4);
                        break;
                    }
                }
                case MessageKind.Warning:
                {
                    this.Text = "Private Terminal Software";
                    this.icon = SystemIcons.Warning;
                    using (MemoryStream stream3 = new MemoryStream())
                    {
                        this.icon.ToBitmap().Save(stream3, ImageFormat.Png);
                        this.pictureBoxIcon.Image = Image.FromStream(stream3);
                        break;
                    }
                }
                case MessageKind.Confirmation:
                {
                    this.Text = "Private Terminal Software";
                    this.icon = SystemIcons.Question;
                    using (MemoryStream stream2 = new MemoryStream())
                    {
                        this.icon.ToBitmap().Save(stream2, ImageFormat.Png);
                        this.pictureBoxIcon.Image = Image.FromStream(stream2);
                        break;
                    }
                }
                default:
                    using (MessageDialogSimpleForm form = new MessageDialogSimpleForm())
                    {
                        form.ShowMessage(ButtonPatern.OK_ONLY, MessageKind.Error, string.Format(Resources.ResourceManager.GetString("CORE09"), messageKind));
                    }
                    break;
            }
            switch (buttonPatern)
            {
                case ButtonPatern.OK_ONLY:
                    this.btnOK.Click += new EventHandler(this.btn_Click);
                    this.btnOK.TabIndex = 1;
                    this.flwPnlDown.Controls.Add(this.btnOK);
                    this.btnCOPY.TabIndex = 2;
                    this.flwPnlDown.Controls.Add(this.btnCOPY);
                    this.btnCANCEL.Click += new EventHandler(this.btn_Click);
                    this.btnCANCEL.Size = new Size(0, 0);
                    this.btnCANCEL.TabStop = false;
                    this.flwPnlDown.Controls.Add(this.btnCANCEL);
                    base.CancelButton = this.btnCANCEL;
                    break;

                case ButtonPatern.OK_CANCEL:
                    this.btnOK.Click += new EventHandler(this.btn_Click);
                    this.btnOK.TabIndex = 1;
                    this.flwPnlDown.Controls.Add(this.btnOK);
                    this.btnCANCEL.Click += new EventHandler(this.btn_Click);
                    this.btnCANCEL.TabIndex = 2;
                    this.flwPnlDown.Controls.Add(this.btnCANCEL);
                    this.btnCOPY.TabIndex = 3;
                    this.flwPnlDown.Controls.Add(this.btnCOPY);
                    this.btnOK.TabIndex = 1;
                    base.CancelButton = this.btnCANCEL;
                    break;

                case ButtonPatern.YES_NO:
                    this.btnYES.Click += new EventHandler(this.btn_Click);
                    this.btnYES.TabIndex = 1;
                    this.flwPnlDown.Controls.Add(this.btnYES);
                    this.btnNO.Click += new EventHandler(this.btn_Click);
                    this.btnNO.TabIndex = 2;
                    this.flwPnlDown.Controls.Add(this.btnNO);
                    this.btnCOPY.TabIndex = 3;
                    this.flwPnlDown.Controls.Add(this.btnCOPY);
                    base.CancelButton = this.btnNO;
                    break;

                case ButtonPatern.YES_NO_CANCEL:
                    this.btnYES.Click += new EventHandler(this.btn_Click);
                    this.btnYES.TabIndex = 1;
                    this.flwPnlDown.Controls.Add(this.btnYES);
                    this.btnNO.Click += new EventHandler(this.btn_Click);
                    this.btnNO.TabIndex = 2;
                    this.flwPnlDown.Controls.Add(this.btnNO);
                    this.btnCANCEL.Click += new EventHandler(this.btn_Click);
                    this.btnCANCEL.TabIndex = 3;
                    this.flwPnlDown.Controls.Add(this.btnCANCEL);
                    this.btnCOPY.TabIndex = 4;
                    this.flwPnlDown.Controls.Add(this.btnCOPY);
                    base.CancelButton = this.btnCANCEL;
                    break;

                default:
                    using (MessageDialogSimpleForm form2 = new MessageDialogSimpleForm())
                    {
                        form2.ShowMessage(ButtonPatern.OK_ONLY, MessageKind.Error, string.Format(Resources.ResourceManager.GetString("CORE09"), buttonPatern));
                    }
                    break;
            }
            this.btnCOPY.Click += new EventHandler(this.btnCOPY_Click);
        }
Exemplo n.º 6
0
 public DialogResult ShowMessage(ButtonPatern buttonPatern, MessageKind messageKind, string message, bool logout, bool autosize, MessageBoxDefaultButton defaultButton)
 {
     if (logout)
     {
         ULogClass.LogWrite(string.Format("{0} {1}", messageKind.GetType().ToString(), message));
     }
     MessageDialogSimpleForm form = new MessageDialogSimpleForm {
         AutoSize = autosize
     };
     return form.ShowMessage(buttonPatern, messageKind, message, defaultButton);
 }
Exemplo n.º 7
0
 public DialogResult ShowMessage(ButtonPatern buttonPatern, MessageKind messageKind, string message, bool logout, bool autosize)
 {
     return this.ShowMessage(buttonPatern, messageKind, message, logout, autosize, MessageBoxDefaultButton.Button1);
 }
Exemplo n.º 8
0
 public DialogResult ShowMessage(ButtonPatern buttonPatern, MessageKind messageKind, string message)
 {
     MessageDialogSimpleForm form = new MessageDialogSimpleForm();
     return form.ShowMessage(buttonPatern, messageKind, message);
 }