CapDemo.GUI.User_Controls.ImportQuestions.btn_DownloadFile_Click C# (CSharp) Метод

btn_DownloadFile_Click() приватный Метод

private btn_DownloadFile_Click ( object sender, EventArgs e ) : void
sender object
e EventArgs
Результат void
        private void btn_DownloadFile_Click(object sender, EventArgs e)
        {
            try
            {
                SaveFileDialog save = new SaveFileDialog();
                save.FileName = "Template.txt";
                save.Filter = "Text File | *.txt";
                if (save.ShowDialog() == DialogResult.OK)
                {
                    StreamWriter writer = new StreamWriter(save.OpenFile());
                    string text = Directory.GetCurrentDirectory() + "\\Template.txt";

                    foreach (var line in File.ReadAllLines(text))
                    {
                        writer.WriteLine(line);
                    }
                    writer.Dispose();
                    writer.Close();
                    MessageBox.Show("Tải tập tin mẫu thành công: " + save.FileName + "", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);

                    //notifyIcon1.Icon = SystemIcons.Information;
                    //notifyIcon1.BalloonTipText = "Tải tập tin mẫu thành công: " + save.FileName + "";
                    //notifyIcon1.ShowBalloonTip(2000);
                }
            }
            catch (Exception)
            {
            }
        }