private void ShowDuplicateAction_CustomizePopupWindowParams(object sender, CustomizePopupWindowParamsEventArgs e)
        {
            Dictionary <string, int> dictionary = new Dictionary <string, int>();

            foreach (Book book in View.CollectionSource.List)
            {
                if (!string.IsNullOrWhiteSpace(book.Title))
                {
                    if (dictionary.ContainsKey(book.Title))
                    {
                        dictionary[book.Title]++;
                    }
                    else
                    {
                        dictionary.Add(book.Title, 1);
                    }
                }
            }

            DuplicateList duplicateList = new DuplicateList();
            int           duplicateId   = 0;

            foreach (KeyValuePair <string, int> item in dictionary)
            {
                if (item.Value > 1)
                {
                    duplicateList.Duplicates.Add
                    (
                        new Duplicate()
                    {
                        Id    = duplicateId,
                        Name  = item.Key,
                        Count = item.Value
                    }
                    );

                    duplicateId++;
                }
            }

            DetailView detailView = Application.CreateDetailView(Application.CreateObjectSpace(), duplicateList);

            detailView.ViewEditMode = ViewEditMode.Edit;

            e.View = detailView;
            e.DialogController.SaveOnAccept = false;
            e.DialogController.CancelAction.Active["NothingToCancel"] = false;
        }
示例#2
0
        private void EndProcessFiles()
        {
            lbDuplicateSets.Items.Clear();
            foreach (string hash in _crawler.Duplicates.Keys)
            {
                DuplicateList dupeList = new DuplicateList(tbSearchPath.Text);
                foreach (var duplicateFile in _crawler.Duplicates[hash])
                    dupeList.AddFile(duplicateFile);
                lbDuplicateSets.Items.Add(dupeList);
            }

            if (lbDuplicateSets.Items.Count > 0)
                lbDuplicateSets.SelectedIndex = 0;

            btnSearch.Enabled = true;
            tbSearchPath.Enabled = true;
            btnBrowse.Enabled = true;

            progressBar1.Visible = false;
            btnDelete.Visible = true;
        }