public MainForm(OpenProjectProps openProjProps) { InitializeComponent(); this.FormClosing += MainForm_FormClosing; this.FormClosed += MainForm_FormClosed; ctPanel.OnItemSelected += ctPanel_onItemSelected; pbDraw.Draw += drawPanel_Draw; pbDraw.MouseClick += pbDraw_MouseClick; pbDraw.MouseMove += pbDraw_MouseMove; pbDraw.MouseDown += pbDraw_MouseDown; pbDraw.MouseUp += pbDraw_MouseUp; Init(); if (openProjProps.Type == OpenType.New) { string mainDir = openProjProps.ProjectFolder + "\\" + openProjProps.ProjectName; Directory.CreateDirectory(mainDir); AppManager.SetAppName(openProjProps.ProjectName); AppManager.SetRootDir(false,mainDir); AppManager.RunFirstSetUp(); } else { AppManager.LoadFromFile(openProjProps.ProjectFile); } }
private void btnExisting_Click(object sender, EventArgs e) { OpenFileDialog dialog = new OpenFileDialog(); DialogResult res = dialog.ShowDialog(); if (res == System.Windows.Forms.DialogResult.OK) { OpenProjectProps props = new OpenProjectProps(); props.ProjectFile = dialog.FileName; props.Type = OpenType.Existing; if (OnOpenProject != null) { OnOpenProject(this, new OpenProjectArgs(props)); } } }
private void btnNewProject_Click(object sender, EventArgs e) { NewProject dialog = new NewProject(); DialogResult res = dialog.ShowDialog(); if (res == System.Windows.Forms.DialogResult.OK) { OpenProjectProps props = new OpenProjectProps(); props.Type = OpenType.New; props.ProjectFolder = dialog.Directory; props.ProjectName = dialog.ProjectName; if (OnOpenProject != null) { OnOpenProject(this, new OpenProjectArgs(props)); } } }
public OpenProjectArgs(OpenProjectProps props) { Props = props; }