private void AbrirArquivoOk(object sender, System.ComponentModel.CancelEventArgs e) { try { caminho = DialogoAbrir.FileName; NomeArquivo.Text = DialogoAbrir.FileName; FileInfo arquivo = new FileInfo(DialogoAbrir.FileName); Conteudo.Text = ""; TextReader reader = null; reader = arquivo.OpenText(); string line = reader.ReadLine(); while (line != null) { Conteudo.Text += line + "\n"; line = reader.ReadLine(); } reader.Close(); flag = false; Salvar.IsEnabled = false; throw new System.ArgumentException("Teste", "original"); } catch (Exception ex) { AppManager.AppExceptionsTxt exc = new AppExceptionsTxt(); exc.SalvarExcecao(ex); } }
protected void SalvarArquivo() { try { if (caminho.Trim() == "") { DialogoSalvar.ShowDialog(); } else { File.WriteAllText(caminho, Conteudo.Text, Encoding.UTF8); flag = false; Salvar.IsEnabled = false; SalvarComo.IsEnabled = false; } } catch (Exception ex) { AppManager.AppExceptionsTxt exc = new AppExceptionsTxt(); exc.PathSaveException = "C:"; exc.SalvarExcecao(ex, caminho); } }