示例#1
0
        private async void SendMessage()
        {
            try
            {
                IsSending = true;
                var appFolder  = string.Empty;
                var dataFolder = string.Empty;

                if (AttachLog)
                {
                    appFolder  = AppDomain.CurrentDomain.BaseDirectory;
                    dataFolder = StringFormatter.GetAppDataFolderPath();
                }

                using (var message = SmtpClientHelper.ComposeSupportEmail(UserName, UserEmail, UserMessage, appFolder, dataFolder, SendAdvancedLog))
                {
                    using (var client = SmtpClientHelper.GetSmtpClient())
                    {
                        await client.SendMailAsync(message);
                    }
                }

                RaiseMessage("Support", "The message has been sent.");
            }
            catch (Exception ex)
            {
                RaiseMessage("Support", "Failed to send message.");
                LogProvider.Log.Error(ex);
            }

            IsSending = false;
        }
示例#2
0
        private async void SendMessage()
        {
            try
            {
                IsSending = true;

                using (var message = SmtpClientHelper.ComposeSupportEmail(UserName, UserEmail, UserMessage, AppDomain.CurrentDomain.BaseDirectory, StringFormatter.GetAppDataFolderPath()))
                    using (var client = SmtpClientHelper.GetSmtpClient())
                    {
                        await client.SendMailAsync(message);
                    }

                RaiseMessage("Support", "The message has been sent.");
            }
            catch (Exception ex)
            {
                RaiseMessage("Support", "Failed to send message.");
                LogProvider.Log.Error(ex);
            }
            finally
            {
                OnClose?.Invoke();
            }

            IsSending = false;
        }