MVP模式并调用SaveFileDialog

时间:2015-10-05 17:38:11

标签: c# winforms mvp

我试图了解MVP设计模式。我有应用程序WinForms(查看)+ DLL(IVIEW,IMODEL)

1)演员在哪里更好? DLL或WinForms应用程序?

2)我在哪里调用SaveFile()方法将结果保存到文件中?

public MyPresenter(IMyModel model, IMyView view) 
{
   ...
   this.view.SavetoFile += View_SavetoFile;
}
private void View_SavetoFile(object sender, EventArgs e)
{
   SaveFile()
}
private void SaveFile()
{
  using (var saveFileDialog = new SaveFileDialog())
  {
     if (DialogResult.OK == saveFileDialog.ShowDialog())
     {
       using (var xnmlFile = new XMLFile(saveFileDialog.FileName))
       {
        xmlFile.Save(this.model.Result)
       }
     }
 }

是吗?

0 个答案:

没有答案