OpenBve.formMessages.ButtonSaveClick C# (CSharp) Méthode

ButtonSaveClick() private méthode

private ButtonSaveClick ( object sender, EventArgs e ) : void
sender object
e System.EventArgs
Résultat void
        private void ButtonSaveClick(object sender, EventArgs e)
        {
            // prepare
            System.Text.StringBuilder Builder = new System.Text.StringBuilder();
            for (int i = 0; i < Interface.MessageCount; i++) {
                Builder.AppendLine(Interface.Messages[i].Text);
            }
            // save
            SaveFileDialog Dialog = new SaveFileDialog();
            Dialog.Filter = "Text files|*.txt|All files|*";
            if (Dialog.ShowDialog() == DialogResult.OK) {
                try {
                    System.IO.File.WriteAllText(Dialog.FileName, Builder.ToString(), System.Text.Encoding.UTF8);
                } catch (Exception ex) {
                    MessageBox.Show(ex.Message, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Hand);
                }
            }
        }