Esempio n. 1
0
        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();
            }
        }
Esempio n. 2
0
        private void OpenFile(object sender, EventArgs e)
        {
            OpenFileDialog openFileDialog = CFileDialogFactory.createOpenFileDialog();

            if (openFileDialog.ShowDialog(this) == DialogResult.OK)
            {
                // Get variables needed for canvastabpage
                string fileURL = openFileDialog.FileName;

                CProjectInfo info = CFileHelper.getProject(fileURL);

                if (info == null)
                {
                    MessageBox.Show("Unable to open project", "Error in opening file");
                    return;
                }

                CanvasTabPage tabPage = CCanvasTabPageFactory.createPage(CFileHelper.getProject(fileURL), 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);

                CFormController.Instance.mainForm.setStatus("Project Opened");

                this.showToolBox();
            }
        }
Esempio n. 3
0
        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");
            }
        }