Exemplo n.º 1
0
        private void GraphDoubleClick(object sender, MouseEventArgs e)
        {
            object graphObject;
            int    index;

            graphControl1.ZedControl.GraphPane.FindNearestObject(new PointF(e.X, e.Y),
                                                                 graphControl1.ZedControl.CreateGraphics(),
                                                                 out graphObject, out index);
            if (graphObject != null)
            {
                object tag = null;
                if (graphObject is TextObj)
                {
                    tag = (graphObject as TextObj).Tag;
                }
                else if (graphObject is EllipseObj)
                {
                    tag = (graphObject as EllipseObj).Tag;
                }

                if (tag != null)
                {
                    IntTripple tripple = (tag as TagData).Tripple;
                    if (tripple != null)
                    {
                        RunContinuationForTripple(tripple);
                    }
                }
            }
        }
Exemplo n.º 2
0
        private void RunContinuationForTripple(IntTripple tripple)
        {
            try
            {
                if (SBML == null || SBML.Length == 0)
                {
                    return;
                }

                string fort8 = AutoResult.NewFort8; //.Replace(" 7 ", " 12 ");
                //string fort7 = AutoResult.NewFort7;

                ResetAuto();

                setupControl1.RunContinuation = true;
                setupControl1.Label           = tripple.Value1;

                string originalConfig = setupControl1.CurrentConfig.ToInputString();

                //setupControl1.CurrentConfig.IPS = 2;
                setupControl1.CurrentConfig.IRS = tripple.Value1;
                //setupControl1.CurrentConfig.ILP = 1;

                setupControl1.CurrentConfig.NICP = 2;
                setupControl1.CurrentConfig.ICP.Clear();
                setupControl1.CurrentConfig.ICP.Add(0);
                setupControl1.CurrentConfig.ICP.Add(10);

                //setupControl1.CurrentConfig.NCOL = 4;
                //setupControl1.CurrentConfig.IAD = 3;
                //setupControl1.CurrentConfig.ISP = 1;
                //setupControl1.CurrentConfig.ISW = 1;

                setupControl1.CurrentConfig.MXBF = 10;

                setupControl1.CurrentConfig.NTHL = 1;
                setupControl1.CurrentConfig.THL.Add(new IntDoublePair(10, 0));

                txtConfig.Text = setupControl1.Configuration;

                SetupAuto();

                AutoInterface.setFort2File(txtConfig.Text, txtConfig.Text.Length);

                AutoInterface.setFort3File(fort8, fort8.Length);

                if (setupControl1.CurrentConfig.IPS != 1)
                {
                    if (
                        MessageBox.Show(
                            "Currently only IPS = 1 is supported, any other value will make the library unstable. It is recommendet that you Quit (yes).",
                            "Unsupported Values", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        return;
                    }
                }


                AutoInterface.CallAuto();
                string lastMessage = AutoInterface.GetLastMessage();

                //fort7 = fort7 + AutoResult.NewFort7;
                //AutoInterface.setFort7File(fort7, fort7.Length);

                fort8 = fort8 + AutoResult.NewFort8;
                AutoInterface.setFort8File(fort8, fort8.Length);

                CurrentResult  = new AutoResult();
                txtResult.Text = CurrentResult.Fort7;

                RemoveWartermark();
                if (CurrentResult.ErrorOccured && CurrentResult.NumPoints < 10)
                {
                    AddWaterMark("Auto\ndid not\nreturn\nresults.");
                }
                else if (CurrentResult.NumPoints < 10)
                {
                    AddWaterMark("Not\nenough\npoints\nreturned.");
                }


                setupControl1.CurrentConfig = AutoInputConstants.FromContent(originalConfig);


                if (!string.IsNullOrEmpty(lastMessage))
                {
                    RemoveWartermark();
                    AddWaterMark(lastMessage);
                    return;
                }


                PlotResults(CurrentResult);


                if (setupControl1.ReloadAfterRun)
                {
                    try
                    {
                        //Simulator.loadSBML(SBML);
                        cmdSendToAuto_Click(this, EventArgs.Empty);
                    }
                    catch (Exception)
                    {
                        //
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "An Error occured while running Auto", MessageBoxButtons.OK,
                                MessageBoxIcon.Error);
            }
        }