Beispiel #1
0
 private void RemoveItemFromQueue(object state, bool timedOut)
 {
     try
     {
         int index = (int)state;
         targetRunners.RemoveItem(targetRunners.ElementAt(index));
         doneEvents.RemoveAt(index);
     }
     catch {}
 }
Beispiel #2
0
 private void NextConf(LyapunovGenerator lyap)
 {
     if (Confs.Count > 0)
     {
         if (!lyap.Working)
         {
             if (System.IO.File.Exists(Confs[0]._path + "\\" + Confs[0]._z + "\\" + Confs[0]._x + "_" + Confs[0]._y + ".png"))
             {
                 Confs.RemoveAt(0);
                 lbl_count.Text = Confs.Count.ToString() + " pictures to generate";
                 NextConf(lyap);
             }
             else
             {
                 try
                 {
                     if (!System.IO.Directory.Exists(Confs[0]._path + "\\" + Confs[0]._z))
                     {
                         System.IO.Directory.CreateDirectory(Confs[0]._path + "\\" + Confs[0]._z);
                     }
                     System.IO.Stream str = System.IO.File.Create(Confs[0]._path + "\\" + Confs[0]._z + "\\" + Confs[0]._x + "_" + Confs[0]._y + ".png");
                     str.Dispose();
                 }
                 catch
                 {
                     Confs.RemoveAt(0);
                     lbl_count.Text = Confs.Count.ToString() + " pictures to generate";
                     NextConf(lyap);
                 }
                 lyap.Initialise(Confs[0]);
                 lyap.Generate();
                 Confs.RemoveAt(0);
                 lbl_count.Text = Confs.Count.ToString() + " pictures to generate";
             }
         }
     }
 }
Beispiel #3
0
 void RuntimeAllocator_RemoveFromQueueEvent(object sender, RemoveFromQueueEventArgs e)
 {
     try
     {
         lock (this)
         {
             int          index  = (int)e.State;
             TargetRunner runner = (TargetRunner)sender;
             //targetRunners.RemoveItem(targetRunners.ElementAt(index));
             targetRunners.RemoveItem(runner);
             doneEvents.RemoveAt(index);
         }
     }
     catch { }
 }
Beispiel #4
0
        //void endtime_Tick(object sender, EventArgs e)
        //{
        //    if (lasttimecheck != DateTime.MinValue)
        //    {
        //        int progress = Lyaps[0].LastCol - lastcolcheck;
        //        if (progress == 0) return;
        //        TimeSpan since = DateTime.Now - lasttimecheck;
        //        //System.Diagnostics.Debugger.Log(1, "", since.ToString() + " " + Lyaps[0].LastCol.ToString() + " " + Lyaps[0].EndCol.ToString() + "\n");
        //        TimeSpan togo = TimeSpan.FromMilliseconds(since.TotalMilliseconds / progress  * (Lyaps[0].EndCol - Lyaps[0].LastCol));
        //        DateTime estimated = DateTime.Now + togo;
        //        label14.Text = "Estimated Time Left: " + togo.ToString();
        //        label15.Text = "Estimated Finish Time: " + estimated.ToString();
        //    }
        //    lasttimecheck = DateTime.Now;
        //    lastcolcheck = Lyaps[0].LastCol;
        //}

        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                double XMin       = double.Parse(_x_min_txt.Text);
                double XMax       = double.Parse(_x_max_txt.Text);
                double YMin       = double.Parse(_y_min_txt.Text);
                double YMax       = double.Parse(_y_max_txt.Text);
                double ZMin       = double.Parse(_z_min_txt.Text);
                double ZMax       = double.Parse(_z_max_txt.Text);
                int    Iterations = int.Parse(_iterations_txt.Text);
                int    PicHeight  = int.Parse(textBox2.Text);
                int    PicWidth   = int.Parse(textBox3.Text);
                int    PicDepth   = int.Parse(textBox7.Text);
                if (!checkBox1.Checked)
                {
                    PicDepth = 1;
                }
                double startInitX = double.Parse(textBox4.Text);
                double endInitX   = double.Parse(textBox5.Text);
                double stepInitX  = double.Parse(textBox6.Text);
                char[] Pattern    = _pattern_txt.Text.ToCharArray();

                progressBar1.Maximum = PicWidth;

                progressBar2.Maximum = PicDepth;

                if (stepInitX <= 0)
                {
                    stepInitX = 0.1;
                }

                for (double j = startInitX; j <= endInitX; j += stepInitX)
                {
                    Confs.Add(new Configuration(XMin, XMax, YMin, YMax, ZMin, ZMax, Pattern, Iterations, j, PicWidth, PicHeight, PicDepth));
                }
                if (Confs.Count > 1)
                {
                    progressBar3.Maximum = Confs.Count;
                    progressBar3.Visible = true;
                }
                else
                {
                    progressBar3.Visible = false;
                }
                StartTime = DateTime.Now;
                for (int k = 0; k < Lyaps.Count; k++)
                {
                    if (Confs.Count > 0)
                    {
                        Lyaps[k].Initialise(Confs[0]);
                        Lyaps[k].Generate();
                        LastCol = DateTime.Now;
                        LastPic = DateTime.Now;
                        Confs.RemoveAt(0);
                    }
                    else
                    {
                        break;
                    }
                    label16.Text = "Generating...";
                }
            }
            catch
            {
                MessageBox.Show("Please review your settings there seems to be an error.");
            }
        }