Esempio n. 1
0
        private void InboxYahoo(Yahoo yahoo)
        {
            int size = 0;

            if (yahoo.GotoInboxFolder())
            {
                //case 1  open and archive
                if (open_archive.Checked)
                {
                    //all magic happen here
                    bool repeat_arhive(int page, bool star, bool click, string search)
                    {
                        var status = yahoo.OpenArchive(page, star, click, search);

                        if ((bool)status[0])
                        {
                            page = (int)status[1];
                            return(repeat_arhive(page, star, click, search));
                        }
                        return(false);
                    }

                    while (repeat_arhive(size, star_click.Checked, body_click.Checked, txt_subject.Text))
                    {
                        Application.DoEvents();
                    }
                }

                //case 2 open and reply and archive
                if (open_reply_archive.Checked)
                {
                    //all magic happen here
                    bool repeat_open_reply_arhive(int page, bool star, bool click, string search)
                    {
                        var status = yahoo.OpenReplyArchive(page, star, click, search);

                        if ((bool)status[0])
                        {
                            page = (int)status[1];
                            return(repeat_open_reply_arhive(page, star, click, search));
                        }
                        return(false);
                    }

                    while (repeat_open_reply_arhive(size, star_click.Checked, body_click.Checked, txt_subject.Text))
                    {
                        Application.DoEvents();
                    }
                }

                // case 3 open and reply
                if (open_reply.Checked)
                {
                    //all magic happen here
                    bool repeat_open_reply(int page, bool star, bool click, string search)
                    {
                        var status = yahoo.OpenReply(page, star, click, search);

                        if ((bool)status[0])
                        {
                            page = (int)status[1];
                            return(repeat_open_reply(page, star, click, search));
                        }
                        return(false);
                    }

                    while (repeat_open_reply(size, star_click.Checked, body_click.Checked, txt_subject.Text))
                    {
                        Application.DoEvents();
                    }
                }

                //case 4 select archive
                if (select_archive.Checked)
                {
                    //all magic happen here
                    bool repeat_select_archive(int page, bool star, string search)
                    {
                        var status = yahoo.SelectArchive(page, star, search);

                        if ((bool)status[0])
                        {
                            page = (int)status[1];
                            return(repeat_select_archive(page, star, search));
                        }
                        return(false);
                    }

                    while (repeat_select_archive(size, star_click.Checked, txt_subject.Text))
                    {
                        Application.DoEvents();
                    }
                }

                //case 5 select all archive
                if (select_all_archive.Checked)
                {
                    //all magic happen here
                    bool repeat_select_all_archive(int page, bool star)
                    {
                        var status = yahoo.SelectAllArchive(page, star);

                        if ((bool)status[0])
                        {
                            page = (int)status[1];
                            return(repeat_select_all_archive(page, star));
                        }
                        return(false);
                    }

                    while (repeat_select_all_archive(size, star_click.Checked))
                    {
                        Application.DoEvents();
                    }
                }

                //case 6 random
                if (random_actions.Checked)
                {
                    //all magic happen here
                    bool repeat_random(int page, bool star, bool bodyclick, string subject)
                    {
                        var status = yahoo.RandomAction(page, star, bodyclick, subject);

                        if ((bool)status[0])
                        {
                            page = (int)status[1];
                            return(repeat_random(page, star, bodyclick, subject));
                        }
                        return(false);
                    }

                    while (repeat_random(size, star_click.Checked, body_click.Checked, txt_subject.Text))
                    {
                        Application.DoEvents();
                    }
                }
            }
        }