Esempio n. 1
0
        /// <summary>
        /// initializes new RemoveDupControl
        /// </summary>
        public RemoveDupControl()
        {
            InitializeComponent();

            _settings = new RemoveDupSettings();
            ResetUI();
        }
Esempio n. 2
0
        /// <summary>
        /// performs task
        /// </summary>
        /// <param name="fileName">file full path to perform task on</param>
        public void Execute(string fileName)
        {
            if (fileName.Length > 0)
            {
                RemoveDupSettings userSettings = (RemoveDupSettings)Control.Options;

                Progress(0, -1);
                LogAdded(string.Format(Properties.Resources.logFileProcessing, fileName));

                try
                {
                    TMFileManager manager = new TMFileManager(fileName);
                    manager.OnProgress += new TMFileManager.OnProgressDelegate(Progress);

                    // check password
                    if (manager.IsProtected && !IsPswValid(manager))
                    {
                        LogAdded(string.Format(Properties.Resources.logCancelledFile, fileName));
                    }
                    else
                    {
                        // settings
                        DataImportSettings setts = new DataImportSettings(userSettings.Scenario);
                        setts.CreateBackupFile = userSettings.IsBackupFiles;
                        setts.PreservePsw      = userSettings.IsPreservePsw;

                        // progress & perform task

                        manager.RemoveDuplicates(setts);

                        LogAdded(Properties.Resources.logTaskFinished);
                        LogAdded(string.Format(Properties.Resources.logTUDetails,
                                               manager.TUsCount,
                                               manager.TUsImportedCount));
                    }
                }
                catch (Exception ex)
                {
                    LogAdded(string.Format(Properties.Resources.errRemDupTaskFailed,
                                           fileName, ex.Message));
                    MessageBox.Show(string.Format(Properties.Resources.errRemDupTaskFailed,
                                                  fileName, ex.Message).Replace("\\r\\n", "\r\n"),
                                    Properties.Resources.Title);
                }

                Progress(100, -1);
            }
        }
Esempio n. 3
0
        /// <summary>
        /// updates UI with settings
        /// </summary>
        /// <param name="settings">settings to update to</param>
        public void UpdateUI(ISettings settings)
        {
            if (settings != null && settings.GetType() == _settings.GetType())
            {
                _settings             = (RemoveDupSettings)settings;
                chBackup.Checked      = _settings.IsBackupFiles;
                chPreservePsw.Checked = _settings.IsPreservePsw;
                switch (_settings.Scenario)
                {
                case ImportSettings.ImportTUProcessingMode.ProcessRawTUOnly:
                    rbPresegmentedSc.Checked = true;
                    break;

                case ImportSettings.ImportTUProcessingMode.ProcessBothTUs:
                    rbMixedSc.Checked = true;
                    break;

                default:
                    rbDefaultSc.Checked = true;
                    break;
                }
            }
        }