新增一個<類別庫>的專案
加入System.Windows.Form參考
===========================================================================
加入剛才類別庫 FactoryPattern_lib
加入一個comboBox和一個button
private void button1_Click(object sender, EventArgs e)
{
string fileFormat = comboBox1.Text;
if(fileFormat!="")
{
var fileProc = FileProcessorFactory.getInstance(fileFormat);
string fileType = fileProc.Open();
MessageBox.Show(fileType);
fileProc.Close();
}
}






請先 登入 以發表留言。