This class consists of two watches for view print and document print processes. Each watch will be used to calculate the cost time of print individual view and total views..
        /// <summary>
        /// Start to dump current date/time and start watch count.
        /// </summary>
        /// <param name="curDoc">Current document.</param>
        /// <param name="isViewWatch">Indicates if current watch is for view or document.
        /// True means we need to start watch for ViewPrint, else start watch for DocumentPrint.</param>
        private void StartNewWatch(Document curDoc, bool isViewWatch)
        {
            // Just dump current date time to printlog.txt
            DumpDateTime("Start");
            //
            // Start new watch for view print or document print
            EventsWatches watches;
            bool          result = m_docEventsWatches.TryGetValue(curDoc.GetHashCode(), out watches);

            if (!result || null == watches)
            {
                watches = new EventsWatches();
                m_docEventsWatches.Add(curDoc.GetHashCode(), watches);
            }
            //
            // Start watch for ViewPrint and DocumentPrint
            if (isViewWatch)
            {
                watches.ViewPrintWatch = Stopwatch.StartNew();
            }
            else
            {
                watches.DocPrintWatch = Stopwatch.StartNew();
            }
        }
Exemple #2
0
 /// <summary>
 /// Start to dump current date/time and start watch count.
 /// </summary>
 /// <param name="curDoc">Current document.</param>
 /// <param name="isViewWatch">Indicates if current watch is for view or document.
 /// True means we need to start watch for ViewPrint, else start watch for DocumentPrint.</param>
 private void StartNewWatch(Document curDoc, bool isViewWatch)
 {
     // Just dump current date time to printlog.txt
     DumpDateTime("Start");
     //
     // Start new watch for view print or document print
     EventsWatches watches;
     bool result = m_docEventsWatches.TryGetValue(curDoc.GetHashCode(), out watches);
     if (!result || null == watches)
     {
         watches = new EventsWatches();
         m_docEventsWatches.Add(curDoc.GetHashCode(), watches);
     }
     //
     // Start watch for ViewPrint and DocumentPrint
     if (isViewWatch)
     {
         watches.ViewPrintWatch = Stopwatch.StartNew();
     }
     else
     {
         watches.DocPrintWatch = Stopwatch.StartNew();
     }
 }