Пример #1
0
        private void btnOpenProject_Click(object sender, EventArgs e)
        {
            try
            {
                var dlgOpen = new OpenFileDialog();
                dlgOpen.Filter = "Mahan Content Management Files | *.mcm";
                if (dlgOpen.ShowDialog() == DialogResult.OK && !string.IsNullOrEmpty(dlgOpen.FileName))
                {
                    if (ProjectFolder.IsValidProjectDirectory(DiskIO.GetDirectoryName(dlgOpen.FileName)))
                    {
                        //MessageBox.Show("sdadada");

                        Program.currentProject = new ProjectFolder(dlgOpen.FileName);
                        Program.mcmFile        = dlgOpen.FileName;

                        frmSenarioMaker workDlg = new frmSenarioMaker(this);
                        this.Hide();
                        workDlg.Show();
                    }
                    else
                    {
                        throw new Exception(".MCM File or project directory is not valid.");
                    }
                }
            }
            catch (Exception exp)
            {
                MessageBox.Show("Can not load existed project. Please review directory and .mcm file.\n" + "Details: " + exp.Source + " - " + exp.Message, "Loading Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Пример #2
0
        public void btnNewProject_Click(object sender, EventArgs e)
        {
            try
            {
                frmNewProject newProjWin = new frmNewProject();
                var           res        = newProjWin.ShowDialog(this);
                if (res == DialogResult.OK)
                {
                    Program.currentProject = new ProjectFolder(newProjWin.SelectedTitle, newProjWin.SeletedFolder);
                    Program.mcmFile        = newProjWin.SeletedFolder + "\\" + newProjWin.SelectedTitle + "\\" + newProjWin.SelectedTitle + ".mcm";
                    Program.currentProject.CreateNewProjectDirectories();


                    frmSenarioMaker workDlg = new frmSenarioMaker(this);
                    this.Hide();
                    workDlg.Show();
                }
            }
            catch (Exception exp)
            {
                MessageBox.Show("Can not create new project. Please review location and title parameters.\n" + "Details: " + exp.Source + " - " + exp.Message, "Creation Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }