Example #1
0
        public void CommitBatchModifyDocument(string description, DataGridViewPasteHandler.BatchModifyInfo batchModifyInfo)
        {
            if (null == _batchChangesOriginalDocument)
            {
                throw new InvalidOperationException();
            }
            string message = Resources.DataGridViewPasteHandler_EndDeferSettingsChangesOnDocument_Updating_settings;

            if (SkylineWindow != null)
            {
                SkylineWindow.ModifyDocument(description, document =>
                {
                    VerifyDocumentCurrent(_batchChangesOriginalDocument, document);
                    using (var longWaitDlg = new LongWaitDlg
                    {
                        Message = message
                    })
                    {
                        SrmDocument newDocument = document;
                        longWaitDlg.PerformWork(SkylineWindow, 1000, progressMonitor =>
                        {
                            var srmSettingsChangeMonitor = new SrmSettingsChangeMonitor(progressMonitor,
                                                                                        message);
                            newDocument = _document.EndDeferSettingsChanges(_batchChangesOriginalDocument,
                                                                            srmSettingsChangeMonitor);
                        });
                        return(newDocument);
                    }
                }, GetAuditLogFunction(batchModifyInfo));
            }
            else
            {
                VerifyDocumentCurrent(_batchChangesOriginalDocument, _documentContainer.Document);
                if (!_documentContainer.SetDocument(
                        _document.EndDeferSettingsChanges(_batchChangesOriginalDocument, null),
                        _batchChangesOriginalDocument))
                {
                    throw new InvalidOperationException(Resources
                                                        .SkylineDataSchema_VerifyDocumentCurrent_The_document_was_modified_in_the_middle_of_the_operation_);
                }
            }
            _batchChangesOriginalDocument = null;
            _batchEditDescriptions        = null;
            DocumentChangedEventHandler(_documentContainer, new DocumentChangedEventArgs(_document));
        }
        protected bool CompleteProcessing(IDocumentContainer container, SrmDocument docNew, SrmDocument docOriginal)
        {
            lock (_processing)
            {
                if (!container.SetDocument(docNew, docOriginal))
                {
                    return(false);
                }

                EndProcessing(docOriginal);
            }
            return(true);
        }
Example #3
0
        protected bool CompleteProcessing(IDocumentContainer container, SrmDocument docNew, SrmDocument docOriginal)
        {
            // Has docOriginal already been removed from the processing list?  If so, don't attempt an update.
            // Unless the brackground loader handles its own thread safety, in which case the processing list
            // is not used.
            if (IsMultiThreadAware || IsProcessing(docOriginal))
            {
                if (!container.SetDocument(docNew, docOriginal))
                {
                    return(false);
                }
            }

            EndProcessing(docOriginal);
            return(true);
        }
Example #4
0
        protected bool CompleteProcessing(IDocumentContainer container, SrmDocument docNew, SrmDocument docOriginal)
        {
            lock (_processing)
            {
                if (!container.SetDocument(docNew, docOriginal))
                    return false;

                EndProcessing(docOriginal);
            }
            return true;
        }