예제 #1
0
 private void StateManager_NewItemAdd(object sender, ItemEventArgs e)
 {
     this.InvokeSafe(new System.Action <ItemEventArgs>((args) =>
     {
         if (Monitor.TryEnter(lpScannedFiles, TIMEOUT))
         {
             try
             {
                 var cnt = ItemControl.GetInstance();
                 ToolTip1.SetToolTip(cnt, args.Item.SessionID.ToString());
                 cnt.Item             = args.Item;
                 cnt.Click           += new EventHandler(ImageIconControl_Click);
                 cnt.Updated         += new EventHandler(ImageIconControl_Updated);
                 cnt.ContextMenuStrip = scanContextMenuStrip;
                 lpScannedFiles.Controls.Add(cnt);
                 lblMessage.Text = string.Concat("Vouchers in folder: ", lpScannedFiles.Controls.Count, "     Starting from: ", m_CurrentVoucher);
             }
             finally
             {
                 Monitor.Exit(lpScannedFiles);
             }
         }
     }), e);
 }