Exemplo n.º 1
0
        private async void RunSearch()
        {
            if (m_cl.Config.Query == null)
            {
                MessageBox.Show("Specify an image", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);

                return;
            }

            // if (m_cl.IsComplete) {
            //  clear_fields();
            //  reset1();
            // }

            var   r = m_cl.RunSearchAsync();
            await r;

            Alert();
            Debug.WriteLine($"Finding best");

            var sw   = Stopwatch.StartNew();
            var best = await Task.Run((() => m_cl.FindDirectResult()));

            sw.Stop();
            Debug.WriteLine($"{sw.Elapsed.TotalSeconds}");

            if (best is not null)
            {
                previewPictureBox.Image = ImageHelper.GetImage(best.Url?.ToString());
            }
        }