public Office365DownloadController(AccountD acc, AccountDownloadListener notify)
 {
     Init(acc, notify);
     //var privateKey ="";
     //var publicKey = "";
     //RSAUtil.GetPublicAndPrivateKey(out privateKey, out publicKey);
 }
        public LiveHotmailDownloadController(AccountD acc, AccountDownloadListener notify)
        {
            browser = new WebView();
            Init(acc, notify);
            currentLookup = 1;

            SetupWebBrowser();
        }
Пример #3
0
 public bool IsDownloadingForAccount(AccountD acc)
 {
     if (acc.SameWith(account))
     {
         return true;
     }
     return false;
 }
        public LiveHotmailDownloadController(AccountD acc, AccountDownloadListener notify)
        {
            browser = new WebView();
            Init(acc, notify);


            timer = new DispatcherTimer();
            timer.Interval = new TimeSpan(0, 0, 0, 1);
            timer.Tick += OnTimedEvent;

            browser.NavigationCompleted += webview_NavigationCompleted;
            
            scope = "wl.basic%20wl.contacts_emails%20wl.contacts_phone_numbers";
        }
Пример #5
0
        public void DownloadContacts(AccountD acc, AccountDownloadListener notify)
        {
            HostType hostType = acc.HostType;
            DownloadController hostDownload = null;

            // remove old DownloadController first
            string username = acc.UserName;
            int accTypeId = acc.AccountTypeId;            
            //DownloadController downloadController;
            //AccountD acc2;

            listDownloadController = new List<DownloadController>();
            //int len = listDownloadController.Count();
            //for (int i = 0; i < len; i++)
            //{
            //    downloadController = listDownloadController[i];
            //    acc2 = downloadController.Account;
            //    if (acc.SameWith(acc2))
            //    {
            //        listDownloadController.RemoveAt(i);
            //        break;
            //    }
            //}

            switch (hostType)
            {
                case HostType.TYPE_GMAIL:
                    hostDownload = new GoogleDownloadController(acc, notify);
                    break;
                case HostType.TYPE_YAHOO:
                    hostDownload = new YahooDownloadController(acc, notify);
                    break;
                case HostType.TYPE_LIVE_HOTMAIL:
                    hostDownload = new LiveHotmailDownloadController(acc, notify);
                    break;
                case HostType.TYPE_OUTLOOK:
                    hostDownload = new OutlookDownloadController(acc, notify);
                    break;
                //case HostType.TYPE_ICLOUD:
                //    hostDownload = new ICloudDownloadController(acc, notify);
                //    break;
                case HostType.TYPE_EXCHANGE_SERVER:
                    hostDownload = new ExchangeDownloadController(acc, notify);
                    break;
                case HostType.TYPE_OFFICE_365:
                        hostDownload = new Office365DownloadController(acc, notify);
                        break;
                        
            }

            if (hostDownload != null)
            {
                listDownloadController.Add(hostDownload);
                hostDownload.DownloadContacts();
            }
        }
Пример #6
0
 public void DownloadContactsByManual(WebView webView, AccountD account, bool isLoaded)
 {
     HostType hostType = account.HostType;
     switch (hostType)
     {
         case HostType.TYPE_GMAIL:
             new GoogleDownloadController().CheckingLoginByManualSuccess(webView, isLoaded);
             break;
         case HostType.TYPE_LIVE_HOTMAIL:
             new LiveHotmailDownloadController().CheckingLoginByManualSuccess(webView, isLoaded);
             break;
         case HostType.TYPE_YAHOO:
             new YahooDownloadController().CheckingLoginByManualSuccess(webView, isLoaded);
             break;
     }
 }
Пример #7
0
 public void TwoStepVerification(string code, AccountD account)
 {
     HostType hostType = account.HostType;
     switch (hostType)
     {
         case HostType.TYPE_GMAIL:
             new GoogleDownloadController().TwoStepVerification(code);
             break;
         case HostType.TYPE_LIVE_HOTMAIL:
             new LiveHotmailDownloadController().TwoStepVerification(code);
             break;
     }
 }
Пример #8
0
 public void CheckUnExpectedPageForAccount(AccountD account)
 {
     int len = listDownloadController.Count();
     DownloadController controller;
     for (int i = 0; i < len; i++)
     {
         controller = listDownloadController[i];
         if (controller.Account == account)
         {
             controller.CheckUnExpectedPage();
             return;
         }
     }
 }
Пример #9
0
 public void CancelDownload(AccountD acc)
 {
     int len = listDownloadController.Count();
     DownloadController controller;
     for (int i = 0; i < len; i++)
     {
         controller = listDownloadController[i];
         if (controller.IsDownloadingForAccount(acc))
         {
             controller.CancelDownload();
             return;
         }
     }
 }
Пример #10
0
 public bool IsDownloadUnExpectedPage(AccountD acc)
 {
     DownloadController downloadController;
     int len = listDownloadController.Count();
     for (int j = 0; j < len; j++)
     {
         downloadController = listDownloadController[j];
         if (downloadController.Account == acc && downloadController.IsDownloadGotUnexpectedPage())
         {
             return true;
         }
     }
     return false;
 }
Пример #11
0
        private void ImportContactsFromAccount()
        {
            string accountText = tbox_account.Text.Trim();
            string pass = tbox_password.Password.Trim();

            //account = dbController.GetOrAddAccountByAccountText(accountText, hostType);
            var accountType = dbController.GetAccountTypeByHostType(hostType);
            account = new AccountD();
            account.UserName = accountText;
            account.Password = pass;
            account.AccountType = new AccountType();
            account.AccountType = accountType;
            account.HostType = hostType;
            DoDownloadContacts(account);
        }
Пример #12
0
 public ExchangeDownloadController(AccountD acc, AccountDownloadListener listener)
 {
     Init(acc, listener);            
 }
Пример #13
0
        public YahooDownloadController(AccountD acc, AccountDownloadListener notify)
        {
            browser = new WebView();
            Init(acc, notify);
            SetupWebBrowser();

            isReload = false;
            currentLookup = 1;
        }
Пример #14
0
        public GoogleDownloadController(AccountD acc, AccountDownloadListener notify)
        {
            //browser = webBrowser;
            browser = new WebView();
            Init(acc, notify);
            SetupWebBrowser();

            currentLookup = 1;
        }
Пример #15
0
        // import from account
        public void DoDownloadContacts(AccountD account)
        {
            //progressDialog.AccountTypeText = account.AccountType.Name;
            // progressDialog.AccountText = account.UserName;
            downloadController.mode = contactMode;
            downloadController.accountTypeName = account.AccountType.Name;
            downloadController.DownloadContacts(account, this);
            //await progressDialog.ShowAsync();

            //WebViewControl.Navigate(new Uri("http://www.microsoft.com"));
        }
Пример #16
0
        public string GetDefaultWebBrowserByAccountDB(AccountD account)
        {
            string url = string.Empty;
            HostType hostType = account.HostType;
            switch (hostType)
            {
                case HostType.TYPE_GMAIL:
                    url = new GoogleDownloadController().LOGIN_URL;
                    break;
                case HostType.TYPE_YAHOO:
                    url = new YahooDownloadController().LOGIN_URL;
                    break;
                case HostType.TYPE_LIVE_HOTMAIL:
                    url = new LiveHotmailDownloadController().LOGIN_URL;
                    break;
            }

            //DownloadController downloadController;
            //int len = listDownloadController.Count();

            //for (int j = 0; j < len; j++)
            //{
            //    downloadController = listDownloadController[j];
            //    return downloadController.Browser;
            //}

            return url;
        }
Пример #17
0
 protected void Init(AccountD acc, AccountDownloadListener notify)
 {
     account = acc;
     if (acc.HostType == HostType.TYPE_EXCHANGE_SERVER || acc.HostType == HostType.TYPE_OFFICE_365)
     {
         MAX_PROCESSING_SLEEP_COUNT = 360; // 360 x 500 = 180000: 3 minutes
     }
     this.listener = notify;
     AddNotifyStatusListener(notify);
 }
Пример #18
0
 public OutlookDownloadController(AccountD acc, AccountDownloadListener notify)
 {
     Init(acc, notify);
 }