How to identify the number of pi electrons in a conjugated system to calculate the HOMO-LUMO gap with the particle in the box approach?
In a very basic first order approximation you can treat dyes with an extended conjugated &pi;-system with the one-dimensional particle in the box approach. I simplified your system and calculated it at the DF-BP86/def2-SVP level of theory. The length of the box is about $L=1.20~\mathrm{nm}$, the following graphic shows it in &Aring;ngstr&ouml;m.



With that there are a number of problems associated. Counting the number of electrons in the &pi;-system should not be among them. Just assume that all non-hydrogen atoms are sp² hybridised. Then count the electrons that occupy &pi;/p-type orbitals. Here is an image of the lowest occupied &pi;-type orbital of that molecule; you can see that the box stretches over the whole molecule. The thumbnail next to it gives you all occupied &pi;-type orbitals and the lowest unoccupied molecular orbital.

&nbsp;



   In this example each phenyl ring contributes six &pi; electrons (12), two sulfurs contribute two each (4), the nitrogen double bond (2), the carbon-carbon double bond (2) and the last nitrogen (2). That makes a total of 22 &pi; electrons.