public void Clear() { try { Items.Clear(); Duplicates.Clear(); m_lastErrorMessage = string.Empty; m_lastError = Upload506FileError.Success; FileName = null; FileContent = null; m_resultFileName = null; m_errorFileName = null; var disposable = StoredData as IDisposable; if (disposable != null) { disposable.Dispose(); } StoredData = null; if (m_errorsFile != null) { m_errorsFile.Dispose(); m_errorsFile = null; } if (m_resultFile != null) { m_resultFile.Dispose(); m_resultFile = null; } SetState(Upload506MasterState.ReadyForUpload); } catch (Exception ex) { LogError.Log("ErrorLog", ex); } }
public bool CheckForDuplicates() { if (m_state != Upload506MasterState.ReadyForCheckDuplicates) { return(false); } Duplicates.Clear(); using (var manager = DbManagerFactory.Factory.Create(EidssUserContext.Instance)) { foreach (var upload506Item in Items) { var updateItem = Upload506Duplicate.Accessor.Instance(null).SelectByItem(manager, upload506Item); if (updateItem != null) { Duplicates.Add(updateItem); } else { upload506Item.Resolution = (int)Upload506Resolution.Created; } } } if (Duplicates.Count > 0) { SetState(Upload506MasterState.HasDuplicates); return(false); } SetState(Upload506MasterState.ReadyForSave); return(true); }
private void HandleImport() { OpenFileDialog dlg = new OpenFileDialog(); dlg.Title = "Import duplicates from file"; var res = dlg.ShowDialog(); if (res == DialogResult.OK) { using (var c = new CursorHelper(this)) { using (Stream reader = new FileStream(dlg.FileName, FileMode.Open)) { XmlSerializer mySerializer = new XmlSerializer(typeof(ObservableCollection <SingleFileEntry>)); var items = (ObservableCollection <SingleFileEntry>)mySerializer.Deserialize(reader); Duplicates.Clear(); foreach (var i in items) { Duplicates.Add(i); } } } } }
private void HandleStart() { Duplicates.Clear(); bgw.RunWorkerAsync(progressBar); }