Example #1
0
        public static void Prompt(MatchFoundEventArgs args)
        {
            var dlg = new MatchDialog
            {
                WindowStartupLocation = WindowStartupLocation.CenterScreen,

                LblMatchScore    = { Text = string.Format("{0:P0}", args.MatchAccuracy) },
                BadgeScore       = { Background = GetColor(args.MatchAccuracy) },
                ImgPoster        = { Source = new BitmapImage(new Uri(args.Movie.ImageUri)) },
                TxtMtitle        = { Text = string.Format("Titolo: {0}", args.Movie.Title) },
                TxtOriginalTitle = { Text = string.Format("Titolo Originale: {0}", args.Movie.OriginalTitle) },
                TxtYear          = { Text = string.Format("Anno: {0}", args.Movie.Year) },
                TxtDuration      = { Text = string.Format("Durata: {0:N0} mins.", args.Movie.Duration.TotalMinutes) },
                TxtFname         = { Text = string.Format("Nome File: {0}", args.LocalFile.Path.Name) },
                TxtFduration     = { Text = string.Format("Durata: {0:N0} mins.", args.LocalFile.Duration.TotalMinutes) }
            };

            var res = dlg.ShowDialog();

            if (res == true)
            {
                args.IsMatch = dlg.IsMatch;
            }
            else
            {
                args.Cancel = true;
            }
        }
Example #2
0
 private static void DoRename(MatchFoundEventArgs args, MovideoSettings settings)
 {
     if (settings.Reorganize)
     {
         var            sourcePath = args.LocalFile.Path;
         IFolderCleaner cleaner    = settings.DeleteEmptyFolders ? new FolderCleaner() : null;
         var            organizer  = new FileOrganizer(settings.TargetPath, settings.RenameTemplate, cleaner);
         organizer.Organize(sourcePath, args.Movie);
     }
 }
Example #3
0
        internal bool OnMatchFound(DicomDataSet ds)
        {
            if (MatchFound != null)
            {
                MatchFoundEventArgs e = new MatchFoundEventArgs(ds);

                MatchFound(this, e);
            }
            return(false);
        }
Example #4
0
        public int Scan(MovideoSettings settings)
        {
            var count = 0;
            var index = 0;

            var files      = _fileScanner.Scan().ToArray();
            var totalItems = files.Length;


            foreach (var file in files)
            {
                index++;
                OnProgressChanged(index, totalItems);

                var item = _analyzer.Analyze(file);
                if (!item.IsKnown)
                {
                    float accuracy;
                    var   res = TryIdentify(item, out accuracy);
                    if (res != null)
                    {
                        var args = new MatchFoundEventArgs(item, res, accuracy);
                        OnMatchFound(args);

                        if (args.Cancel)
                        {
                            break;
                        }

                        if (args.IsMatch == true)
                        {
                            DoRename(args, settings);

                            UpdateItem(item, res);
                            count++;
                        }
                    }
                }
                else
                {
                    float accuracy;
                    var   movieId = _db.GetMovieIdFor(item);
                    var   movie   = _db.GetMovie(movieId.Value);
                    item.Title = movie.Title;
                    item.Year  = movie.Year;

                    var res  = TryIdentify(item, out accuracy);
                    var args = new MatchFoundEventArgs(item, res, 1);
                    DoRename(args, settings);
                }
            }

            return(count);
        }
Example #5
0
 private void OnMatchFound(MatchFoundEventArgs e)
 {
     MatchFound?.Invoke(this, e);
 }
 private void _movideo_MatchFound(object sender, MatchFoundEventArgs args)
 {
     Task.Yield();
     RuntimeHelper.RunAsStaThread(() => { MatchDialog.Prompt(args); });
 }
Example #7
0
 void searcher_MatchFound(object sender, MatchFoundEventArgs e)
 {
     AddResultToListView(e.Match);
 }