Example #1
0
        private void btnSend_Click(object sender, EventArgs e)
        {
            try
            {
                Check();
            }
            catch (Exception err)
            {
                Errors.Report(err);
                return;
            }

            var         cfg  = GlobalSettings.Pages.Email();
            MailMessage mail = new MailMessage();

            mail.From = cfg.GetFromAddress();
            foreach (string addr in emailToFrame1.EmailTo.Split(';'))
            {
                mail.To.Add(addr);
            }
            mail.Subject    = tbxSubject.Text;
            mail.Body       = tbxBody.Text;
            mail.IsBodyHtml = false;

            string fn = Core.GetTempFile(".dca");

            using (var zipfs = new ZipFileSystem(fn))
            {
                configSelectionFrame1.Root.CopyCheckedTo(zipfs, true, null);
                zipfs.Flush();
            }

            using (var dcafr = new FileInfo(fn).OpenRead())
            {
                var att = new Attachment(dcafr, "configuration.dca");
                mail.Attachments.Add(att);

                if (chbAddHowTo.Checked)
                {
                    var ms = new MemoryStream();
                    var sw = new StreamWriter(ms);
                    sw.Write(CoreRes.sendconfig_howto);
                    sw.Flush();
                    ms.Position = 0;
                    var atthowto = new Attachment(ms, "howto.html");
                    mail.Attachments.Add(atthowto);
                }

                SmtpClient smtp = cfg.GetClient();
                Logging.Info("Sending mail to " + emailToFrame1.EmailTo);
                smtp.Send(mail);
            }

            File.Delete(fn);
            Close();
            StdDialog.ShowInfo("s_configuration_sent");
        }
Example #2
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            var place = (IFilePlace)addonSelectFrame1.SelectedObject;

            try
            {
                place.CheckOutput();
            }
            catch (Exception err)
            {
                Errors.Report(err);
                return;
            }
            string fn = place.GetWorkingFileName();

            using (var zipfs = new ZipFileSystem(fn))
            {
                configSelectionFrame1.Root.CopyCheckedTo(zipfs, true, null);
                zipfs.Flush();
            }
            place.FinalizeFileName();
            DialogResult = DialogResult.OK;
            Close();
        }