Example #1
0
    private void ResetSample()
    {
        m_sampleContext.GC         = m_sampleContext.CreateGC(new Gdk.Color(255, 50, 50));
        m_sampleContext.Population = null;
        var r = drawingArea.Allocation;

        m_sampleContext.DrawingArea = new Rectangle(0, 100, r.Width, r.Height - 100);
        m_sampleController.Reset();
        m_fitness = m_sampleController.CreateFitness();
        UpdateSample();
    }
Example #2
0
    private void PrepareSamples()
    {
        LoadComboBox(cmbSample, TypeHelper.GetDisplayNamesByInterface <ISampleController>());
        m_sampleController = TypeHelper.CreateInstanceByName <ISampleController>(cmbSample.ActiveText);

        // Sample context.
        var layout = new Pango.Layout(this.PangoContext);

        layout.Alignment       = Pango.Alignment.Center;
        layout.FontDescription = Pango.FontDescription.FromString("Arial 16");

        m_sampleContext = new SampleContext(drawingArea.GdkWindow, this)
        {
            Layout = layout
        };

        m_sampleContext.GC = m_sampleContext.CreateGC(new Gdk.Color(255, 50, 50));

        m_sampleController.Context       = m_sampleContext;
        m_sampleController.Reconfigured += delegate
        {
            ResetSample();
        };

        problemConfigWidgetContainer.Add(m_sampleController.CreateConfigWidget());
        problemConfigWidgetContainer.ShowAll();

        SetSampleOperatorsToComboxes();
        cmbSample.Changed += delegate
        {
            m_sampleController = TypeHelper.CreateInstanceByName <ISampleController>(cmbSample.ActiveText);
            SetSampleOperatorsToComboxes();

            m_sampleController.Context       = m_sampleContext;
            m_sampleController.Reconfigured += delegate
            {
                ResetSample();
            };

            if (problemConfigWidgetContainer.Children.Length > 0)
            {
                problemConfigWidgetContainer.Children[0].Destroy();
            }

            problemConfigWidgetContainer.Add(m_sampleController.CreateConfigWidget());
            problemConfigWidgetContainer.ShowAll();

            ResetBuffer();
            ResetSample();
        };
    }