Exemplo n.º 1
0
        //public static WabContact[] WabContacts { get; private set; }


        public static void InitData(string filename)
        {
            try
            {
                WabContact[] WabContacts = WabIO.ReadCsv(filename);

                Data = new List <Contact>(WabContacts.Length);

                foreach (WabContact wabContact in WabContacts)
                {
                    Contact cont = new Contact(wabContact);
                    Data.Add(cont);
                }

                if (Data.Count == 0)
                {
                    MessageBox.Show(
                        "Die Datei \""
                        + Path.GetFileName(filename)
                        + "\" enthält keine Telefonnummern.",
                        "Telefonliste",
                        MessageBoxButton.OK, MessageBoxImage.Information);
                    Data = null;
                    return;
                }

                Data.Sort();
            }
            catch (Exception e)
            {
                Data = null;
                throw new Exception(e.Message, e);
            }
        }
Exemplo n.º 2
0
        private void LoadFile(string filename)
        {
            WabContact[] wabContacts;

            if (Path.GetExtension(filename) == ".csv")
            {
                wabContacts = WabIO.ReadCsv(filename);
            }
            else
            {
                wabContacts = WabIO.ReadVcard(filename);
            }

            InitData(filename, wabContacts);
        }