示例#1
0
        private void Import(string fileName, Person.Format fmt)
        {
            PersonsList pl = null;

            // Import contacts
            if (fmt == Person.Format.CSV)
            {
                pl = PersonsList.ImportCsv(fileName);
            }
            else
            if (fmt == Person.Format.VCF)
            {
                pl = PersonsList.ImportVcf(fileName);
            }
            else
            {
                throw new ApplicationException("Sorry, cannot import from HTML");
            }

            // Add new contacts
            foreach (var p in pl)
            {
                agendaSystem.PersonsList.Insert(p);
            }

            // Finish
            this.persons           = this.agendaSystem.PersonsList;
            this.cbCategory.Active = 0;
            this.UpdatePersons();
            Util.MsgInfo(this, AppInfo.Name, "Added " + pl.Size() + " persons");
        }