Exemplo n.º 1
0
 void SetEqualsMark(Label label, string sourceValue, string candidateValue)
 {
     if (MappingWorker.IsEitherNull(sourceValue, candidateValue))
     {
         label.Text      = "-";
         label.ForeColor = SystemColors.ControlText;
     }
     else
     {
         if (MappingWorker.StringEquality(sourceValue, candidateValue))
         {
             label.Text      = "✓";
             label.ForeColor = Color.Green;
         }
         else
         {
             label.Text      = "✗";
             label.ForeColor = Color.Red;
         }
     }
 }
Exemplo n.º 2
0
        // Save all form controls to variables for the Main form to access
        private void btnStart_Click(object sender, EventArgs e)
        {
            // Ensure that other mapping or writing progress aren't already under way
            if (MappingWorker.InProgress || TagWriterWorker.InProgress)
            {
                Debug.LogError("Cannot start mapping while another operation is in progress", true);
                return;
            }

            if (mode == MappingMode.Mapped && (string.IsNullOrEmpty(txtLibraryPath.Text) || !Directory.Exists(txtLibraryPath.Text)))
            {
                MessageBox.Show("Path empty or invalid! Please enter a valid directory path!", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            else if (mode == MappingMode.Lookup && (string.IsNullOrEmpty(txtLibraryPath.Text) || !File.Exists(txtLibraryPath.Text)))
            {
                MessageBox.Show("Path empty or invalid! Please enter a valid file path!", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            var  entryFilter    = (EntryFilter)cbFilter.SelectedValue;
            bool entryFilterNot = chkEntryFilterNot.Checked;

            // Get subset of entries based on the selectionMode (instead of individually discounting every entry that doesn't meet criteria)
            var rows = mainForm.GetRows(entryFilter, entryFilterNot);

            var args = new MappingWorker.MatchingWorkerArgs
            {
                mappingMode = this.mode,
                filter      = entryFilter,
                libraryPath = txtLibraryPath.Text,
                rows        = rows
            };

            // Call MatchEntries from here, then close form
            MappingWorker.StartWorker(args);

            this.DialogResult = DialogResult.OK;
            this.Close();
        }
Exemplo n.º 3
0
 public void Initialize()
 {
     MappingConfiguration.Configure();
     _mapper = new MappingWorker(AutoMapper.Mapper.Engine);
 }
Exemplo n.º 4
0
 public MappingManager(DataContext context)
 {
     _context       = context ?? throw new Exception("The context cannot be null.");
     _mappingWorker = new MappingWorker(_context);
 }