コード例 #1
0
        public DocTypeMatchResult CheckIfDocMatches(ScanPages scanPages, DocType docType, bool extractDates, List<DocMatchingTextLoc> matchingTextLocs)
        {
            // Setup check info
            DocTypeMatchResult matchResult = new DocTypeMatchResult();
            matchResult.matchCertaintyPercent = 0;
            matchResult.matchResultCode = DocTypeMatchResult.MatchResultCodes.NOT_FOUND;
            if (!docType.isEnabled)
            {
                matchResult.matchResultCode = DocTypeMatchResult.MatchResultCodes.DISABLED;
                return matchResult;
            }
            if (docType.matchExpression == null)
            {
                matchResult.matchResultCode = DocTypeMatchResult.MatchResultCodes.NO_EXPR;
                return matchResult;
            }

            // Check the expression
            double matchFactorTotal = 0;
            if (MatchAgainstDocText(docType.matchExpression, scanPages, ref matchFactorTotal, matchingTextLocs))
            {
                matchResult.matchCertaintyPercent = 100;
                matchResult.matchResultCode = DocTypeMatchResult.MatchResultCodes.FOUND_MATCH;
            }
            matchResult.docTypeName = docType.docTypeName;
            matchResult.matchFactor = matchFactorTotal;

            // Extract date
            if (extractDates)
            {
                int bestDateIdx = 0;
                List<ExtractedDate> extractedDates = DocTextAndDateExtractor.ExtractDatesFromDoc(scanPages, docType.dateExpression, out bestDateIdx);
                matchResult.datesFoundInDoc = extractedDates;
                if (extractedDates.Count > 0)
                    matchResult.docDate = extractedDates[bestDateIdx].dateTime;
            }

            return matchResult;
        }
コード例 #2
0
        // Test code
        public static void AddOldDocTypes(string filename, DocTypesMatcher docTypesMatcher)
        {
            ScanMan.OldXmlRulesManager xmlRulesManager = new ScanMan.OldXmlRulesManager(filename);
            List<ScanMan.OldXmlRulesManager.DocType> oldDocTypeList = xmlRulesManager.GetAllDocTypes();

            // Handle match expression
            foreach (ScanMan.OldXmlRulesManager.DocType oldDocType in oldDocTypeList)
            {
                DocType newDocType = new DocType();
                newDocType.docTypeName = oldDocType.dtName;
                if (oldDocType.goodStrings.Count > 0)
                {
                    newDocType.matchExpression = "";
                    foreach (ScanMan.OldXmlRulesManager.CheckItem chkItem in oldDocType.goodStrings)
                    {
                        if (newDocType.matchExpression != "")
                            newDocType.matchExpression += " & ";
                        chkItem.checkString = chkItem.checkString.Replace(",", "&");
                        if (chkItem.checkString.Contains('|'))
                            newDocType.matchExpression += "( " + chkItem.checkString + " )";
                        else
                            newDocType.matchExpression += chkItem.checkString;
                    }
                }
                string notStr = "";
                if (oldDocType.badStrings.Count > 0)
                {
                    notStr = "( ";
                    foreach (ScanMan.OldXmlRulesManager.CheckItem chkItem in oldDocType.badStrings)
                    {
                        if (notStr != "( ")
                            notStr += " & ";
                        chkItem.checkString = chkItem.checkString.Replace(",", "&");
                        if (chkItem.checkString.Contains('|'))
                            notStr += "( " + chkItem.checkString + " )";
                        else
                            notStr += chkItem.checkString;
                    }
                    notStr += " )";
                }
                if (notStr != "")
                    newDocType.matchExpression = "( " + newDocType.matchExpression + " ) & !" + notStr;

                // Handle thumbnail
                if (oldDocType.thumbFileNames.Count > 0)
                {
                    string thumbFile = oldDocType.thumbFileNames[0].Replace('\\', '/');
                    if (File.Exists(thumbFile))
                    {
                        DateTime fileDateTime = File.GetCreationTime(thumbFile);
                        string uniqName = ScanDocInfo.GetUniqNameForFile(thumbFile, fileDateTime);
                        newDocType.thumbnailForDocType = uniqName;
                    }
                    else
                    {
                        newDocType.thumbnailForDocType = "";
                    }
                }
                else
                {
                    newDocType.thumbnailForDocType = "";
                }

                // Handle paths
                string newPath = oldDocType.moveTo;
                newDocType.moveFileToPath = docTypesMatcher.ComputeMinimalPath(newPath);

                // Handle rename
                string newName = oldDocType.renameTo;
                newDocType.renameFileTo = newName;

                // Update DB
                if (!docTypesMatcher.AddOrUpdateDocTypeRecInDb(newDocType))
                    logger.Info("Failed to add doc type record {0}", newDocType.docTypeName);
            }

            logger.Info("Finished loading legacy doc types");
        }
コード例 #3
0
 private DocType GetDocTypeFromForm(DocType docType)
 {
     docType.docTypeName = txtDocTypeName.Text;
     docType.isEnabled = true;
     docType.matchExpression = "";
     docType.dateExpression = "";
     docType.moveFileToPath = txtMoveTo.Text;
     string defaultRenameToContents = Properties.Settings.Default.DefaultRenameTo;
     docType.renameFileTo = txtRenameTo.Text == defaultRenameToContents ? "" : txtRenameTo.Text;
     docType.thumbnailForDocType = _curDocTypeThumbnail;
     return docType;
 }
コード例 #4
0
 public bool AddOrUpdateDocTypeRecInDb(DocType docType)
 {
     // Mongo append
     try
     {
         MongoCollection<DocType> collection_docTypes = GetDocTypesCollection();
         collection_docTypes.Save(docType);
         // Log it
         logger.Info("Added/updated doctype record for {0}", docType.docTypeName);
     }
     catch (Exception excp)
     {
         logger.Error("Cannot insert doctype rec into {0} Coll... {1} for file {2} excp {3}",
                     Properties.Settings.Default.DbNameForDocs, Properties.Settings.Default.DbCollectionForDocTypes, docType.docTypeName,
                     excp.Message);
         return false;
     }
     return true;
 }
コード例 #5
0
        private DocCompareRslt CheckIfDocMatches(ScanDocInfo sdi, DocType docTypeToMatch)
        {
            DocCompareRslt compRslt = new DocCompareRslt();
            ScanDocAllInfo scanDocAllInfo = _scanDocHandler.GetScanDocAllInfoCached(sdi.uniqName);

            // Check for a match
            DocTypeMatchResult matchResult = _docTypesMatcher.CheckIfDocMatches(scanDocAllInfo.scanPages, docTypeToMatch, false, null);
            if (matchResult.matchCertaintyPercent == 100)
            {
                compRslt.bMatches = true;
                compRslt.bMatchesButShouldnt = (scanDocAllInfo.filedDocInfo != null) && TestForMatchesButShouldnt(scanDocAllInfo.filedDocInfo.filedAs_docType, docTypeToMatch);
                compRslt.uniqName = sdi.uniqName;
                compRslt.docTypeFiled = (scanDocAllInfo.filedDocInfo == null) ? "" : scanDocAllInfo.filedDocInfo.filedAs_docType;
                compRslt.matchStatus = (scanDocAllInfo.filedDocInfo == null) ? "NOT-FILED" : (compRslt.bMatchesButShouldnt ? "MATCH-BUT-SHOULDN'T" : "OK");
                compRslt.scanPages = scanDocAllInfo.scanPages;
            }
            else
            {
                compRslt.bDoesntMatchButShould = (scanDocAllInfo.filedDocInfo != null) && (scanDocAllInfo.filedDocInfo.filedAs_docType == docTypeToMatch.docTypeName);
                if (compRslt.bDoesntMatchButShould)
                {
                    compRslt.uniqName = sdi.uniqName;
                    compRslt.docTypeFiled = (scanDocAllInfo.filedDocInfo == null) ? "" : scanDocAllInfo.filedDocInfo.filedAs_docType;
                    compRslt.matchStatus = "SHOULD-BUT-DOESN'T";
                    compRslt.scanPages = scanDocAllInfo.scanPages;
                }
            }
            compRslt.matchFactorStr = matchResult.matchCertaintyPercent.ToString() + " + " + matchResult.matchFactor.ToString() + "%";
            return compRslt;
        }
コード例 #6
0
        private void docTypeListView_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            // If changes are pending then restore the currently selected doc type (which can be null if nothing is selected)
            if (AreDocTypeChangesPendingSaveOrCancel())
            {
                docTypeListView.SelectedItem = _selectedDocType;
                return;
            }

            // Get the corresponding doc type to display
            if (e.AddedItems != null && e.AddedItems.Count > 0)
            {
                DocType selDocType = e.AddedItems[0] as DocType;
                _selectedDocType = selDocType;
                if (selDocType != null)
                {
                    SetupDocTypeForm(selDocType);
                }
            }
        }
コード例 #7
0
 private void btnNewDocType_Click(object sender, RoutedEventArgs e)
 {
     btnEditDocType.IsEnabled = false;
     btnRenameDocType.IsEnabled = false;
     btnNewDocType.IsEnabled = false;
     btnCloneDocType.IsEnabled = false;
     txtDocTypeName.IsEnabled = true;
     chkEnabledDocType.IsEnabled = true;
     txtMatchExpression.IsEnabled = true;
     txtDateLocations.IsEnabled = true;
     locRectHandler.SelectionEnable(true);
     txtMoveTo.IsEnabled = true;
     txtMoveTo.Text = "";
     btnMoveToPick.IsEnabled = true;
     txtRenameTo.IsEnabled = true;
     txtRenameTo.Text = Properties.Settings.Default.DefaultRenameTo;
     _selectedDocType = null;
     docTypeListView.SelectedItem = null;
     txtDocTypeName.Text = "";
     chkEnabledDocType.IsChecked = true;
     SetTextInRichTextBox(txtMatchExpression, "");
     SetTextInRichTextBox(txtDateLocations, "");
     btnCancelTypeChanges.IsEnabled = true;
     ShowDocTypeThumbnail("");
     btnUseCurrentDocImageAsThumbnail.IsEnabled = true;
     btnPickThumbnail.IsEnabled = true;
     btnClearThumbail.IsEnabled = true;
 }
コード例 #8
0
        private void btnSaveTypeChanges_Click(object sender, RoutedEventArgs e)
        {
            // Remember doctype name to go back to after save
            string curDocTypeName = txtDocTypeName.Text;

            // Check for renaming
            if ((_selectedDocType != null) && (_selectedDocType.docTypeName != txtDocTypeName.Text))
            {
                // Ensure the new name is unique
                DocType testDocType = _docTypesMatcher.GetDocType(txtDocTypeName.Text);
                if (testDocType != null)
                {
                    MessageBoxButton btnMessageBox = MessageBoxButton.OK;
                    MessageBoxImage icnMessageBox = MessageBoxImage.Information;
                    MessageBoxResult rsltMessageBox = MessageBox.Show("There is already a Document Type with this name", "Naming Problem", btnMessageBox, icnMessageBox);
                    return;
                }
                else
                {
                    MessageBoxButton btnMessageBox = MessageBoxButton.YesNo;
                    MessageBoxImage icnMessageBox = MessageBoxImage.Question;
                    MessageBoxResult rsltMessageBox = MessageBox.Show("Do you want to RENAME this Document Type", "Rename?", btnMessageBox, icnMessageBox);
                    if (rsltMessageBox == MessageBoxResult.No)
                        return;
                }

                // Ensure the path is valid
                bool pathContainsMacros = false;
                string testFolderToUse = _docTypesMatcher.ComputeExpandedPath(txtMoveTo.Text.Trim(), DateTime.Now, true, ref pathContainsMacros);
                if (!Directory.Exists(testFolderToUse))
                {
                    MessageBoxButton btnMessageBox = MessageBoxButton.OK;
                    MessageBoxImage icnMessageBox = MessageBoxImage.Information;
                    MessageBoxResult rsltMessageBox = MessageBox.Show("The Move-To Folder doesn't exist", "Folder Problem", btnMessageBox, icnMessageBox);
                    return;
                }

                // Change the existing record to indicate it has been renamed & make it disabled
                _selectedDocType.isEnabled = false;
                _selectedDocType.renamedTo = txtDocTypeName.Text;

                // Update the original record
                _docTypesMatcher.AddOrUpdateDocTypeRecInDb(_selectedDocType);

                // Create a new record
                DocType newDocType = GetDocTypeFromForm(new DocType());
                newDocType.previousName = _selectedDocType.docTypeName;
                _docTypesMatcher.AddOrUpdateDocTypeRecInDb(newDocType);

                // Inform scan doc handler of update
                _scanDocHandler.DocTypeAddedOrChanged(newDocType.docTypeName);
            }
            else if (_selectedDocType == null)
            {
                // Record is new or being cloned
                // Ensure the type name is unique
                string docTypeName = txtDocTypeName.Text.Trim();
                if (docTypeName == "")
                {
                    MessageBoxButton btnMessageBox = MessageBoxButton.OK;
                    MessageBoxImage icnMessageBox = MessageBoxImage.Information;
                    MessageBoxResult rsltMessageBox = MessageBox.Show("Document Type cannot be blank", "Naming Problem", btnMessageBox, icnMessageBox);
                    return;
                }

                DocType testDocType = _docTypesMatcher.GetDocType(txtDocTypeName.Text);
                if (testDocType != null)
                {
                    MessageBoxButton btnMessageBox = MessageBoxButton.OK;
                    MessageBoxImage icnMessageBox = MessageBoxImage.Information;
                    MessageBoxResult rsltMessageBox = MessageBox.Show("There is already a Document Type with this name", "Naming Problem", btnMessageBox, icnMessageBox);
                    return;
                }

                // Create the new record
                DocType newDocType = GetDocTypeFromForm(new DocType());
                _docTypesMatcher.AddOrUpdateDocTypeRecInDb(newDocType);
                _scanDocHandler.DocTypeAddedOrChanged(newDocType.docTypeName);
            }
            else
            {
                // Record is being edited
                // Get changes to record
                _selectedDocType = GetDocTypeFromForm(_selectedDocType);

                // Update the record
                _docTypesMatcher.AddOrUpdateDocTypeRecInDb(_selectedDocType);
                _scanDocHandler.DocTypeAddedOrChanged(_selectedDocType.docTypeName);
            }

            // Ensure no longer able to save/cancel
            btnCancelTypeChanges.IsEnabled = false;
            btnSaveTypeChanges.IsEnabled = false;

            // Reload the form (selecting appropriate item)
            ShowDocTypeList(curDocTypeName, null, null);
        }
コード例 #9
0
 private void SetupDocTypeForm(DocType docType)
 {
     btnEditDocType.IsEnabled = true;
     btnRenameDocType.IsEnabled = true;
     btnNewDocType.IsEnabled = true;
     btnCloneDocType.IsEnabled = true;
     btnCancelTypeChanges.IsEnabled = false;
     btnSaveTypeChanges.IsEnabled = false;
     chkEnabledDocType.IsEnabled = false;
     txtDocTypeName.IsEnabled = false;
     txtMatchExpression.IsEnabled = false;
     txtDateLocations.IsEnabled = false;
     locRectHandler.SelectionEnable(false);
     txtMoveTo.IsEnabled = false;
     btnMoveToPick.IsEnabled = false;
     txtRenameTo.IsEnabled = false;
     btnClearThumbail.IsEnabled = false;
     btnUseCurrentDocImageAsThumbnail.IsEnabled = false;
     btnPickThumbnail.IsEnabled = false;
     bInSetupDocTypeForm = true;
     if (docType == null)
     {
         txtDocTypeName.Text = "";
         chkEnabledDocType.IsChecked = false;
         SetTextInRichTextBox(txtMatchExpression, "");
         SetTextInRichTextBox(txtDateLocations, "");
         ShowDocTypeThumbnail("");
         txtMoveTo.Text = "";
         txtRenameTo.Text = Properties.Settings.Default.DefaultRenameTo;
     }
     else
     {
         txtDocTypeName.Text = docType.docTypeName;
         chkEnabledDocType.IsChecked = docType.isEnabled;
         SetTextInRichTextBox(txtMatchExpression, docType.matchExpression);
         SetTextInRichTextBox(txtDateLocations, docType.dateExpression);
         ShowDocTypeThumbnail(docType.thumbnailForDocType);
         txtMoveTo.Text = docType.moveFileToPath;
         string defaultRenameToContents = Properties.Settings.Default.DefaultRenameTo;
         txtRenameTo.Text = docType.renameFileTo == defaultRenameToContents ? "" : docType.renameFileTo;
     }
     bInSetupDocTypeForm = false;
     UpdateUIForDocTypeChanges();
 }
コード例 #10
0
        private bool TestForMatchesButShouldnt(string filedDocType, DocType docTypeToMatch)
        {
            bool matchesButShouldnt = (filedDocType != docTypeToMatch.docTypeName);

            // Iterate through some renames to check if doc has been renamed from a matching type
            int renameLevels = 0;
            string testName = docTypeToMatch.previousName;
            while (renameLevels < 3)
            {
                if (testName == "")
                    break;
                if (filedDocType == testName)
                {
                    matchesButShouldnt = false;
                    break;
                }
                DocType dt = _docTypesMatcher.GetDocType(testName);
                if (dt == null)
                    break;
                testName = dt.previousName;
                renameLevels++;
            }

            return matchesButShouldnt;
        }
コード例 #11
0
 private DocType GetDocTypeFromForm(DocType docType)
 {
     docType.docTypeName = txtDocTypeName.Text;
     docType.isEnabled = (bool)chkEnabledDocType.IsChecked;
     docType.matchExpression = GetTextFromRichTextBox(txtMatchExpression);
     docType.dateExpression = GetTextFromRichTextBox(txtDateLocations);
     docType.moveFileToPath = txtMoveTo.Text;
     string defaultRenameToContents = Properties.Settings.Default.DefaultRenameTo;
     docType.renameFileTo = txtRenameTo.Text == defaultRenameToContents ? "" : txtRenameTo.Text;
     docType.thumbnailForDocType = _curDocTypeThumbnail;
     return docType;
 }
コード例 #12
0
        private void btnProcessDoc_Click(object sender, RoutedEventArgs e)
        {
            if (_curDocScanDocInfo == null)
                return;

            // Check not already busy filing a doc
            if (_scanDocHandler.IsBusy())
                return;

            // Check a doc type has been selected
            bool quickDocTypeMode = isQuickDocTypeMode();
            if (txtDocTypeName.Text.Trim() == "")
            {
                lblStatusBarProcStatus.Content = "A document type must be selected";
                lblStatusBarProcStatus.Foreground = Brushes.Red;
                return;
            }

            // Check validity
            string rsltText = "";
            string fullPathAndFileNameForFilingTo = FormFullPathAndFileNameForFiling();
            bool rslt = _scanDocHandler.CheckOkToFileDoc(fullPathAndFileNameForFilingTo, out rsltText);
            if (!rslt)
            {
                lblStatusBarProcStatus.Content = rsltText;
                lblStatusBarProcStatus.Foreground = Brushes.Red;
                return;
            }

            // Get follow up strings
            string followUpStr = (bool)chkFollowUpB.IsChecked ? chkFollowUpB.Tag.ToString() : " ";
            followUpStr = followUpStr + ((bool)chkFollowUpA.IsChecked ? chkFollowUpA.Tag.ToString() : "");
            followUpStr = followUpStr.Trim();
            string addToCalendarStr = (bool)chkCalendarEntry.IsChecked ? "Calendar" : "";
            string flagAttachFile = (bool)chkAttachFile.IsChecked ? "Attached" : "";

            // Check if email is required but password not set
            if ((followUpStr.Trim() != "") || (addToCalendarStr.Trim() != ""))
            {
                if (txtEmailPassword.Password.Trim() == "")
                {
                    lblStatusBarProcStatus.Content = "Email password must be set";
                    lblStatusBarProcStatus.Foreground = Brushes.Red;
                    return;
                }
            }

            // Save time as filed
            _lastDocFiledAsDateTime = GetDateFromRollers();

            // Warn if date outside ranges
            if (_lastDocFiledAsDateTime > DateTime.Now)
            {
                MessageBoxButton btnMessageBox = MessageBoxButton.YesNoCancel;
                MessageBoxImage icnMessageBox = MessageBoxImage.Question;
                MessageBoxResult rsltMessageBox = MessageBox.Show("Date is in the future - is this Correct?", "Date Question", btnMessageBox, icnMessageBox);
                if ((rsltMessageBox == MessageBoxResult.Cancel) || (rsltMessageBox == MessageBoxResult.No))
                    return;
            }

            // Warn if more than X years old
            const int MAX_YEARS_OLD = 10;
            if (_lastDocFiledAsDateTime < (DateTime.Now - new TimeSpan(365 * MAX_YEARS_OLD, 0, 0, 0)))
            {
                MessageBoxButton btnMessageBox = MessageBoxButton.YesNoCancel;
                MessageBoxImage icnMessageBox = MessageBoxImage.Question;
                MessageBoxResult rsltMessageBox = MessageBox.Show("Date is several years ago - is this Correct?", "Date Question", btnMessageBox, icnMessageBox);
                if ((rsltMessageBox == MessageBoxResult.Cancel) || (rsltMessageBox == MessageBoxResult.No))
                    return;
            }

            // Process the doc
            rsltText = "";
            FiledDocInfo fdi = _curFiledDocInfo;
            if (fdi == null)
                fdi = new FiledDocInfo(_curDocScanDocInfo.uniqName);
            DateTime selectedDateTime = DateTime.MinValue;
            TimeSpan eventDuration = new TimeSpan();

            // Check for calendar entry
            if (addToCalendarStr != "")
            {
                selectedDateTime = GetEventDateAndTime((DateTime)datePickerEventDate.SelectedDate, txtEventTime.Text);
                if (selectedDateTime == DateTime.MinValue)
                {
                    lblStatusBarProcStatus.Content = "Event time/date problem";
                    lblStatusBarProcStatus.Foreground = Brushes.Red;
                    return;
                }

                eventDuration = GetEventDurationFromString((string)lblEventDuration.Text);
                if (eventDuration.TotalDays == 0)
                {
                    lblStatusBarProcStatus.Content = "Event duration problem";
                    lblStatusBarProcStatus.Foreground = Brushes.Red;
                    return;
                }
            }

            // If in quick doc type mode check that the doc type is valid
            string fileAsDocTypeName = "";
            if (quickDocTypeMode)
            {
                fileAsDocTypeName = txtDocTypeName.Text.Trim();
                // Ensure doc type contains a dash
                if (!fileAsDocTypeName.Contains("-"))
                {
                    MessageBoxButton btnMessageBox = MessageBoxButton.OK;
                    MessageBoxImage icnMessageBox = MessageBoxImage.Information;
                    MessageBoxResult rsltMessageBox = MessageBox.Show("Document Type name should be in a 'MasterType - SubType' format", "Quick DocType Problem", btnMessageBox, icnMessageBox);
                    return;
                }
                // Ensure the new name is unique
                DocType testDocType = _docTypesMatcher.GetDocType(fileAsDocTypeName);
                if (testDocType != null)
                {
                    MessageBoxButton btnMessageBox = MessageBoxButton.OK;
                    MessageBoxImage icnMessageBox = MessageBoxImage.Information;
                    MessageBoxResult rsltMessageBox = MessageBox.Show("There is already a Document Type with this name", "Quick DocType Problem", btnMessageBox, icnMessageBox);
                    return;
                }

                // Create the new doctype
                DocType docType = new DocType();
                docType.docTypeName = fileAsDocTypeName;
                docType.isEnabled = true;
                docType.matchExpression = "";
                docType.dateExpression = "";
                docType.moveFileToPath = _docTypesMatcher.ComputeMinimalPath(System.IO.Path.GetDirectoryName(fullPathAndFileNameForFilingTo));
                string defaultRenameToContents = Properties.Settings.Default.DefaultRenameTo;
                docType.renameFileTo = defaultRenameToContents;
                _docTypesMatcher.AddOrUpdateDocTypeRecInDb(docType);
                _scanDocHandler.DocTypeAddedOrChanged(docType.docTypeName);
            }
            else
            {
                fileAsDocTypeName = _curSelectedDocType.docTypeName;
            }

            // Set the filing information
            fdi.SetDocFilingInfo(fileAsDocTypeName, fullPathAndFileNameForFilingTo, GetDateFromRollers(), txtMoneySum.Text, followUpStr,
                        addToCalendarStr, txtEventName.Text, selectedDateTime, eventDuration, txtEventDesc.Text, txtEventLocn.Text, flagAttachFile);

            // Start filing the document
            lblStatusBarProcStatus.Content = "Processing ...";
            lblStatusBarProcStatus.Foreground = Brushes.Black;
            _scanDocHandler.StartProcessFilingOfDoc(SetStatusText, FilingCompleteCallback, _curDocScanDocInfo, fdi, txtEmailPassword.Password, out rsltText);

            // Save password to db
            _scanDocHandler.SetEmailPassword(txtEmailPassword.Password);
        }
コード例 #13
0
        private void ShowDocumentFirstTime(string uniqName)
        {
            // Load document info from db
            ScanDocAllInfo scanDocAllInfo = _scanDocHandler.GetScanDocAllInfoCached(uniqName);
            if ((scanDocAllInfo == null) || (scanDocAllInfo.scanDocInfo == null))
            {
                _curDocScanPages = null;
                _curDocScanDocInfo = null;
                _curFiledDocInfo = null;
                _curSelectedDocType = null;
            }
            else
            {
                _curDocScanPages = scanDocAllInfo.scanPages;
                _curDocScanDocInfo = scanDocAllInfo.scanDocInfo;
                _curFiledDocInfo = scanDocAllInfo.filedDocInfo;
            }

            // Display image of first page
            DisplayScannedDocImage(1);

            // Signal that the cur doc has changed
            _newCurDocProcessingCancel = true;
            _newCurDocSignal.Set();
        }
コード例 #14
0
        private void DocTypeChanged_DoWork(object sender, EventArgs e)
        {
            while (true)
            {
                // Wait here until a doc type change occurs
                _newDocTypeSignal.WaitOne();

                // Get the current doc type
                _curSelectedDocType = _docTypesMatcher.GetDocType(_curSelectedDocTypeName);

                // Update the UI on its thread
                this.Dispatcher.BeginInvoke((Action)delegate()
                {
                    CompleteDocTypeChange(_curSelectedDocTypeName);
                });
            }
        }
コード例 #15
0
ファイル: DocType.cs プロジェクト: robdobsn/ScanMonitor
 public void CloneForRenaming(string newName, DocType prevDocType)
 {
     docTypeName = newName;
     matchExpression = prevDocType.matchExpression;
     dateExpression = prevDocType.dateExpression;
     thumbnailForDocType = prevDocType.thumbnailForDocType;
     moveFileToPath = prevDocType.moveFileToPath;
     renameFileTo = prevDocType.renameFileTo;
     isEnabled = false;
     previousName = prevDocType.docTypeName;
     renamedTo = "";
 }