private void SelectSample(string file)
 {
     sample = new RecognitionSample(recognition.Core);
     sample.LoadSample(file);
     this.BeginInvoke(new Action(InvokeSelectSample));
     SampleC = SampleD = SampleF = null;
 }
        private void btnOpen_Click(object sender, EventArgs e)
        {
            if (openSample.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                sample = new RecognitionSample(TextureRecognition.Instance.Core);
                sample.LoadSample(openSample.FileName);
                pbSample.Image = sample.GetSampleImage();
            }

            lbTextureClasses.Items.Clear();
            var core = TextureRecognition.Instance.Core;

            for (int i = 0; i < core.TextureClassCount; ++i)
            {
                lbTextureClasses.Items.Add(core.GetTextureClass(i).Name);
            }
            lbTextureClasses.SelectedIndex = -1;
        }