Пример #1
0
    private void PrepareSamples()
    {
        LoadComboBox(cmbSample, SampleService.GetSampleControllerNames());
        m_sampleController = SampleService.CreateSampleControllerByName(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();

        cmbSample.Changed += delegate
        {
            m_sampleController               = SampleService.CreateSampleControllerByName(cmbSample.ActiveText);
            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();
        };
    }