Пример #1
0
        public void ReplaceWith(EmailSmtpSettings source)
        {
            if (AccountId != source.AccountId)
            {
                AccountId = source.AccountId;
            }

            if (AddSignature != source.AddSignature)
            {
                AddSignature = source.AddSignature;
            }

            AdditionalAttachments.Clear();
            for (int i = 0; i < source.AdditionalAttachments.Count; i++)
            {
                AdditionalAttachments.Add(source.AdditionalAttachments[i]);
            }

            if (Content != source.Content)
            {
                Content = source.Content;
            }

            if (Enabled != source.Enabled)
            {
                Enabled = source.Enabled;
            }

            if (Html != source.Html)
            {
                Html = source.Html;
            }

            if (Recipients != source.Recipients)
            {
                Recipients = source.Recipients;
            }

            if (RecipientsBcc != source.RecipientsBcc)
            {
                RecipientsBcc = source.RecipientsBcc;
            }

            if (RecipientsCc != source.RecipientsCc)
            {
                RecipientsCc = source.RecipientsCc;
            }

            if (Subject != source.Subject)
            {
                Subject = source.Subject;
            }
        }
Пример #2
0
        public override bool Equals(object o)
        {
            if (!(o is EmailSmtpSettings))
            {
                return(false);
            }
            EmailSmtpSettings v = o as EmailSmtpSettings;

            if (!AccountId.Equals(v.AccountId))
            {
                return(false);
            }
            if (!AddSignature.Equals(v.AddSignature))
            {
                return(false);
            }
            if (!AdditionalAttachments.SequenceEqual(v.AdditionalAttachments))
            {
                return(false);
            }
            if (!Content.Equals(v.Content))
            {
                return(false);
            }
            if (!Enabled.Equals(v.Enabled))
            {
                return(false);
            }
            if (!Html.Equals(v.Html))
            {
                return(false);
            }
            if (!Recipients.Equals(v.Recipients))
            {
                return(false);
            }
            if (!RecipientsBcc.Equals(v.RecipientsBcc))
            {
                return(false);
            }
            if (!RecipientsCc.Equals(v.RecipientsCc))
            {
                return(false);
            }
            if (!Subject.Equals(v.Subject))
            {
                return(false);
            }
            return(true);
        }
Пример #3
0
 public void ReadValues(Data data, string path = "")
 {
     AddSignature = bool.TryParse(data.GetValue(@"" + path + @"AddSignature"), out var tmpAddSignature) ? tmpAddSignature : true;
     try{
         int numClasses = int.Parse(data.GetValue(@"" + path + @"AdditionalAttachments\numClasses"));
         for (int i = 0; i < numClasses; i++)
         {
             try{
                 var value = Data.UnescapeString(data.GetValue(path + @"AdditionalAttachments\" + i + @"\AdditionalAttachments"));
                 AdditionalAttachments.Add(value);
             }catch {}
         }
     }catch {}
     try { Content = Data.UnescapeString(data.GetValue(@"" + path + @"Content")); } catch { Content = ""; }
     Enabled = bool.TryParse(data.GetValue(@"" + path + @"Enabled"), out var tmpEnabled) ? tmpEnabled : false;
     Html    = bool.TryParse(data.GetValue(@"" + path + @"Html"), out var tmpHtml) ? tmpHtml : false;
     try { Recipients = Data.UnescapeString(data.GetValue(@"" + path + @"Recipients")); } catch { Recipients = ""; }
     try { RecipientsBcc = Data.UnescapeString(data.GetValue(@"" + path + @"RecipientsBcc")); } catch { RecipientsBcc = ""; }
     try { RecipientsCc = Data.UnescapeString(data.GetValue(@"" + path + @"RecipientsCc")); } catch { RecipientsCc = ""; }
     try { Subject = Data.UnescapeString(data.GetValue(@"" + path + @"Subject")); } catch { Subject = ""; }
 }
Пример #4
0
        protected Option <string> AddFilePathToAdditionalAttachments(string filePathWithToken)
        {
            if (string.IsNullOrEmpty(filePathWithToken))
            {
                return(Option.Some(""));
            }

            if (!AdditionalAttachmentsDictionary.ContainsKey(filePathWithToken))
            {
                AdditionalAttachments.Add(filePathWithToken);
            }

            AdditionalAttachmentsForTextBox = "";

            RaisePropertyChanged(nameof(AdditionalAttachmentsForTextBox));
            RaisePropertyChanged(nameof(AdditionalAttachmentsDictionary));
            RaisePropertyChanged(nameof(AdditionalAttachments));

            AdditionalAttachmentsTokenViewModel.RaiseTextChanged();

            return(Option.Some(AdditionalAttachmentsForTextBox));
        }
Пример #5
0
        protected Option <string> SelectAttachmentFileAction(string s1)
        {
            var title  = Translation.SelectAttachmentTitle;
            var filter = Translation.AllFiles + " " + @"(*.*)|*.*";

            var interactionResult = _openFileInteractionHelper.StartOpenFileInteraction("", title, filter);

            interactionResult.MatchSome(s =>
            {
                if (!AdditionalAttachmentsDictionary.ContainsKey(s))
                {
                    AdditionalAttachments.Add(s);
                }

                RaisePropertyChanged(nameof(AdditionalAttachmentsForTextBox));
                RaisePropertyChanged(nameof(AdditionalAttachmentsDictionary));
                RaisePropertyChanged(nameof(AdditionalAttachments));

                AdditionalAttachmentsTokenViewModel.RaiseTextChanged();
            });

            return(Option.Some(AdditionalAttachmentsForTextBox ?? ""));
        }