Exemplo n.º 1
0
        private void provider_NewHistoricalQuote(object sender, HistoricalQuoteEventArgs args)
        {
            DownloadViewItem downloadViewItem = (DownloadViewItem)null;

            if (!this.items.TryGetValue(((HistoricalDataEventArgs)args).RequestId, out downloadViewItem))
            {
                return;
            }
            downloadViewItem.Instrument.Add(args.Quote);
            this.UpdateDownloadItem(downloadViewItem, (HistoricalDataEventArgs)args);
        }
Exemplo n.º 2
0
        private void provider_HistoricalDataRequestCancelled(object sender, HistoricalDataEventArgs args)
        {
            DownloadViewItem downloadViewItem = (DownloadViewItem)null;

            if (!this.items.TryGetValue(args.RequestId, out downloadViewItem))
            {
                return;
            }
            this.SetItemStatus(downloadViewItem, DownloadItemStatus.Cancelled);
            this.activeRequests.Remove(args.RequestId);
        }
Exemplo n.º 3
0
        private void provider_HistoricalDataRequestError(object sender, HistoricalDataErrorEventArgs args)
        {
            DownloadViewItem downloadViewItem = (DownloadViewItem)null;

            if (!this.items.TryGetValue(((HistoricalDataEventArgs)args).RequestId, out downloadViewItem))
            {
                return;
            }
            this.SetItemStatus(downloadViewItem, DownloadItemStatus.Error);
            this.SetItemMessage(downloadViewItem, args.Message);
            this.UpdateProgressBar();
            this.activeRequests.Remove(((HistoricalDataEventArgs)args).RequestId);
        }
Exemplo n.º 4
0
 private void UpdateThread(object obj)
 {
     while (!this.exitUpdateThread)
     {
         using (Dictionary <string, DownloadViewItem> .ValueCollection.Enumerator enumerator = this.items.Values.GetEnumerator())
         {
             while (enumerator.MoveNext())
             {
                 DownloadViewItem item = enumerator.Current;
                 this.Invoke((Action)(() => item.UpdateProgress()));
             }
         }
         Thread.Sleep(1000);
     }
 }
Exemplo n.º 5
0
        private void provider_NewHistoricalBar(object sender, HistoricalBarEventArgs args)
        {
            DownloadViewItem downloadViewItem = (DownloadViewItem)null;

            if (!this.items.TryGetValue(((HistoricalDataEventArgs)args).RequestId, out downloadViewItem))
            {
                return;
            }
            if (args.Bar is Daily)
            {
                downloadViewItem.Instrument.Add(args.Bar as Daily);
            }
            else
            {
                downloadViewItem.Instrument.Add(args.Bar);
            }
            this.UpdateDownloadItem(downloadViewItem, (HistoricalDataEventArgs)args);
        }
Exemplo n.º 6
0
 private void SetItemMessage(DownloadViewItem item, string message)
 {
     item.Message = message;
     this.Invoke((Action)(() => item.UpdateMessage()));
     Thread.Sleep(0);
 }
Exemplo n.º 7
0
 private void SetItemStatus(DownloadViewItem item, DownloadItemStatus status)
 {
     item.Status = status;
     this.Invoke((Action)(() => item.UpdateStatus()));
     Thread.Sleep(0);
 }
Exemplo n.º 8
0
 private void UpdateDownloadItem(DownloadViewItem item, HistoricalDataEventArgs args)
 {
     ++item.Count;
     item.Total = args.DataLength <= 0 ? item.Count : args.DataLength;
     Thread.Sleep(0);
 }
Exemplo n.º 9
0
    private void SetItemMessage(DownloadViewItem item, string message)
    {
      item.Message = message;
			this.Invoke((Action) (() => item.UpdateMessage()));
      Thread.Sleep(0);
    }
Exemplo n.º 10
0
    private void SetItemStatus(DownloadViewItem item, DownloadItemStatus status)
    {
      item.Status = status;
			this.Invoke((Action) (() => item.UpdateStatus()));
      Thread.Sleep(0);
    }
Exemplo n.º 11
0
 private void UpdateDownloadItem(DownloadViewItem item, HistoricalDataEventArgs args)
 {
   ++item.Count;
   item.Total = args.DataLength <= 0 ? item.Count : args.DataLength;
   Thread.Sleep(0);
 }