Beispiel #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));
         }
     }
 }
Beispiel #2
0
        private void PATS_OnConnectStateChanged(object sender, ConnectStateEventArgs e)
        {
            this.BeginInvokeIfRequired(() =>
            {
                //tsConnectAction.Text = e.isConnected ? "█" : $"█ {e.LogonState} {e.HostState} {e.PriceState}";
                //tsConnectAction.ForeColor = e.isConnected ? Color.Green : Color.Crimson;
                tsConnectAction.Text  = e.isConnected ? string.Empty : $"{e.LogonState} {e.HostState} {e.PriceState}";
                tsConnectAction.Image = e.isConnected ? Resources._1469092136_connect : Resources._1469092096_disconnect;
                tsConnect.Enabled     = !e.isConnected;
                tsDisconnect.Enabled  = e.isConnected;
            });
            Util.SettingForm.BeginInvokeIfRequired(() =>
            {
                Util.SettingForm.Enable = !e.isConnected;
            });

            //if (e.DLComplete)
            //{
            //    if (Util.ProductInfos == null)
            //    {
            //        Util.ProductInfos = ProductInfo.Convert(Util.PATS.Products());
            //        Center.Instance.Post(nameof(Util.PATS), nameof(Util.ProductInfos));
            //    }
            //    if (Util.AccountInfos == null)
            //    {
            //        Util.AccountInfos = AccountInfo.Convert(Util.PATS.Traders());
            //        Center.Instance.Post(nameof(Util.PATS), nameof(Util.AccountInfos));
            //    }
            //}
            //else
            //{
            //    if (Util.ProductInfos!= null)
            //    {
            //        Util.ProductInfos.Clear();
            //        Center.Instance.Post(nameof(Util.PATS), nameof(Util.ProductInfos));
            //    }
            //    if (Util.AccountInfos != null)
            //    {
            //        Util.AccountInfos.Clear();
            //        Center.Instance.Post(nameof(Util.PATS), nameof(Util.AccountInfos));
            //    }
            //}
        }
Beispiel #3
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));
         }
     }
 }