private void DisplayResults()
        {
            listSearchConfigs = new List <SearchConfig>();
            var sw = new StreamWriter($"results-{DateTime.UtcNow.Ticks}.txt");

            for (int i = 0; i < Program.imageWarehouse.Preprocessors.Count; i++)
            {
                for (int j = 0; j < Program.imageWarehouse.RankingModels.Count; j++)
                {
                    var conf = new SearchConfig(i, j);
                    listSearchConfigs.Add(conf);
                    sw.WriteLine(conf.ToString());
                }
            }

            sw.Close();
            listSearchConfigs.Sort((sc1, sc2) => sc1.AverageRank < sc2.AverageRank ? -1 : 1);


            lbResults.Invoke((MethodInvoker)(() => {
                lbResults.Items.Clear();

                foreach (var sc in listSearchConfigs)
                {
                    lbResults.Items.Add(sc);
                }
            }));
        }
        private void lbResults_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (lbResults.SelectedItem == null)
            {
                return;
            }

            chartHistogram.Series.Clear();

            chartHistogram.ChartAreas[0].AxisX.Minimum  = 0;
            chartHistogram.ChartAreas[0].AxisX.Maximum  = Program.imageWarehouse.SourceFiles.Length;
            chartHistogram.ChartAreas[0].AxisX.Interval = Program.imageWarehouse.SourceFiles.Length / 10;

            SearchConfig selectedSearchConfig = (SearchConfig)lbResults.SelectedItem;

            string preprocName = Program.imageWarehouse.Preprocessors[selectedSearchConfig.PreprocessorIndex].Name;

            var serie = chartHistogram.Series.Add(selectedSearchConfig.ToString());

            serie.ChartType = SeriesChartType.Column;
            serie.Color     = Color.Brown;

            int totalRanks   = 0;
            int totalQueries = 0;

            for (int i = 0; i < Program.imageWarehouse.SourceFiles.Length; i++)
            {
                int val = Program.imageWarehouse.Histograms[selectedSearchConfig.PreprocessorIndex, selectedSearchConfig.RankingModelIndex, i];
                serie.Points.AddXY(i, val);

                totalQueries += val;
                totalRanks   += i * val;
            }

            lAvgRank.Text = ((double)totalRanks / totalQueries).ToString();
        }
Example #3
0
        public async Task Load()
        {
            var gList = await ExGalleryList.DownloadGalleryListAsync(0, $"http://exhentai.org/?f_search={ WebUtility.UrlEncode(Key)}&{SearchConfig.ToString()}");

            //(this.GalleryList as ImageWallRows<ExGallery>).RowWidth = BrowseWall.ActualWidth - BrowseWall.Padding.Left - BrowseWall.Padding.Right;
            //(this.GalleryList as ImageWallRows<ExGallery>).RowHeight = BrowseWall.ActualWidth > 500 ? 300 : 150;
            var s = new ImageWallRows <ExGallery>();

            s.ItemsSource    = new FilteredCollection <ExGallery, ExGalleryList>(gList, this.GalleryFilter);
            this.GalleryList = s;
        }
Example #4
0
        public async Task Load()
        {
            var gList = await ExGalleryList.DownloadGalleryListAsync(0, $"https://exhentai.org/?f_search={ WebUtility.UrlEncode(Key)}&{SearchConfig.ToString()}");

            var gList2 = new FilteredCollection <ExGallery, ExGalleryList>(gList, this.GalleryFilter);

            SearchGalleryList = gList2;

            // Add the search record to DB if user defined keywords
            if (!String.IsNullOrWhiteSpace(Key))
            {
                try
                {
                    using (var db = new AppDbContext())
                    {
                        db.ExSearchRecords.Add(ExSearchRecord.Create(Key));
                        db.SaveChanges();
                    }
                }
                catch (Exception ex)
                {
                    await new MessageDialog(ex.Message, "Fail to save search record").ShowAsync();
                }
            }
        }