Esempio n. 1
0
        public static void start_tracking(EditorController editorController, Timer timer, bool reset)
        {
            Tracked.TrackerLastActivity = DateTime.Now;

            timer.Stop();


            if (reset)
            {
                Tracked.Reset();


                Tracked.TrackingState = Tracked.TimerState.Started;
                Tracked.TrackingTimer = new Stopwatch();
                Tracked.TrackingTimer.Stop();
                Tracked.TrackingStart  = null;
                Tracked.TrackingEnd    = null;
                Tracked.TrackingPaused = new Stopwatch();
            }


            Tracked.ActiveDocument = null;
            try
            {
                if (editorController != null && editorController.ActiveDocument != null)
                {
                    if (editorController.ActiveDocument.ActiveFile != null)
                    {
                        Tracked.ActiveDocument = editorController.ActiveDocument;

                        #region  |  initialize the global timer  |

                        Tracked.TrackingState = Tracked.TimerState.Started;
                        Tracked.TrackingTimer = new Stopwatch();
                        Tracked.TrackingTimer.Start();
                        Tracked.TrackingStart  = DateTime.Now;
                        Tracked.TrackingEnd    = null;
                        Tracked.TrackingPaused = new Stopwatch();

                        #endregion

                        var firstOrDefault = Tracked.ActiveDocument.Files.FirstOrDefault();
                        if (firstOrDefault != null && !Tracked.DictCacheDocumentItems.ContainsKey(firstOrDefault.Id.ToString()))
                        {
                            TrackedController.TrackNewDocumentEntry(Tracked.ActiveDocument);
                        }

                        var projectFile = Tracked.ActiveDocument.Files.FirstOrDefault();
                        if (projectFile != null)
                        {
                            var trackedDocuments = Tracked.DictCacheDocumentItems[projectFile.Id.ToString()];

                            if (Tracked.TrackingState == Tracked.TimerState.Started)
                            {
                                trackedDocuments.ActiveDocument.DocumentTimer.Start();
                                trackedDocuments.ActiveDocument.DatetimeOpened = Tracked.TrackingStart;
                                trackedDocuments.ActiveDocument.DatetimeClosed = null;
                            }

                            TrackedController.InitializeDocumentTracking(Tracked.ActiveDocument);

                            Application.DoEvents();
                            //_qualityMetrics.Value.
                            //**************************************
                            //initialize the quality metrics container
                            #region  |  set the default current metric group what is specified for the company  |


                            var project = Helper.GetProjectFromId(trackedDocuments.ProjectId);
                            if (project.CompanyProfileId > -1)
                            {
                                var ci = Helper.GetClientFromId(project.CompanyProfileId);
                                if (ci != null && ci.Id > -1)
                                {
                                    if (ci.MetricGroup.Id > -1)
                                    {
                                        Tracked.Settings.QualityMetricGroup = ci.MetricGroup;
                                    }
                                }
                            }

                            #endregion
                            QualitivityRevisionController.InitializeQualityMetricsData(trackedDocuments.QualityMetrics, true);

                            //**************************************

                            TrackedController.InitializeActiveSegment(trackedDocuments);
                        }
                    }
                    else
                    {
                        #region  |  set the tracking timer  |

                        Tracked.TrackingState = Tracked.TimerState.Stopped;
                        Tracked.TrackingTimer.Stop();
                        Tracked.TrackingEnd = DateTime.Now;
                        Tracked.TrackingPaused.Stop();
                        Tracked.TrackingTimer = new Stopwatch();

                        #endregion

                        MessageBox.Show(PluginResources.Unable_To_Initialize_Timer, PluginResources.Title_Qualitivity, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                Tracked.TrackingIsDirtyC0 = true;
                Tracked.TrackingIsDirtyC1 = true;
                Tracked.TrackingIsDirtyC2 = true;
            }

            timer.Start();
        }
Esempio n. 2
0
        private static void EditorController_ActiveDocumentChanged(object sender, DocumentEventArgs e)
        {
            try
            {
                Tracked.TrackerLastActivity = DateTime.Now;

                //Timer4ProjectArea.Stop();

                #region  |  stop the timer from the previous document  |

                if (Tracked.ActiveDocument != null)
                {
                    var projectFile = Tracked.ActiveDocument.Files.FirstOrDefault();
                    if (projectFile != null)
                    {
                        if (Tracked.DictCacheDocumentItems.ContainsKey(projectFile.Id.ToString()))
                        {
                            var trackedDocuments = Tracked.DictCacheDocumentItems[projectFile.Id.ToString()];

                            trackedDocuments.ActiveDocument.DocumentTimer.Stop();
                            if (trackedDocuments.ActiveSegment.CurrentSegmentSelected != null)
                            {
                                trackedDocuments.ActiveSegment.CurrentSegmentTimer.Stop();
                            }

                            TrackedController.TrackActiveChanges(trackedDocuments);
                        }
                    }
                }
                #endregion

                Tracked.ActiveDocument = null;

                if (e?.Document?.ActiveFile == null)
                {
                    return;
                }
                {
                    Tracked.ActiveDocument = e.Document;

                    var projectFile = Tracked.ActiveDocument.Files.FirstOrDefault();

                    if (Tracked.TrackingState == Tracked.TimerState.Started ||
                        Tracked.TrackingState == Tracked.TimerState.Paused)
                    {
                        if (projectFile != null)
                        {
                            if (!Tracked.DictCacheDocumentItems.ContainsKey(projectFile.Id.ToString()))
                            {
                                TrackedController.TrackNewDocumentEntry(Tracked.ActiveDocument);
                            }

                            var trackedDocuments = Tracked.DictCacheDocumentItems[projectFile.Id.ToString()];
                            if (Tracked.TrackingState == Tracked.TimerState.Started)
                            {
                                trackedDocuments.ActiveDocument.DocumentTimer.Start();
                            }

                            TrackedController.InitializeDocumentTracking(Tracked.ActiveDocument);
                            TrackedDocumentEvents.ActiveSegmentChanged(sender, null);

                            Application.DoEvents();
                            //**************************************
                            //initialize the quality metrics container

                            #region  |  set the default current metric group what is specified for the company  |

                            var project = Helper.GetProjectFromId(trackedDocuments.ProjectId);
                            if (project.CompanyProfileId > -1)
                            {
                                var ci = Helper.GetClientFromId(project.CompanyProfileId);
                                if (ci != null && ci.Id > -1)
                                {
                                    if (ci.MetricGroup.Id > -1)
                                    {
                                        Tracked.Settings.QualityMetricGroup = ci.MetricGroup;
                                    }
                                }
                            }

                            #endregion

                            QualitivityRevisionController.InitializeQualityMetricsData(trackedDocuments.QualityMetrics, false);
                        }

                        //**************************************

                        Tracked.TrackingIsDirtyC0 = true;
                        Tracked.TrackingIsDirtyC1 = true;
                        Tracked.TrackingIsDirtyC2 = true;
                    }
                    else
                    {
                        if (projectFile != null && Tracked.DictCacheDocumentItems.ContainsKey(projectFile.Id.ToString()))
                        {
                            TrackedController.InitializeDocumentTracking(Tracked.ActiveDocument);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                Console.WriteLine(ex.Message);
            }
            finally
            {
                //Timer4ProjectArea.Start();
            }
        }
Esempio n. 3
0
        private static void WarningMessageTrackingNotRunning(object sender, string projectFileId)
        {
            if (!Convert.ToBoolean(Tracked.Settings.GetTrackingProperty(@"warningMessageActivityTrackingNotRunning").Value))
            {
                return;
            }

            var ignoreWarning = false;

            if (Tracked.WarningMessageDocumentsIgnoreActivityNotRunning.ContainsKey(projectFileId))
            {
                ignoreWarning = Tracked.WarningMessageDocumentsIgnoreActivityNotRunning[projectFileId];
            }

            if (ignoreWarning || Tracked.TrackingTimer.IsRunning && Tracked.TrackingState != Tracked.TimerState.Stopped)
            {
                return;
            }

            var dr = MessageBox.Show(PluginResources.The_activity_tracker_is_not_running_ + "\r\n\r\n"
                                     + PluginResources.Note_The_current_change_will_be_ignored, Application.ProductName, MessageBoxButtons.YesNo);

            if (dr == DialogResult.Yes)
            {
                Tracked.TrackingState = Tracked.TimerState.Started;

                if (!Tracked.TrackingTimer.IsRunning)
                {
                    Tracked.TrackingTimer.Start();
                }

                if (!Tracked.DictCacheDocumentItems.ContainsKey(projectFileId))
                {
                    TrackedController.TrackNewDocumentEntry(Tracked.ActiveDocument);
                }

                var trackedDocument = Tracked.DictCacheDocumentItems[projectFileId];

                if (Tracked.TrackingState == Tracked.TimerState.Started)
                {
                    trackedDocument.ActiveDocument.DocumentTimer.Start();
                }

                TrackedController.InitializeDocumentTracking(Tracked.ActiveDocument);
                ActiveSegmentChanged(sender, null);

                Tracked.TrackingIsDirtyC0 = true;
                Tracked.TrackingIsDirtyC1 = true;
                Tracked.TrackingIsDirtyC2 = true;
            }
            else
            {
                //remember the decision from the user
                if (!Tracked.WarningMessageDocumentsIgnoreActivityNotRunning.ContainsKey(projectFileId))
                {
                    Tracked.WarningMessageDocumentsIgnoreActivityNotRunning.Add(projectFileId, true);
                }
                else
                {
                    Tracked.WarningMessageDocumentsIgnoreActivityNotRunning[projectFileId] = true;
                }
            }
        }
Esempio n. 4
0
        private static void EditorController_Opened(object sender, DocumentEventArgs e)
        {
            try
            {
                Tracked.TrackerLastActivity = DateTime.Now;

                //Timer4ProjectArea.Stop();
                Tracked.ActiveDocument = null;
                if (e?.Document?.ActiveFile == null)
                {
                    return;
                }

                Tracked.ActiveDocument = e.Document;

                //automatically start tracking if the setting active
                if (Convert.ToBoolean(Tracked.Settings.GetTrackingProperty("autoStartTrackingOnDocumentOpenEvent").Value))
                {
                    if (Tracked.TrackingState != Tracked.TimerState.Started &&
                        Tracked.TrackingState != Tracked.TimerState.Paused)
                    {
                        Tracked.TrackingState = Tracked.TimerState.Started;
                    }
                }

                if (Tracked.TrackingState != Tracked.TimerState.Started &&
                    Tracked.TrackingState != Tracked.TimerState.Paused || Tracked.ActiveDocument == null)
                {
                    return;
                }

                //TO CHECK THIS SHOULD NOT BE INITIALIZED UNLESS IT IS NECCESSARY
                if (Tracked.TrackingState == Tracked.TimerState.Started && !Tracked.TrackingTimer.IsRunning)
                {
                    Tracked.TrackingState = Tracked.TimerState.Started;
                    Tracked.TrackingTimer = new Stopwatch();
                    Tracked.TrackingTimer.Start();
                    Tracked.TrackingStart  = DateTime.Now;
                    Tracked.TrackingEnd    = null;
                    Tracked.TrackingPaused = new Stopwatch();
                }


                var projectFile = Tracked.ActiveDocument.Files.FirstOrDefault();
                if (projectFile == null)
                {
                    return;
                }

                if (!Tracked.DictCacheDocumentItems.ContainsKey(projectFile.Id.ToString()))
                {
                    TrackedController.TrackNewDocumentEntry(Tracked.ActiveDocument);
                }

                var trackedDocuments = Tracked.DictCacheDocumentItems[projectFile.Id.ToString()];
                if (Tracked.TrackingState == Tracked.TimerState.Started)
                {
                    trackedDocuments.ActiveDocument.DocumentTimer.Start();
                    trackedDocuments.ActiveDocument.DatetimeOpened = DateTime.Now;
                    trackedDocuments.ActiveDocument.DatetimeClosed = null;
                }

                TrackedController.InitializeDocumentTracking(Tracked.ActiveDocument);

                Application.DoEvents();

                //_qualityMetrics.Value.
                //**************************************
                //initialize the quality metrics container
                #region  |  set the default current metric group what is specified for the company  |

                var project = Helper.GetProjectFromId(trackedDocuments.ProjectId);
                if (project.CompanyProfileId > -1)
                {
                    var ci = Helper.GetClientFromId(project.CompanyProfileId);
                    if (ci != null && ci.Id > -1)
                    {
                        if (ci.MetricGroup.Id > -1)
                        {
                            Tracked.Settings.QualityMetricGroup = ci.MetricGroup;
                        }
                    }
                }

                #endregion

                QualitivityRevisionController.InitializeQualityMetricsData(trackedDocuments.QualityMetrics, true);

                try
                {
                    TrackedController.InitializeActiveSegment(trackedDocuments);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
                finally
                {
                    Tracked.TrackingIsDirtyC0 = true;
                    Tracked.TrackingIsDirtyC1 = true;
                    Tracked.TrackingIsDirtyC2 = true;
                }

                //ensure that the segment id is set from the QM area
                trackedDocuments.ActiveSegment.CurrentDocumentId      = trackedDocuments.ActiveDocument.Id;
                trackedDocuments.ActiveSegment.CurrentSegmentId       = Tracked.ActiveDocument.GetActiveSegmentPair().Properties.Id.Id;
                trackedDocuments.ActiveSegment.CurrentParagraphId     = Tracked.ActiveDocument.GetActiveSegmentPair().GetParagraphUnitProperties().ParagraphUnitId.Id;
                trackedDocuments.ActiveSegment.CurrentSegmentUniqueId = trackedDocuments.ActiveSegment.CurrentParagraphId + "." + trackedDocuments.ActiveSegment.CurrentSegmentId;

                QualitivityRevisionController.SetCurrentSelectedSegmentId(trackedDocuments.ActiveSegment.CurrentParagraphId, trackedDocuments.ActiveSegment.CurrentSegmentId);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                //Timer4ProjectArea.Start();
            }
        }
        public static void ContentChanged(object sender, DocumentContentEventArgs e)
        {
            Tracked.TrackerLastActivity = DateTime.Now;

            #region  |  warning message to user -> if content changes and activity tracking is turned off  |

            var firstOrDefault = Tracked.ActiveDocument.Files.FirstOrDefault();
            if (firstOrDefault != null && Convert.ToBoolean(Tracked.Settings.GetTrackingProperty(@"warningMessageActivityTrackingNotRunning").Value) && Tracked.ActiveDocument != null && Tracked.DictCacheDocumentItems.ContainsKey(firstOrDefault.Id.ToString()))
            {
                var ignoreWarning = false;
                var projectFile   = Tracked.ActiveDocument.Files.FirstOrDefault();
                if (projectFile != null && Tracked.WarningMessageDocumentsIgnoreActivityNotRunning.ContainsKey(projectFile.Id.ToString()))
                {
                    var orDefault = Tracked.ActiveDocument.Files.FirstOrDefault();
                    if (orDefault != null)
                    {
                        ignoreWarning = Tracked.WarningMessageDocumentsIgnoreActivityNotRunning[orDefault.Id.ToString()];
                    }
                }
                if (!ignoreWarning)
                {
                    var dr = MessageBox.Show(PluginResources.The_activity_tracker_is_not_running_ + "\r\n\r\n"
                                             + PluginResources.Note_The_current_change_will_be_ignored, Application.ProductName, MessageBoxButtons.YesNo);
                    if (dr == DialogResult.Yes)
                    {
                        Tracked.TrackingState = Tracked.TimerState.Started;


                        if (!Tracked.TrackingTimer.IsRunning)
                        {
                            Tracked.TrackingTimer.Start();
                        }

                        var orDefault = Tracked.ActiveDocument.Files.FirstOrDefault();
                        if (orDefault != null && !Tracked.DictCacheDocumentItems.ContainsKey(orDefault.Id.ToString()))
                        {
                            TrackedController.TrackNewDocumentEntry(Tracked.ActiveDocument);
                        }

                        var @default = Tracked.ActiveDocument.Files.FirstOrDefault();
                        if (@default != null)
                        {
                            var trackedDocuments = Tracked.DictCacheDocumentItems[@default.Id.ToString()];

                            if (Tracked.TrackingState == Tracked.TimerState.Started)
                            {
                                trackedDocuments.ActiveDocument.DocumentTimer.Start();
                            }
                        }

                        TrackedController.InitializeDocumentTracking(Tracked.ActiveDocument);
                        ActiveSegmentChanged(sender, null);

                        Tracked.TrackingIsDirtyC0 = true;
                        Tracked.TrackingIsDirtyC1 = true;
                        Tracked.TrackingIsDirtyC2 = true;
                    }
                    else
                    {
                        //remember the decision from the user
                        var orDefault = Tracked.ActiveDocument.Files.FirstOrDefault();
                        if (orDefault != null && !Tracked.WarningMessageDocumentsIgnoreActivityNotRunning.ContainsKey(orDefault.Id.ToString()))
                        {
                            var @default = Tracked.ActiveDocument.Files.FirstOrDefault();
                            if (@default != null)
                            {
                                Tracked.WarningMessageDocumentsIgnoreActivityNotRunning.Add(@default.Id.ToString(), true);
                            }
                        }
                        else
                        {
                            var file = Tracked.ActiveDocument.Files.FirstOrDefault();
                            if (file != null)
                            {
                                Tracked.WarningMessageDocumentsIgnoreActivityNotRunning[file.Id.ToString()] = true;
                            }
                        }
                    }
                }
            }
            #endregion

            var o = Tracked.ActiveDocument.Files.FirstOrDefault();
            if (o == null || Tracked.ActiveDocument == null || !Tracked.DictCacheDocumentItems.ContainsKey(o.Id.ToString()))
            {
                return;
            }
            {
                //grab the latest keys selected
                var keyStroke = (KeyStroke)Viewer.KsCache.Clone();
                keyStroke.Created = DateTime.Now;


                //get the cache document item
                var projectFile = Tracked.ActiveDocument.Files.FirstOrDefault();
                if (projectFile == null)
                {
                    return;
                }
                var trackedDocuments = Tracked.DictCacheDocumentItems[projectFile.Id.ToString()];
                trackedDocuments.ActiveSegment.CurrentSegmentContentHasChanged = true;
                keyStroke.Selection = trackedDocuments.ActiveSegment.CurrentTargetSelection;


                //reset the class
                Viewer.KsCache = new KeyStroke();

                //get the latest version of the target content
                TrackedController.ContentProcessor.ProcessSegment(e.Segments.FirstOrDefault(), true, new List <string>());
                var trackingSegmentContentTrg = string.Empty;
                var targetSectionsCurrent     = TrackedController.GetRecordContentSections(TrackedController.ContentProcessor.SegmentSections
                                                                                           , ContentSection.LanguageType.Target
                                                                                           , ref trackingSegmentContentTrg);


                //remove the revision marker for this test
                foreach (var t in targetSectionsCurrent)
                {
                    if (t.RevisionMarker == null ||
                        t.RevisionMarker.RevType != RevisionMarker.RevisionType.Delete)
                    {
                        continue;
                    }
                    t.Content        = string.Empty;
                    t.RevisionMarker = null;
                }

                #region  |  compare the content  |


                //compare at a character level to understand what was added or removed (no transposition)
                var textComparer = new TextComparer {
                    Type = TextComparer.ComparisonType.Characters
                };
                var comparisonUnits = textComparer.GetComparisonTextUnits(trackedDocuments.ActiveSegment.CurrentTargetSections, targetSectionsCurrent, false);


                #region  |  fix the selection removal from the cache  |

                // clean up the removed selection from the current placeholder; we are only looking for what is new from this holder
                if (trackedDocuments.ActiveSegment.CurrentTargetSelection.Length > 2)
                {
                    try
                    {
                        var indexCharDiffStart = 0;
                        foreach (var t in comparisonUnits)
                        {
                            if (t.Type == ComparisonUnit.ComparisonType.Identical)
                            {
                                indexCharDiffStart += t.Text.Length;
                            }
                            else
                            {
                                break;
                            }
                        }
                        if (indexCharDiffStart > trackedDocuments.ActiveSegment.CurrentTargetSelection.Length)
                        {
                            indexCharDiffStart = indexCharDiffStart - trackedDocuments.ActiveSegment.CurrentTargetSelection.Length;
                        }


                        var indexCharDiffCounter = 0;
                        foreach (var t in trackedDocuments.ActiveSegment.CurrentTargetSections)
                        {
                            indexCharDiffCounter += t.Content.Length;
                            if (indexCharDiffCounter < indexCharDiffStart)
                            {
                                continue;
                            }
                            var indexStartingPointA = indexCharDiffCounter - t.Content.Length;
                            var indexStartingPointB = indexStartingPointA;
                            if (indexCharDiffStart > indexStartingPointA)
                            {
                                indexStartingPointB = indexCharDiffStart - indexStartingPointA;
                            }

                            var indexStartingPointBBefore = t.Content.Substring(0, indexStartingPointB);
                            var indexStartingPointBAfter  = t.Content.Substring(indexStartingPointB);

                            if (indexStartingPointBAfter.IndexOf(trackedDocuments.ActiveSegment.CurrentTargetSelection, StringComparison.Ordinal) <= -1)
                            {
                                continue;
                            }
                            //remove the selection
                            var indexBefore = indexStartingPointBAfter.IndexOf(keyStroke.Selection, StringComparison.Ordinal);
                            var strBefore   = indexStartingPointBAfter.Substring(0, indexBefore);
                            var strAfter    = indexStartingPointBAfter.Substring(indexBefore + trackedDocuments.ActiveSegment.CurrentTargetSelection.Length);

                            t.Content = indexStartingPointBBefore + strBefore + strAfter;

                            //redo the comparison
                            comparisonUnits = textComparer.GetComparisonTextUnits(trackedDocuments.ActiveSegment.CurrentTargetSections, targetSectionsCurrent, false);
                            break;
                        }
                    }
                    catch
                    {
                        //ignore here for now
                    }
                }


                #endregion


                #endregion

                try
                {
                    #region  |  add the key stroke data  |

                    var textDelete = string.Empty;
                    keyStroke.Text = string.Empty;

                    foreach (var comparisonUnit in comparisonUnits)
                    {
                        switch (comparisonUnit.Type)
                        {
                        case ComparisonUnit.ComparisonType.New:
                            foreach (var trgu in comparisonUnit.Section)
                            {
                                keyStroke.Text += trgu.Content;
                            }
                            break;

                        case ComparisonUnit.ComparisonType.Removed:
                            textDelete = comparisonUnit.Section.Aggregate(textDelete, (current, trgu) => current + trgu.Content);
                            break;
                        }
                    }

                    // logical deduction
                    // needs to be revised!
                    // 1. exclude translations from providers
                    // 2. exclude suggestions from termbase? no api handler here... TODO
                    // 3. if content changed is greater than 1 char in length then check the key char
                    //  - 3.a. if the char == tab or return, then we can assume that this was derived from auto-suggest; however
                    //         this does not take into account when the user has selected the auto-suggestion via mouse selection
                    if (string.Compare(keyStroke.Key, @"[Tab]", StringComparison.OrdinalIgnoreCase) == 0 && keyStroke.Text.Length > 1)
                    {
                        keyStroke.OriginType = @"auto-suggest";
                    }

                    //if the user hit the back key then attempt to get the selection from the comparison if it is not already present
                    if (string.Compare(keyStroke.Key, @"[Back]", StringComparison.OrdinalIgnoreCase) == 0 ||
                        string.Compare(keyStroke.Key, @"[Delete]", StringComparison.OrdinalIgnoreCase) == 0 &&
                        keyStroke.Text == string.Empty &&
                        keyStroke.Selection == string.Empty &&
                        textDelete != string.Empty)
                    {
                        keyStroke.Selection = textDelete;
                    }


                    if (keyStroke.Text == string.Empty && keyStroke.Selection == string.Empty)
                    {
                        return;
                    }
                    //add the key stroke object to the list
                    trackedDocuments.ActiveSegment.CurrentTranslationKeyStokeObjectId     = keyStroke.Id;
                    trackedDocuments.ActiveSegment.CurrentTranslationKeyStrokeObjectCheck = true;
                    trackedDocuments.ActiveSegment.CurrentKeyStrokes.Add(keyStroke);

                    #endregion
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
                finally
                {
                    //update the current cause selection list
                    trackedDocuments.ActiveSegment.CurrentTargetSections = new List <ContentSection>();
                    foreach (var section in targetSectionsCurrent)
                    {
                        trackedDocuments.ActiveSegment.CurrentTargetSections.Add((ContentSection)section.Clone());
                    }

                    //remove the cach holder for current seleciton
                    trackedDocuments.ActiveSegment.CurrentTargetSelection = string.Empty;
                }
            }
        }