private void ShowNewForm(object sender, EventArgs e) { SaveFileDialog saveFileDialog = CFileDialogFactory.createNewFileDialog(); if (saveFileDialog.ShowDialog(this) == DialogResult.OK) { // Get variables needed for canvastabpage string fileURL = saveFileDialog.FileName; // New form - new info CProjectInfo projectInfo = new CProjectInfo(); projectInfo.languageID = ((CLanguageInfo)CFormController.Instance.languageBox.SelectedItem).Value; // Create tabpage from them CanvasTabPage tabPage = CCanvasTabPageFactory.createNewPage(projectInfo, fileURL); // And add it to tabControl pageContainerControl.TabPages.Add(tabPage); pageContainerControl.SelectedTab = tabPage; // Manually cast selectindexchanged, since it doesnt fire when the first tab // is opened this.pageContainerControl_SelectedIndexChanged(null, null); // Save it also CFileHelper.saveProject(tabPage.projectInfo, tabPage.url); CFormController.Instance.mainForm.setStatus("Project Created"); showToolBox(); } }
private void SaveAsToolStripMenuItem_Click(object sender, EventArgs e) { // Get active child and update its properties CanvasTabPage activeChild = (CanvasTabPage)pageContainerControl.SelectedTab; if (activeChild == null) { // Nothing to save as return; } // Invoke setter to get projectinfo if in view mode activeChild.projectInfo.projectXml = activeChild.activeProjectContent; SaveFileDialog saveFileDialog = CFileDialogFactory.createSaveFileDialog(); if (saveFileDialog.ShowDialog(this) == DialogResult.OK) { // Get variables needed for canvastabpage activeChild.url = saveFileDialog.FileName; activeChild.Text = System.IO.Path.GetFileName(activeChild.url); // And save it CFileHelper.saveProject(activeChild.projectInfo, activeChild.url); CFormController.Instance.mainForm.setStatus("Project Saved"); } }
private void saveToolStripButton_Click(object sender, EventArgs e) { CanvasTabPage activeChild = (CanvasTabPage)pageContainerControl.SelectedTab; if (activeChild == null) { // Nothing to save return; } // Invoke setter to get projectinfo if in view mode activeChild.projectInfo.projectXml = activeChild.activeProjectContent; CFileHelper.saveProject(activeChild.projectInfo, activeChild.url); CFormController.Instance.mainForm.setStatus("Project Saved"); }