예제 #1
0
파일: MainForm.cs 프로젝트: artmachinez/bc
        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();
            }
        }
예제 #2
0
파일: MainForm.cs 프로젝트: artmachinez/bc
        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();
            }
        }