예제 #1
0
        private void frmMain_Load(object sender, EventArgs e)
        {
            ProgramCore.Splash.ShowDialog();

            switch (ProgramCore.CurrentProgram)
            {
                case ProgramCore.ProgramMode.HeadShop:
                case ProgramCore.ProgramMode.PrintAhead:
                case ProgramCore.ProgramMode.PrintAheadPayPal:
                    if (UserConfig.ByName("Options")["Tutorials", "Start", "1"] == "1")
                        frmTutStart.ShowDialog(this);
                    break;
            }

            ctrlRenderControl.Initialize();

            if (!string.IsNullOrEmpty(openProjectPath))
                OpenProject(openProjectPath);
            else
            {
                switch (ProgramCore.CurrentProgram)
                {
                    case ProgramCore.ProgramMode.HeadShop:
                        {
                            #region новый проект для HeadShop

                            var newProjectDlg = new frmNewProject4HeadShop(true);
                            newProjectDlg.ShowDialog(this);

                            if (newProjectDlg.dialogResult != DialogResult.OK)
                            {
                                Application.Exit();
                                return;
                            }

                            if (newProjectDlg.LoadProject && !string.IsNullOrEmpty(newProjectDlg.LoadingProject))
                                OpenProject(newProjectDlg.LoadingProject);
                            else
                                newProjectDlg.CreateProject();

                            #endregion
                        }
                        break;
                    case ProgramCore.ProgramMode.PrintAhead:
                    case ProgramCore.ProgramMode.PrintAheadPayPal:
                    case ProgramCore.ProgramMode.HeadShopOneClick:
                        {
                            #region проект для PrintAhead

                            var newProjectDlg = new frmNewProject4PrintAhead(true);
                            newProjectDlg.ShowDialog(this);

                            if (newProjectDlg.dialogResult != DialogResult.OK)
                            {
                                Application.Exit();
                                return;
                            }

                            newProjectDlg.CreateProject();

                            #endregion
                        }
                        break;
                }

            }

            if (ProgramCore.PluginMode)     // хотелка, что бы прога всегда была выше Daz'a
                TopMost = true;

            frmMaterial = new frmMaterials();
            frmMaterial.VisibleChanged += frmMaterial_VisibleChanged;

            frmAccessories = new frmAccessories();
            frmAccessories.VisibleChanged += frmAccessories_VisibleChanged;

            frmStyles = new frmStyles();
            frmStyles.VisibleChanged += frmStyles_VisibleChanged;

            frmStages = new frmStages();
            frmStages.VisibleChanged += frmStages_VisibleChanged;

            frmParts = new frmParts();
            frmParts.UpdateList();

            frmFreeHand = new frmFreeHand();

            panelCut = new PanelCut
            {
                Dock = DockStyle.Fill
            };
            panelCut.OnDelete += hairLibraryOnDelete_Click;
            panelCut.OnSave += OnSavePart_Click;
            panelCut.OnUndo += OnUndo_Click;

            panelShape = new PanelShape
            {
                Dock = DockStyle.Fill
            };
            panelShape.OnSave += OnSavePart_Click;
            panelShape.OnUndo += OnUndo_Click;

            panelAccessories = new PanelLibrary(true, true)
            {
                Dock = DockStyle.Fill
            };
            panelAccessories.OnOpenLibrary += accessoryLibraryOnOpen_Click;
            panelAccessories.OnDelete += accessoryLibraryOnDelete_Click;
            panelAccessories.OnExport += OnExport_Click;
            panelAccessories.OnSave += OnSavePart_Click;

            panelStyles = new PanelLibrary(true, true)
            {
                Dock = DockStyle.Fill
            };
            panelStyles.OnOpenLibrary += styleLibraryOnOpen_Click;
            panelStyles.OnDelete += styleLibraryOnDelete_Click;
            panelStyles.OnExport += OnExport_Click;
            panelStyles.OnSave += OnSavePart_Click;

            panelShape.OnSave += OnSavePart_Click;

            panelMaterials = new PanelLibrary(true, true)
            {
                Dock = DockStyle.Fill
            };
            panelMaterials.OnOpenLibrary += materialLibraryOnOpen_Click;
            panelMaterials.OnDelete += materialLibraryOnDelete_Click;
            panelMaterials.OnExport += OnExport_Click;
            panelMaterials.OnSave += OnSavePart_Click;
            panelShape.OnSave += OnSavePart_Click;

            panelStages = new PanelLibrary(true, false)
            {
                Dock = DockStyle.Fill
            };
            panelStages.OnOpenLibrary += stagesLibraryOnOpen_Click;
            panelStages.OnExport += OnExport_Click;
            panelStages.OnDelete += stagesLibraryOnDelete_Click;

            panelFront = new PanelHead()
            {
                Dock = DockStyle.Fill
            };
            panelFront.OnDelete += OnDeleteHeadSelectedPoints_Click;
            panelFront.OnSave += OnSaveHead_Click;
            panelFront.OnUndo += OnUndo_Click;
            panelFront.OnShapeTool += OnShapeTool_Click;

            panelFeatures = new PanelFeatures
            {
                Dock = DockStyle.Fill
            };
            panelFeatures.OnDelete += OnDeleteHeadSelectedPoints_Click;
            panelFeatures.OnSave += OnSaveHead_Click;
            panelFeatures.OnUndo += OnUndo_Click;

            if (activePanel != -1)      // это загружено из проекта. открываем ту вкладку, на которой закрыли
            {
                switch (activePanel)
                {
                    case 0:
                        panelMenuCut_Click(null, EventArgs.Empty);
                        break;
                    case 1:
                        panelMenuShape_Click(null, EventArgs.Empty);
                        break;
                    case 2:
                        panelMenuAccessories_Click(null, EventArgs.Empty);
                        break;
                    case 3:
                        panelMenuMaterials_Click(null, EventArgs.Empty);
                        break;
                    case 4:
                        panelMenuStage_Click(null, EventArgs.Empty);

                        if (ProgramCore.Project.projectCamera != null) // сохраненная позиция камеры.
                        {
                            ProgramCore.MainForm.ctrlRenderControl.camera._dy = ProgramCore.Project.projectCamera._dy;
                            ProgramCore.MainForm.ctrlRenderControl.camera.beta = ProgramCore.Project.projectCamera.beta;
                            ProgramCore.MainForm.ctrlRenderControl.camera.Scale = ProgramCore.Project.projectCamera.Scale;
                            ProgramCore.MainForm.ctrlRenderControl.camera.AfterLoadVoid();
                        }
                        break;
                    case 5:
                        panelMenuStyle_Click(null, EventArgs.Empty);
                        break;
                    case 6:
                        panelMenuFront_Click(null, EventArgs.Empty);
                        break;
                    case 7:
                        panelMenuFeatures_Click(null, EventArgs.Empty);
                        break;
                }
            }
            else
            {
                if (ProgramCore.MainForm.ctrlRenderControl.pickingController.HairMeshes.Count == 0)
                    panelMenuFront_Click(null, EventArgs.Empty); // set opened by default
                else
                    panelMenuCut_Click(null, EventArgs.Empty);  // иначе это наш проект волосач и по дефолту мы работаем с волосами, а не с формой лица.
            }

            switch (ProgramCore.CurrentProgram)
            {
                case ProgramCore.ProgramMode.PrintAhead:
                case ProgramCore.ProgramMode.PrintAheadPayPal:
                case ProgramCore.ProgramMode.HeadShopOneClick:
                    {
                        ProgramCore.MainForm.panelFront.btnAutodots_Click(null, null);
                        ProgramCore.MainForm.panelFront.btnAutodots_Click(null, null);
                    }
                    break;
                default:
                    InitRecentItems();
                    break;
            }

            switch (ProgramCore.CurrentProgram)
            {
                case ProgramCore.ProgramMode.HeadShop:
                case ProgramCore.ProgramMode.PrintAhead:
                case ProgramCore.ProgramMode.PrintAheadPayPal:
                    if (ProgramCore.Project.ManType == ManType.Custom && UserConfig.ByName("Options")["Tutorials", "CustomHeads", "1"] == "1")
                        frmTutCustomHeads.ShowDialog(this);
                    break;
            }
        }
예제 #2
0
        private void frmMain_FormClosing(object sender, FormClosingEventArgs e)
        {
            Cef.Shutdown();     // хромиум пускаем по пизде

            frmMaterial = null;
            frmAccessories = null;
            frmStyles = null;
            frmStages = null;
            e.Cancel = false;
        }