Beispiel #1
0
 public void Search()
 {
     Application.Current.Dispatcher.Invoke(() =>
     {
         if (string.IsNullOrEmpty(SearchText) || string.IsNullOrEmpty(SearchText.Trim()))
         {
             AccountInfos.Clear();
             foreach (var item in AllAccountInfos)
             {
                 AccountInfos.Add(item);
             }
         }
         else
         {
             var searchText = SearchText.Trim();
             AccountInfos.Clear();
             foreach (var item in AllAccountInfos)
             {
                 if (item.Address.Contains(searchText) || (item.Tag != null && item.Tag.Contains(searchText)))
                 {
                     AccountInfos.Add(item);
                 }
             }
         }
     });
 }
Beispiel #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));
         }
     }
 }