/
MainForm.cs
54 lines (41 loc) · 1.5 KB
/
MainForm.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
using System.Windows.Forms;
using TurboNPortugol.Presenters;
using TurboNPortugol.Views.About;
using TurboNPortugol.Views.Exec;
namespace TurboNPortugol.Views
{
public partial class MainForm : Form, IMainView
{
private IMainPresenter mainPresenter;
public MainForm()
{
InitializeComponent();
mainPresenter = new MainPresenter {MainView = this};
mainPresenter.CreateWindow(string.Empty);
//execForm1.ExecPresenter = new ExecPresenter(mainPresenter) {ExecView = execForm1};
}
private void abrirToolStripMenuItem_Click(object sender, System.EventArgs e)
{
var dialog = new OpenFileDialog();
if (DialogResult.OK == dialog.ShowDialog())
{
var filepath = dialog.FileName;
mainPresenter.CreateWindow(filepath);
}
}
public void AddTab(ExecPresenter presenter)
{
tabControl1.TabPages.Add(presenter.ExecView.ProgramName, presenter.ExecView.ProgramName);
tabControl1.TabPages[tabControl1.TabCount-1].Controls.Add((ExecForm)presenter.ExecView);
tabControl1.SelectTab(tabControl1.TabCount - 1);
}
public void CloseTab(string name)
{
tabControl1.TabPages.RemoveByKey(name);
}
private void tutoriaisToolStripMenuItem_Click(object sender, System.EventArgs e)
{
new AboutForm().ShowDialog();
}
}
}