private void buttonOK_Click(object sender, EventArgs e)
        {
            /// 완벽한 입력인 상태에서만 Draw 및 저장이 가능한다.
            if (isInputDataOK() == false)
            {
                DialogResult = DialogResult.Cancel;
                return;
            }

            if (PartType == EMKind.COIL && FaceType == EMFaceType.POLYGON)
            {
                if (false == isRectangleShapeInPopup())
                {
                    if (CSettingData.m_emLanguage == EMLanguage.Korean)
                    {
                        CNotice.noticeWarning("Coil 의 형상이 직사각형이 아닙니다.\nCoil 지정을 취소합니다.");
                    }
                    else
                    {
                        CNotice.noticeWarning("The shape of the Coil is not rectangular.\n.Cancels the Coil assignment.");
                    }

                    DialogResult = DialogResult.Cancel;
                    return;
                }
            }

            // 확인을 위해 임시 생성한다.
            CFace faceTemp = makeFaceInPopup();

            if (faceTemp == null)
            {
                CNotice.noticeWarningID("TWAP1");
                DialogResult = DialogResult.Cancel;
                return;
            }

            if (false == faceTemp.isShapeOK())
            {
                CNotice.printLogID("TWAP3");
                DialogResult = DialogResult.Cancel;
                return;
            }

            FormMain formMain = ((FormMain)this.Owner);

            if (formMain != null)
            {
                // 혹시 FEMM 의 화면이 닫힌 경우 FEMM 의 화면을 복원합니다.
                formMain.reopenFEMM();
            }

            m_strPartName = textBoxPartName.Text;

            // 문제가 없으면 정상 종료를 리턴한다.
            DialogResult = DialogResult.OK;
        }
Exemple #2
0
        private void buttonOK_Click(object sender, EventArgs e)
        {
            /// 완벽한 입력인 상태에서만 Draw 및 저장이 가능한다.
            if (isInputDataOK() == false)
            {
                return;
            }

            /// 형상 유효성 확인
            ///
            CFace face = makeFace();

            if (face == null)
            {
                CNotice.noticeWarningID("TWAP1");
                return;
            }

            if (false == face.isShapeOK())
            {
                CNotice.printTraceID("TWAP3");
                return;
            }

            m_strPartName     = textBoxPartName.Text;
            this.DialogResult = DialogResult.OK;

            FormMain formMain = ((FormMain)this.Owner);

            if (formMain == null)
            {
                CNotice.printTraceID("CNGM");
                return;
            }

            // 혹시 FEMM 의 화면이 닫힌 경우 FEMM 의 화면을 복원합니다.
            formMain.reopenFEMM();
        }
        public void buttonDraw_Click(object sender, EventArgs e)
        {
            try
            {
                /// 완벽한 입력인 상태에서만 Draw 가 가능한다.
                bool retOK = isInputDataOK();

                if (retOK == false)
                {
                    return;
                }

                /// [문제]
                ///  - Form 에서는 Parent를 사용할 수 없어 Owner 속성을 사용하지만
                ///    종종 Owner 가 null 로 넘어오는 문제가 발생한다.
                /// [해결]
                ///  - PopupShape 창을 생성하기 전에 Owner 속성을 FormMain 으로 초기화 해 두어야
                ///    확실하게 FormMain 을 얻을 수 있다.
                FormMain formMain = ((FormMain)this.Owner);

                if (formMain == null)
                {
                    CNotice.printLogID("CNGM");
                    return;
                }

                /// 형상 유효성 확인을 위해 임시로 생성한다.
                ///
                CFace faceTemp = makeFaceInPopup();

                if (faceTemp == null)
                {
                    CNotice.noticeWarningID("TWAP1");
                    return;
                }

                if (false == faceTemp.isShapeOK())
                {
                    CNotice.printLogID("TWAP3");
                    return;
                }

                CScriptFEMM femm = formMain.m_femm;

                femm.deleteAll();

                /// 1. 작업 중인 Face 를 제외하고 형상 그리기
                foreach (CDataNode node in formMain.m_design.GetNodeList)
                {
                    if (node.GetType().BaseType.Name == "CShapeParts")
                    {
                        if (node.NodeName != m_strPartName)
                        {
                            ((CShapeParts)node).Face.drawFace(femm);
                        }
                    }
                }

                // FEMM 을 최상위로 올린다.
                CProgramFEMM.showFEMM();

                // 혹시 FEMM 의 화면이 닫힌 경우 FEMM 의 화면을 복원합니다.
                formMain.reopenFEMM();

                /// 2. 작업중인 Face 형상 그리기
                faceTemp.drawFace(femm);
            }
            catch (Exception ex)
            {
                CNotice.printLog(ex.Message);
            }
        }