Ejemplo n.º 1
0
        private void StateManager_Cleared(object sender, EventArgs e)
        {
            this.InvokeSafe(new System.Action(() =>
            {
                if (Monitor.TryEnter(lpScannedFiles, TIMEOUT))
                {
                    try
                    {
                        foreach (ItemControl cnt in lpScannedFiles.Controls)
                        {
                            cnt.Click   -= new EventHandler(ImageIconControl_Click);
                            cnt.Updated -= new EventHandler(ImageIconControl_Updated);
                            //cnt.DisposeSf();
                            ItemControl.SetInstance(cnt);
                        }

                        ToolTip1.RemoveAll();
                        lpScannedFiles.Controls.Clear();
                        tbTransferFile.Clear();

                        m_ScanFileOrganizer.Clear();
                        m_SendFileOrganizer.Clear();

                        lblItemsWithErr.Text = null;
                        lblMessage.Text      = string.Empty;
                    }
                    finally
                    {
                        Monitor.Exit(lpScannedFiles);
                    }
                }
                //m_ControlIndexes.Clear();
            }));
        }
Ejemplo n.º 2
0
 private void StateManager_ItemRemoved(object sender, ItemEventArgs e)
 {
     this.InvokeSafe(new System.Action <ItemEventArgs>((args) =>
     {
         if (Monitor.TryEnter(lpScannedFiles, TIMEOUT))
         {
             try
             {
                 foreach (Control cnt in lpScannedFiles.Controls)
                 {
                     var icnt = (ItemControl)cnt;
                     if (icnt != null && icnt.Item != null && icnt.Item.Equals(args.Item))
                     {
                         lpScannedFiles.Controls.Remove(icnt);
                         //icnt.DisposeSf();
                         ItemControl.SetInstance(icnt);
                         break;
                     }
                 }
             }
             finally
             {
                 Monitor.Exit(lpScannedFiles);
             }
         }
     }), e);
 }