Exemple #1
0
        private void mbtnOpenProject_Click(object sender, EventArgs e)
        {
            if (myEditorTabsPanel.HasChanged)
            {
                DialogResult res = MessageBox.Show("You have unsaved changes. Do you want to save?", "Unsaved Project", MessageBoxButtons.YesNoCancel);
                if (res == DialogResult.Yes)
                {
                    myEditorTabsPanel.SaveAll();
                }
                else if (res == DialogResult.Cancel)
                {
                    return;
                }
            }

            string originalProject = myProject.FilePath;

            foreach (KeyValuePair <string, FileEditorTab> i in myEditorTabsPanel.MyListOfEditors)
            {
                myEditorTabsPanel.MyTabControl.TabPages.Remove(i.Value.MyTabPage);
            }
            myEditorTabsPanel.MyListOfEditors.Clear();
            treeFiles.Nodes.Clear();
            splitFileTreeEditorTabs.Panel2.Controls.Clear();
            myProject.Reset();

            while (true)
            {
                frmWelcome newWelcome = new frmWelcome(mySettings, myProject);
                newWelcome.ShowDialog();

                if (myProject.IsReady == false)
                {
                    if (myProject.Open(originalProject) == false)
                    {
                        MessageBox.Show("Error Reopening Original Project");
                    }
                    else
                    {
                        break;
                    }
                }
                else
                {
                    break;
                }
            }

            myEditorTabsPanel = new EditorTabsPanel(myProject, mySettings);
            splitFileTreeEditorTabs.Panel2.Controls.Add(myEditorTabsPanel);

            FillRecentProjects();

            RefreshFileTree();
        }
        private void mbtnOpenProject_Click(object sender, EventArgs e)
        {
            if (myEditorTabsPanel.HasChanged)
            {
                DialogResult res = MessageBox.Show("You have unsaved changes. Do you want to save?", "Unsaved Project", MessageBoxButtons.YesNoCancel);
                if (res == DialogResult.Yes)
                {
                    myEditorTabsPanel.SaveAll();
                }
                else if (res == DialogResult.Cancel)
                {
                    return;
                }
            }

            string originalProject = myProject.FilePath;

            foreach (KeyValuePair<string, FileEditorTab> i in myEditorTabsPanel.MyListOfEditors)
            {
                myEditorTabsPanel.MyTabControl.TabPages.Remove(i.Value.MyTabPage);
            }
            myEditorTabsPanel.MyListOfEditors.Clear();
            treeFiles.Nodes.Clear();
            splitFileTreeEditorTabs.Panel2.Controls.Clear();
            myProject.Reset();

            while (true)
            {
                frmWelcome newWelcome = new frmWelcome(mySettings, myProject);
                newWelcome.ShowDialog();

                if (myProject.IsReady == false)
                {
                    if (myProject.Open(originalProject) == false)
                    {
                        MessageBox.Show("Error Reopening Original Project");
                    }
                    else
                    {
                        break;
                    }
                }
                else
                {
                    break;
                }
            }

            myEditorTabsPanel = new EditorTabsPanel(myProject, mySettings);
            splitFileTreeEditorTabs.Panel2.Controls.Add(myEditorTabsPanel);

            FillRecentProjects();

            RefreshFileTree();
        }