예제 #1
0
        private static void Timer_Elapsed(object sender, ElapsedEventArgs e)
        {
            var processUIDs = _allUIds.GetRange(_batchStartIndex, _batchLength);

            Console.WriteLine("Timer Processing", processUIDs);



            Parallel.ForEach(processUIDs, async uid => {
                CustomClient client = null;
                if (MailConnectionManager.TryGetClient(out client))
                {
                    Console.WriteLine(client.Id);
                    var proxy = new MailProxy("imap.gmail.com", EncryptionType.UNENCRYPTED, ref client);
                    if (!client.Connected)
                    {
                        proxy.Login("ramankingdom", "letusc");
                    }
                    proxy.SetWorkingEmailFolder("Inbox");
                    var header = await proxy.GetEmailHeaderAsync(uid);
                    Console.WriteLine(ApplicationHelpers.ConvertBytesToString(header));
                    client.FreeClient();
                }
            }
                             );
        }
예제 #2
0
    public override void OnShow(object msg)
    {
        base.OnShow(msg);
        OwnerView.State.SetActionCompareEnabled(false);
        if (m_MailProxy == null)
        {
            m_MailProxy = GameFacade.Instance.RetrieveProxy(ProxyName.MailProxy) as MailProxy;
        }
        if (m_CfgEternityProxy == null)
        {
            m_CfgEternityProxy = GameFacade.Instance.RetrieveProxy(ProxyName.CfgEternityProxy) as CfgEternityProxy;
        }
        if (m_LogProxy == null)
        {
            m_LogProxy = GameFacade.Instance.RetrieveProxy(ProxyName.LogProxy) as LogProxy;
        }

        OwnerView.State.GetAction(UIAction.Mail_Retrieve).Callback -= GetAccessory;
        OwnerView.State.GetAction(UIAction.Mail_Retrieve).Callback += GetAccessory;
        OwnerView.State.GetAction(UIAction.Mail_Empty).Callback    -= DeleteAll;
        OwnerView.State.GetAction(UIAction.Mail_Empty).Callback    += DeleteAll;
        OwnerView.State.GetAction(UIAction.Mail_Delete).Callback   -= DeleteMail;
        OwnerView.State.GetAction(UIAction.Mail_Delete).Callback   += DeleteMail;
        OwnerView.State.GetAction(UIAction.Mail_Mark).Callback     -= SetMarkMail;
        OwnerView.State.GetAction(UIAction.Mail_Mark).Callback     += SetMarkMail;
        State.OnSelectionChanged += OnSelectionChanged;
    }
예제 #3
0
        static void Main(string[] args)
        {
            //MailInteractionManager proxy = new MailInteractionManager("imap.gmail.com", EncryptionType.UNENCRYPTED);
            CustomClient client = null;

            if (MailConnectionManager.TryGetClient(out client))
            {
                var proxy = new MailProxy("imap.gmail.com", EncryptionType.UNENCRYPTED, ref client);

                if (!client.Connected)
                {
                    proxy.Login("ramankingdom", "letusc");
                }
                var folders = proxy.GetEmailFoldersAsync().GetAwaiter().GetResult();
                proxy.SetWorkingEmailFolder("Inbox");
                _allUIds = proxy.PopulateEmailHeadersIDAsync().GetAwaiter().GetResult();
                client.FreeClient();
            }

            Timer timer = new Timer(3000);

            timer.Elapsed += Timer_Elapsed;
            timer.Start();
            timer.Enabled = true;

            Console.ReadLine();
        }