当前位置: 首页>>代码示例>>C#>>正文


C# Api.Events方法代码示例

本文整理汇总了C#中Api.Events方法的典型用法代码示例。如果您正苦于以下问题:C# Api.Events方法的具体用法?C# Api.Events怎么用?C# Api.Events使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Api的用法示例。


在下文中一共展示了Api.Events方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Main

        static void Main(string[] args)
        {
            var api = new Api(Settings.Default.DomainKey, Settings.Default.DomainPassword);

            var consent = api.Consent(ContactSource.Gmail);

            Process.Start(consent.Url);

            bool complete = false;
            while (!complete)
            {
                var events = api.Events(consent.ImportId);

                foreach (var item in events.Events)
                    Console.WriteLine("{0}-{1}", item.Type, item.Status);

                complete = events.IsComplete;
            }

            var contacts = api.Contacts(consent.ImportId);

            foreach (var item in contacts.Contacts)
                Console.WriteLine("{1}, {0} ({2})", item.FirstName, item.LastName, item.EmailAddresses.FirstOrDefault());
        }
开发者ID:cloudsponge,项目名称:cloudsponge-lib-net,代码行数:24,代码来源:Program.cs

示例2: GetFriendsEmail

        public List<string> GetFriendsEmail(string mailType)
        {
            List<string> lstEmail = new List<string>();
            try
            {
                try
                {
                    //Client ID 	767237347813-0decm2cgu5sab8pr50rr0hmerh9e0q73.apps.googleusercontent.com
                    //Client secret 	DQNCzBuiwo0U58rkAbo38Jvs

                    string domainKey = ConfigurationSettings.AppSettings["DomainKey"];
                    string domainPassword = ConfigurationSettings.AppSettings["DomainPassword"];

                    //var api = new Api(Settings.Default.DomainKey, Settings.Default.DomainPassword);

                    var api = new Api(domainKey, domainPassword);

                    //var api = new Api("QHBFU6D43BDCTQJT3XVZ", "vtFIAaMaGkSYVZMY");

                    //var consent = api.Consent(ContactSource.Gmail);

                    ConsentResponse consent = null;

                    if (mailType == "gmail")
                    {
                        consent = api.Consent(ContactSource.Gmail);
                    }

                    if (mailType == "yahoo")
                    {
                        consent = api.Consent(ContactSource.Yahoo);
                    }

                    if (mailType == "hotmail")
                    {
                        consent = api.Consent(ContactSource.WindowsLive);
                    }
                    

                    //Process.Start("https://accounts.google.com/o/oauth2/auth?response_type=code&client_id=767237347813-0decm2cgu5sab8pr50rr0hmerh9e0q73.apps.googleusercontent.com&scope=https%3A%2F%2Fwww.google.com%2Fm8%2Ffeeds&redirect_uri=https%3A%2F%2Fapi.cloudsponge.com%2Fauth&state=import_id%3D30938548");
                    Process.Start(consent.Url);

                    bool complete = false;
                    while (!complete)
                    {
                        var events = api.Events(consent.ImportId);

                        foreach (var item in events.Events)
                            Console.WriteLine("{0}-{1}", item.Type, item.Status);

                        complete = events.IsComplete;
                    }

                    var contacts = api.Contacts(consent.ImportId);

                    foreach (var item in contacts.Contacts)
                    {
                        try
                        {
                            Console.WriteLine("{1}, {0} ({2})", item.FirstName, item.LastName, item.EmailAddresses.FirstOrDefault());
                            string emailAddresses = item.FirstName + "<~>" + item.LastName + "<~>" + item.EmailAddresses.FirstOrDefault();
                            lstEmail.Add(emailAddresses);
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine("Error : " + ex.StackTrace);
                        }
                    }
                }
                catch (Exception)
                {

                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error : " + ex.StackTrace);
            }
            return lstEmail;
        }
开发者ID:prog-moh,项目名称:socioboard-core,代码行数:80,代码来源:GatherEmailByCloudSponge.cs

示例3: GetContext

        private static List<string> GetContext(Api api, ConsentResponse consent)
        {
            List<string> lstEmail = new List<string>();
            try
            {
                bool complete = false;
                while (!complete)
                {
                    var events = api.Events(consent.ImportId);

                    foreach (var item in events.Events)
                        Console.WriteLine("{0}-{1}", item.Type, item.Status);

                    complete = events.IsComplete;
                }

                var contacts = api.Contacts(consent.ImportId);

                foreach (var item in contacts.Contacts)
                {
                    try
                    {
                        Console.WriteLine("{1}, {0} ({2})", item.FirstName, item.LastName, item.EmailAddresses.FirstOrDefault());
                        string emailAddresses = item.FirstName + "<~>" + item.LastName + "<~>" + item.EmailAddresses.FirstOrDefault();
                        lstEmail.Add(emailAddresses);
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine("Error : " + ex.StackTrace);
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error : " + ex.StackTrace);
            }

            return lstEmail;
        }
开发者ID:NALSS,项目名称:socioboard,代码行数:39,代码来源:AjaxInviteFrndsByCloudSponge.aspx.cs


注:本文中的Api.Events方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。