コード例 #1
0
ファイル: Form1.cs プロジェクト: briancullinan/epiccentral
        private void button1_Click(object sender, EventArgs e)
        {
            label1.Text = "Getting folder list...";
            IMAPConfig config = new IMAPConfig(@"c:\test1.cfg");

            client = new IMAPAsyncClient(config, 5);
            //IMAPConnectionPool.GetInstance().StartUp(config, 5);
            client.Start();
            client.RequestManager.SubmitRequest(new FolderTreeRequest("\"\"", FolderTreeCallback), false);
            button1.Enabled = false;
            button2.Enabled = true;
        }
コード例 #2
0
ファイル: MainFrm.cs プロジェクト: codemonkey85/evimsync
        private List <Note> GetMailList(string server, string username, string password, string notefolder)
        {
            List <Note> noteList = new List <Note>();

            if (cancelled)
            {
                return(noteList);
            }

            IMAPConfig config = new IMAPConfig(server, username, password, true, true, "/");

            client = new IMAPAsyncClient(config, 2);
            if (client.Start(false) == false)
            {
                cancelled = true;
                return(noteList);
            }

            GetMailsListRecursive(notefolder, ref noteList);

            return(noteList);
        }
コード例 #3
0
ファイル: Program.cs プロジェクト: codemonkey85/evimsync
        static void Main(string[] args)
        {
            IMAPConfig config = new IMAPConfig("imap.gmail.com", "atmospherian", "Xr3pr1s3Y", true, true, "");

            config.SaveConfig(@"c:\settings.cfg");
            //IMAPConfig config = new IMAPConfig(@"c:\test1.cfg");
            IMAPAsyncClient client = new IMAPAsyncClient(config, 5);

            client.MailboxManager.CreateNewMailbox(@"c:\test.mbx");


            client.Start();
            FolderTreeRequest ftr = new FolderTreeRequest("\"\"", null);

            client.RequestManager.SubmitAndWait(ftr, false);

            IBatchRequest batch = new SimpleBatchRequest();

            foreach (IFolder folder in client.MailboxManager.GetAllFolders())
            {
                FolderDataRequest fdr = new FolderDataRequest(folder, null);
                fdr.RequestCompleted += delegate(IRequest req)
                {
                    FolderDataProcessor fdp = req.GetProcessorAsType <FolderDataProcessor>();
                    IFolder             f   = fdp.Request.Command.ParameterObjects[0] as IFolder;
                    Console.WriteLine("Data for {0} loaded. {1} Messages found.", f.Name, f.Exists);
                };
                batch.Requests.Add(fdr);
            }

            client.RequestManager.SubmitBatchAndWait(batch, false);
            batch.Requests.Clear();
            foreach (IFolder folder in client.MailboxManager.GetAllFolders())
            {
                MessageListRequest mlr = new MessageListRequest(folder, null);
                mlr.RequestCompleted += delegate(IRequest req)
                {
                    MessageListProcessor fdp = req.GetProcessorAsType <MessageListProcessor>();
                    IFolder f = fdp.Request.Command.ParameterObjects[0] as IFolder;
                    Console.WriteLine("Message List for {0} loaded. {1} Messages found.", f.Name, f.Exists);
                };

                batch.Requests.Add(mlr);
            }

            client.RequestManager.SubmitBatchAndWait(batch, false);

            client.MailboxManager.DownloadEntireAccount(delegate(int messagesCompleted, int totalMessages, IFolder currentFolder)
            {
                Console.WriteLine();
                Console.WriteLine("Message {0} of {1} downloaded from {2}", messagesCompleted, totalMessages, currentFolder.Name);
            }, delegate(int totalFolders, int totalMessages, long totalTime)
            {
                Console.WriteLine("{0} Messages in {1} folders downloaded in {2} minutes.", totalMessages, totalFolders, new TimeSpan(totalTime).Minutes);
            });


            //config.CacheFi

            Console.WriteLine("Press any key");
            Console.ReadLine();



            client.Stop();
        }