void Start() { if (type.ToString() == LabelType.Lives.ToString()) { currentCount = 3; } if (type.ToString() == LabelType.Pellets.ToString()) { currentCount = 0; } }
public static string GenerateLabelName(LabelType lb) { if (Labels.ContainsKey(lb)) { Labels[lb]++; return(lb.ToString() + "_" + Labels[lb].ToString()); } else { Labels.Add(lb, 0); return(lb.ToString() + "_" + Labels[lb].ToString()); } }
protected void PrintType( CheckinLabel labelOrig, LabelType labelType ) { if ( tvLocations.CheckedNodes.Length > 0 ) { System.Collections.Generic.List<string> success = new System.Collections.Generic.List<string>(); System.Collections.Generic.List<string> fails = new System.Collections.Generic.List<string>(); foreach ( TreeViewNode node in tvLocations.CheckedNodes ) { if ( node.Depth == 1 ) { Location location = new Location( int.Parse( node.ID ) ); try { CheckinLabel label = labelOrig.ShallowCopy(); if ( LabelType.All == labelType ) { label.PrintAllLabels( location.Printer.PrinterName ); } else if ( LabelType.Attendance == labelType ) { label.PrintAttendanceLabel( location.Printer.PrinterName ); } else if ( LabelType.ClaimCard == labelType ) { label.PrintClaimCard( location.Printer.PrinterName ); } else if ( LabelType.Nametag == labelType ) { label.PrintNametag( location.Printer.PrinterName ); } else if ( LabelType.Test == labelType ) { label.FullName = location.LocationName; label.PrintAttendanceLabel( location.Printer.PrinterName ); } success.Add( string.Format( "<li>{0} ({1})</li>", location.LocationName, location.Printer.PrinterName ) ); } catch ( System.Exception ex ) { fails.Add( string.Format( "{0} ({1})<BR>{2}", location.LocationName, location.Printer.PrinterName, ex.Message ) + "<BR>StackTrace: " + ex.StackTrace ); } } } if ( success.Count > 0 ) { lblSuccessMessage.Text = labelType.ToString() + " successfully printed in room (printer):<br /><ul>" + string.Join( "", success.ToArray() ) + "</ul><hr>"; lblSuccessMessage.Visible = true; } if ( fails.Count > 0 ) { lblErrorMessage.Text = string.Join( "<hr>Failure to print in room (printer):<br>", fails.ToArray() ); lblErrorMessage.Visible = true; } } }