public frmCrossSectionComment(frmCrossSectionResult frmcrResult, int typeCode, double crossSection, int ProductType)
        {
            Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;

            ed.WriteMessage("\nchecking.....\n");
            if (!Atend.Global.Acad.DrawEquips.Dicision.IsHere())
            {
                if (!Atend.Global.Acad.DrawEquips.Dicision.IsThere())
                {
                    //System.Diagnostics.Process[] prs = System.Diagnostics.Process.GetProcesses();
                    //foreach (System.Diagnostics.Process pr in prs)
                    //{
                    //    if (pr.ProcessName == "acad")
                    //    {
                    //        pr.CloseMainWindow();
                    //    }
                    //}
                    Atend.Global.Acad.Notification notification = new Atend.Global.Acad.Notification();
                    notification.Title = "شناسایی قفل";
                    notification.Msg   = "لطفا وضعیت قفل را بررسی نمایید ";
                    notification.infoCenterBalloon();

                    ForceToClose = true;
                }
            }


            InitializeComponent();
            frmCrossResult = frmcrResult;
            _typeCode      = typeCode;
            _crossSection  = crossSection;
            _ProductType   = ProductType;
        }
Beispiel #2
0
        private void Calculation()
        {
            if (Validation())
            {
                //ed.WriteMessage("GO To Calc\n");
                System.Data.DataTable dtCondCrossSection = Atend.Base.Equipment.EConductor.SelectByType(cboMaterial.SelectedIndex);

                dtCondCrossSection.Columns.Add("ProductType");
                foreach (DataRow dr in dtCondCrossSection.Rows)
                {
                    dr["ProductType"] = Convert.ToInt32(Atend.Control.Enum.ProductType.Conductor);
                }

                System.Data.DataTable dtSelfKeeper = Atend.Base.Equipment.ESelfKeeper.SelectByType(CboMaterialCalamp.SelectedIndex + 1);
                dtSelfKeeper.Columns.Add("ProductType");
                foreach (DataRow dr in dtSelfKeeper.Rows)
                {
                    dr["ProductType"] = Convert.ToInt32(Atend.Control.Enum.ProductType.SelfKeeper);
                }
                //ed.WriteMessage("dtCondCrossSection.Rows={0}\n", dtCondCrossSection.Rows[0]["ProductType"].ToString());


                if (CanDoCalculate)
                {
                    //ed.WriteMessage("I Am In The IF\n");
                    //if (chkInfo.Checked)
                    //{
                    //    R = Convert.ToDouble(txtR.Text);
                    //    X = Convert.ToDouble(txtX.Text);
                    //    TevVolt = Convert.ToDouble(txtVoltTev.Text);
                    //}
                    //else
                    //{
                    //    R = 0;
                    //    X = 0;
                    //    TevVolt = 0;
                    //}
                    this.Cursor = Cursors.WaitCursor;

                    ElecCrossSection elec = new ElecCrossSection();
                    if (ElecCrossSection.CrossSectionErr.NoError == elec.FindBestCrossSection(dtCondCrossSection, dtSelfKeeper, Nodeobj, Convert.ToDouble(txtVolt.Text), Convert.ToDouble(txtVoltTev.Text), new Complex(Convert.ToDouble(txtR.Text), Convert.ToDouble(txtX.Text)), Convert.ToDouble(txtMaxDropVolt.Text), Convert.ToDouble(txtMaxDropPower.Text), Convert.ToDouble(txtLoadPercent.Text)))
                    {
                        frmCrossSectionResult CrossSectionResult = new frmCrossSectionResult((System.Data.DataTable)elec.dtBranches, (System.Data.DataTable)elec.dtNodes, cboMaterial.SelectedIndex);
                        Autodesk.AutoCAD.ApplicationServices.Application.ShowModalDialog(CrossSectionResult);
                    }
                    else
                    {
                        MessageBox.Show("عملیات به دلیل نبودن سیم با سطح مقطع بالاتر متوقف شد", "خطا");
                    }
                    this.Cursor = Cursors.Default;
                }
            }
        }