MainWindow.xaml.csの全コード
using System;
using System.Windows;
using System.Windows.Forms;
using System.IO;
namespace WpfFileTest
{
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
private void Button1_Click(object sender, RoutedEventArgs e)
{
if (myControl.OpenFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
using (StreamReader sr = new StreamReader(myControl.OpenFileDialog1.FileName))
{
String FirstLine = sr.ReadLine();
String AllLine = FirstLine + "\r\n" + sr.ReadToEnd();
System.Windows.Forms.MessageBox.Show(FirstLine, "TEST", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
if (myControl.SaveFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
using (StreamWriter outfile = new StreamWriter(myControl.SaveFileDialog1.FileName))
{
outfile.Write(AllLine);
}
}
}
}
}
}
}