Beispiel #1
0
        public static void Send()
        {
            try
            {
                var conf = SerializeConfiguration.ReaderXml();
                var c    = Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory.ToString());
                var path = Path.Combine(c, "Screenshot.png");

                MailMessage mail       = new MailMessage();
                SmtpClient  SmtpServer = new SmtpClient("smtp.gmail.com");
                mail.From = new MailAddress(conf.Email);
                mail.To.Add(conf.Email);
                mail.Subject = "ScreenShot Teamviewer" + DateTime.Now.ToString();
                mail.Body    = "ScreenShot Teamviewer";

                System.Net.Mail.Attachment attachment;
                attachment = new System.Net.Mail.Attachment(path);
                mail.Attachments.Add(attachment);

                SmtpServer.UseDefaultCredentials = false;
                SmtpServer.Port        = 587;
                SmtpServer.Credentials = new System.Net.NetworkCredential(conf.Email, conf.Password);
                SmtpServer.EnableSsl   = true;

                SmtpServer.Send(mail);
            }
            catch (Exception ex)
            {
                throw new Exception("Send Email: " + ex.Message);
            }
        }
Beispiel #2
0
        private void Init()
        {
            try
            {
                var conf = SerializeConfiguration.ReaderXml();

                ProcessStartInfo startInfo = new ProcessStartInfo(conf.PathProgram);
                startInfo.WindowStyle = ProcessWindowStyle.Maximized;

                string path = conf.PathProgram;

                Process.Start(startInfo);
            }
            catch (Exception ex)
            {
                throw new Exception("Start Program: " + ex.Message);
            }
        }