Пример #1
0
 public void recuperarJSON()
 {
     if (File.Exists("contatos.json"))
     {
         Stream stream = File.OpenRead("contatos.json");
         DataContractJsonSerializer serializer = new DataContractJsonSerializer(typeof(ListaContatos));
         this.agenda = (ListaContatos)serializer.ReadObject(stream);
         stream.Close();
     }
 }
Пример #2
0
        public Form1()
        {
            InitializeComponent();
            agenda = new ListaContatos();
            this.recuperarJSON();
            //agenda.recuperar();

            //agenda.incluir(new Contato("joao@nada", "Joao Silva", "1111"));
            //agenda.incluir(new Contato("maria@nada", "Maria Santos", "2222"));
            //agenda.incluir(new Contato("carlos@nada", "Carlos Souza", "3333"));
            //agenda.incluir(new Contato("antonia@nada", "Antonia Rocha", "4444"));
        }