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


C# Book.Open方法代码示例

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


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

示例1: GetContacts

        public ArrayList GetContacts(string bookName)
        {
            string contact_fax = null;
            ArrayList ebooks = new ArrayList();
            ArrayList records = new ArrayList();

            SourceList slist = new SourceList ("/apps/evolution/addressbook/sources");
            if (slist != null) {
                SList group_list = slist.Groups;
                foreach (SourceGroup group in group_list) {
                    //Only get phone books on this machine.
                    if (group.Name == "On This Computer") {
                        SList src_list = group.Sources;

                        foreach (Evolution.Source src in src_list) {
                            if (src.Name == bookName) {
                                //Book bk = Book.NewSystemAddressbook ();
                                Book bk = new Book(src);
                                bk.Open (true);

                                BookQuery q = BookQuery.AnyFieldContains ("");
                                Contact[] contactlist = bk.GetContacts (q);
                                //Console.WriteLine ("Contact count (range) : {0}", contactlist.Length);

                                if (contactlist != null) {

                                    foreach (Contact comp in contactlist) {
                                        contact_fax = null;

                                        if (comp.BusinessFax != null && comp.BusinessFax != String.Empty) {
                                            contact_fax = comp.BusinessFax;
                                        }
                                        else if (comp.OtherFax != null && comp.OtherFax != String.Empty) {
                                            contact_fax = comp.OtherFax;
                                        }
                                        else if (comp.HomeFax != null && comp.HomeFax != String.Empty) {
                                            contact_fax = comp.HomeFax;
                                        }

                                        if (contact_fax != null) {
                                            GfaxContact gc = new GfaxContact();
                                            //Console.WriteLine ("Id: {0}", comp.Id);
                                            gc.PhoneNumber = contact_fax;
                                            gc.ContactPerson = comp.FullName;
                                            gc.Organization = comp.Org;
                                            records.Add(gc);
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            return records;
        }
开发者ID:horga83,项目名称:gfax,代码行数:56,代码来源:evolution.cs


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