public AccountDialog(OutgoingMailServiceResolver serviceResolver)
 {
     _serviceResolver = serviceResolver;
     Account = new Account();
     InitializeComponent();
     Title = "Add new account";
 }
 public AccountDialog(Account account, OutgoingMailServiceResolver serviceResolver)
 {
     Account = account ?? new Account();
     _serviceResolver = serviceResolver;
     InitializeComponent();
     Loaded += LoadedHandler;
     Title = "Edit account";
 }
        public void Init(Account account)
        {
            if (account == null) return;

            EmailGroup.Name = string.Format("{0} ({1})", account.Name, account.Login);
            EmailGroup.AccountId = account.Id;

            Account = account;
            AccountId = account.Id;
        }
Exemple #4
0
 public static string Encode(Account account)
 {
     byte[] arr;
     var bf = new BinaryFormatter();
     using (var ms = new MemoryStream())
     {
         bf.Serialize(ms, account);
         arr = ms.ToArray();
     }
     return Convert.ToBase64String(arr);
 }
        public bool Test(Account account)
        {
            Init(account);

            var result = TestConnection() && TestLogin();

            Stop();

            return result;
        }
        private void StartAccount(Account account)
        {
            var service = _serviceResolver.Resolve(account.ProtocolType);

            if (service == null) return;

            _servicesPool.Add(account.Id, service);
            service.Init(account);

            if (_emailGroupList.All(m => m.AccountId != account.Id))
            {
                _emailGroupList.Add(service.EmailGroup);
            }

            _mailStorage.AddLoadedEmails(service.EmailGroup);
            service.Start();
        }