Пример #1
0
 public void Rerun(IProgressInfo progressInfo)
 {
     progressInfo.Initialize("Building list", 100, 0);
     for (int i = 0; i < 100; i++)
     {
         progressInfo.Value = i;
         Thread.Sleep(5 * 1000 / 100);
         if (progressInfo.CancelRequested)
         {
             MessageBox.Show("List generation canceled");
             return;
         }
     }
     IReferenceListWindow refList = m_Host.ReferenceList;
     IReadOnlyList <IReferenceListItem> mylist = refList.AllListItems;
 }
Пример #2
0
        public override void DoLoad(IProgressInfo progressInfo)
        {
            // Actually do the load:
            // Since DoLoad is done on a different thread than what was used
            // to create the control, we need to use the Invoke method.
            Invoke((Action)(() => LoadSavedText()));

            // Illustrate use of progressInfo
            const int MAX_TIME = 100;

            progressInfo.Initialize("Loading Reference F", MAX_TIME);
            for (int i = 0; i < MAX_TIME; i++)
            {
                if (progressInfo.CancelRequested)
                {
                    m_writeLock.Dispose();
                    m_writeLock      = null;
                    textBox.Text     = "";
                    textBox.ReadOnly = true;
                }
                Thread.Sleep(20);
                progressInfo.Value = i;
            }
        }