示例#1
0
 private static void PATS_OnConnectStateChanged(object sender, ConnectStateEventArgs e)
 {
     if (e.DLComplete)
     {
         if (ProductInfos == null)
         {
             ProductInfos = ProductInfo.Convert(PATS.Products());
             Center.Instance.Post(nameof(PATS), nameof(ProductInfos));
         }
         if (AccountInfos == null)
         {
             AccountInfos = AccountInfo.Convert(PATS.Traders());
             Center.Instance.Post(nameof(PATS), nameof(AccountInfos));
         }
     }
     else
     {
         if (ProductInfos != null)
         {
             ProductInfos.Clear();
             Center.Instance.Post(nameof(PATS), nameof(ProductInfos));
         }
         if (AccountInfos != null)
         {
             AccountInfos.Clear();
             Center.Instance.Post(nameof(PATS), nameof(AccountInfos));
         }
     }
 }
示例#2
0
 private static void PATS_OnConnectStateChanged(object sender, ConnectStateEventArgs e)
 {
     if (e.DLComplete)
     {
         if (ExchangeInfo == null)
         {
             ExchangeInfo = new ExchInfo();
         }
         if (ProductInfos == null)
         {
             //ProductInfos = ProductInfo.Convert(PATS.Products(), PATS.OrderTypes());
             ProductInfos = ProductInfo.Convert(PATS.Products());
             Center.Instance.Post(Observer.PATS, nameof(ProductInfos));
         }
         if (AccountInfos == null)
         {
             AccountInfos = AccountInfo.Convert(PATS.Traders());
             Center.Instance.Post(Observer.PATS, nameof(AccountInfos));
         }
     }
     else
     {
         if (ExchangeInfo != null)
         {
             ExchangeInfo = null;
         }
         if (ProductInfos != null)
         {
             ProductInfos.Clear();
             Center.Instance.Post(Observer.PATS, nameof(ProductInfos));
         }
         if (AccountInfos != null)
         {
             AccountInfos.Clear();
             Center.Instance.Post(Observer.PATS, nameof(AccountInfos));
         }
     }
 }