Пример #1
0
 private void AdicionarCategoria(CategoriaFlashcard categoria)
 {
     if (categoria != null)
     {
         categorias.Add(categoria);
         lsbCategorias.Items.Add(categoria.Nome);
         cbxCategoria.Items.Add(categoria.Nome);
         cbxExibirCategoria.Items.Add(categoria.Nome);
         txtMateria_TextChanged(this, new EventArgs());
         gbNovoFlashcard.Enabled = true;
     }
 }
Пример #2
0
        public static CategoriaFlashcard LerRegistro(StreamReader arquivo, string caminhoImagensFlashcards)
        {
            if (arquivo.EndOfStream)
            {
                throw new Exception("Arquivo terminado");
            }
            string linha = arquivo.ReadLine();

            if (linha == "")
            {
                return(null);
            }
            string             nomeCategoria  = linha.Substring(0, 50).Trim();
            int                qtosFlashcards = int.Parse(linha.Substring(50));
            CategoriaFlashcard ctg            = new CategoriaFlashcard(nomeCategoria);

            for (int i = 0; i < qtosFlashcards; i++)
            {
                ctg.AdicionarFlashcard(Flashcard.LerRegistro(arquivo, caminhoImagensFlashcards + "\\" + nomeCategoria));
            }
            return(ctg);
        }
Пример #3
0
        private void UcFlashcards_Load(object sender, EventArgs e)
        {
            txtDefinicao.Location = new Point(148, 98);

            if (File.Exists(caminhoFlashcards))
            {
                StreamReader arquivo = new StreamReader(caminhoFlashcards);

                while (!arquivo.EndOfStream)
                {
                    AdicionarCategoria(CategoriaFlashcard.LerRegistro(arquivo, caminhoImagens));
                }
                arquivo.Close();

                foreach (CategoriaFlashcard ctg in categorias)
                {
                    foreach (Flashcard flsc in ctg.flashcards)
                    {
                        ((CaixaFlashcards)tabPage1.Controls.Find("caixaFlashcards" + (flsc.Nivel + 1), false)[0]).AdicionarFlashcard(flsc);
                    }
                }
            }
        }