예제 #1
0
 private void Handle(CapturerItem item)
 {
     foreach (string url in item.Urls)
     {
         this.Add(url);
     }
 }
예제 #2
0
        public void Start()
        {
            CapturerItem item = new CapturerItem(this.Url);

            item.PropertyChanged += item_PropertyChanged;
            this._CapturerLists.Add(item);
            item.Start();
        }
예제 #3
0
 public void Add(string url)
 {
     if (this._Queue.SingleOrDefault(item => item.Url == url) == null)
     {
         CapturerItem item = new CapturerItem(url);
         this._Queue.Enqueue(item);
         this.Dispatch();
     }
 }
예제 #4
0
 private void Dispatch()
 {
     while (this._CurrentTaskCount < MAX_TASK && this._Queue.Count > 0)
     {
         CapturerItem item = this._Queue.Dequeue();
         item.PropertyChanged += item_PropertyChanged;
         item.Start();
         this._CurrentTaskCount++;
     }
 }
예제 #5
0
        void item_PropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            CapturerItem item = sender as CapturerItem;

            item.PropertyChanged -= item_PropertyChanged;
            if (item.Status == ECapturerStatus.Finish)
            {
                this.Handle(item);
                this._CurrentTaskCount--;
                this.Dispatch();
            }
            else if (item.Status == ECapturerStatus.Error)
            {
                this._CurrentTaskCount--;
                this.Dispatch();
            }
        }