Print Suite .Net • Calls Sequence
Print Suite .Net uses 3-level call system in all print providers.
public event SomethingEventHandler Something;
public void CallSomething(SomethingArgs args)
{
if (Something != null) Something(args);
else OnSomething(args);
}
public virtual void OnSomething(SomethingArgs args)
{
// functionality here
}
The Call* method is used for external calling from DocumentDesigner or ProviderToDocument components. It's not virtual. There is another On* method, it's virtual and it can be overriden in derived classes to implement new functionality. In the Call* method we check the appropriate event, and if it is assigned, we call it instead of On* method, so we can change everything in behavior of any provider components by events with easy. Of course, we can call On* in the event handler code for accessing base functionality. This allows us implementing our special functionality both in the application code by event handlers and in the new derived components by code in overriden On* methods.
Let's create some simple document with filled Page and Content lists to demonstrate the calls sequestion.
Let's stay PageProvider empty (we don't need to have any real content to demonstrate calls related to the Page list) and let's print some filled rounded rectangles with numbers inside by the content providers. 3 rectangles in the first contentProvider1 and 2 ones in the second contentProvider2. Numbers inside show SectionProvider and ProviderContent indices. We have the following 3 pages printout:
- For this document we have the following calls sequention for this document (yellow for Page and green for Content):
-
BeginPrintDocument (printProvider1)
BeginPrintDocument (printProvider2)
BeginPrintDocument (contentProvider1)
BeginPrintDocument (contentProvider2)
QueryPageSettings (contentProvider1)
BeginPrintProvider (printProvider1)
BeginPrintContent (printProvider1)
PrintContent (printProvider1)
EndPrintContent (printProvider1)
EndPrintProvider (printProvider1)
BeginPrintProvider (printProvider2)
BeginPrintContent (printProvider2)
PrintContent (printProvider2)
EndPrintContent (printProvider2)
EndPrintProvider (printProvider2)
BeginPrintPage (contentProvider1)
BeginPrintProvider (contentProvider1)
BeginPrintContent (contentProvider1)
PrintContent (contentProvider1)
EndPrintContent (contentProvider1)
BeginPrintContent (contentProvider1)
PrintContent (contentProvider1)
EndPrintContent (contentProvider1)
EndPrintPage (contentProvider1)
QueryPageSettings (contentProvider1)
BeginPrintProvider (printProvider1)
BeginPrintContent (printProvider1)
PrintContent (printProvider1)
EndPrintContent (printProvider1)
EndPrintProvider (printProvider1)
BeginPrintProvider (printProvider2)
BeginPrintContent (printProvider2)
PrintContent (printProvider2)
EndPrintContent (printProvider2)
EndPrintProvider (printProvider2)
BeginPrintPage (contentProvider1)
BeginPrintContent (contentProvider1)
PrintContent (contentProvider1)
EndPrintContent (contentProvider1)
EndPrintProvider (contentProvider1)
BeginPrintProvider (contentProvider2)
BeginPrintContent (contentProvider2)
PrintContent (contentProvider2)
EndPrintContent (contentProvider2)
EndPrintPage (contentProvider2)
QueryPageSettings (contentProvider2)
BeginPrintProvider (printProvider1)
BeginPrintContent (printProvider1)
PrintContent (printProvider1)
EndPrintContent (printProvider1)
EndPrintProvider (printProvider1)
BeginPrintProvider (printProvider2)
BeginPrintContent (printProvider2)
PrintContent (printProvider2)
EndPrintContent (printProvider2)
EndPrintProvider (printProvider2)
BeginPrintPage (contentProvider2)
BeginPrintContent (contentProvider2)
PrintContent (contentProvider2)
EndPrintContent (contentProvider2)
EndPrintProvider (contentProvider2)
EndPrintPage (contentProvider2)
EndPrintDocument (printProvider1)
EndPrintDocument (printProvider2)
EndPrintDocument (contentProvider1)
EndPrintDocument (contentProvider2)
Interesting facts:
- BeginPrintPage and EndPrinPage are called only for providers from Content list, because all the providers from the Page list are applied to each page in the section, so if the BeginPrintProvider of provider from Page list is called, this means that new page was started, and EndPrintProvider means, that this provider finished its work on this page, but the page is still on progress.
- QueryPageSettings is called only from content provider and only once for each page - for the current content provider.
- You don't need to know the calls sequention, because DocumentDesigner does everything itself, all you need is creating your content or just using ready-to-use provider components. Information on this page is for information only. :)
|