void OnEventConnect() { foreach (var ctor in Xing.querys) { switch (ctor.GetType().Name) { case cfobq10500: case ccebq10500: BeginInvoke(new Action(() => { if (Account == null) { Account = new AccountControl(); panel.Controls.Add(Account); Account.Dock = DockStyle.Fill; Account.Show(); } ((IEvents <Deposit>)ctor).Send += Account.OnReceiveDeposit; ((IMessage <NotifyIconText>)ctor).SendMessage += OnReceiveNotifyIcon; })); break; case t0441: case cceaq50600: BeginInvoke(new Action(() => { if (Balance == null) { Balance = new BalanceControl(); panel.Controls.Add(Balance); Balance.Dock = DockStyle.Fill; Balance.SendReSize += OnReceiveSize; } ((IEvents <Balance>)ctor).Send += Balance.OnReceiveBalance; ((IMessage <NotifyIconText>)ctor).SendMessage += OnReceiveNotifyIcon; })); break; } ctor.QueryExcute(); } foreach (var ctor in Xing.reals) { switch (ctor.GetType().Name) { case fc0: case nc0: if (initial.Equals(trading)) { ((ITrends <Trends>)ctor).SendTrend += Quotes.OnReceiveTrend; } ctor.OnReceiveRealTime(initial.Equals(trading) ? Strategy.Retrieve.Code : Open.Code); continue; case fh0: case nh0: if (initial.Equals(collecting)) { Open.SendQuotes -= Quotes.OnReceiveQuotes; } ((IEvents <EventHandler.XingAPI.Quotes>)ctor).Send += Quotes.OnReceiveQuotes; ctor.OnReceiveRealTime(initial.Equals(trading) ? Strategy.Retrieve.Code : Open.Code); continue; case jif: BeginInvoke(new Action(() => { ((IEvents <NotifyIconText>)ctor).Send += OnReceiveNotifyIcon; if (Statistical == null) { Statistical = new StatisticalAnalysis(); panel.Controls.Add(Statistical); Statistical.Dock = DockStyle.Fill; } ctor.OnReceiveRealTime(initial.Equals(trading) ? Strategy.Retrieve.Code : Open.Code); })); continue; default: if (initial.Equals(trading)) { ((IStates <State>)ctor).SendState += Quotes.OnReceiveState; ctor.OnReceiveRealTime(Strategy.Retrieve.Code); } continue; } } if (initial.Equals(trading)) { foreach (var ctor in Xing.orders) { ((IMessage <NotifyIconText>)ctor).SendMessage += OnReceiveNotifyIcon; ((IStates <State>)ctor).SendState += Quotes.OnReceiveState; } Task.Wait(); Parallel.ForEach(Specify, new Action <Catalog.XingAPI.Specify>((param) => new Strategy.XingAPI.Base(param))); } WindowState = Xing.SendNotifyIconText((int)Math.Pow((initial.Equals(trading) ? Strategy.Retrieve.Code : Open.Code).Length, 4)); if ((DateTime.Now.Hour > 16 || DateTime.Now.Hour == 15 && DateTime.Now.Minute > 45) && initial.Equals(collecting)) { Temporary = new XingAPI.Temporary(Xing.reals[0], Xing.reals[1], new StringBuilder(1024), KeyDecoder.GetWindowsProductKeyFromRegistry()); } }
void OnEventConnect() { foreach (var ctor in Xing.querys) { switch (ctor.GetType().Name) { case cfobq10500: case ccebq10500: if (Account == null) { Account = new AccountControl(); panel.Controls.Add(Account); Account.Dock = DockStyle.Fill; Account.Show(); } ((IEvents <Deposit>)ctor).Send += Account.OnReceiveDeposit; ((IMessage <NotifyIconText>)ctor).SendMessage += OnReceiveNotifyIcon; break; case t0441: case cceaq50600: if (Balance == null) { Balance = new BalanceControl(); panel.Controls.Add(Balance); Balance.Dock = DockStyle.Fill; } ((IEvents <Balance>)ctor).Send += Balance.OnReceiveBalance; ((IMessage <NotifyIconText>)ctor).SendMessage += OnReceiveNotifyIcon; break; } ctor.QueryExcute(); } foreach (var ctor in Xing.reals) { switch (ctor.GetType().Name) { case fc0: case nc0: if (initial.Equals(collecting) == false) { ((ITrends <Trends>)ctor).SendTrend += Quotes.OnReceiveTrend; } ctor.OnReceiveRealTime(initial.Equals(collecting) ? Open.Code : Strategy.Retrieve.Code); continue; case fh0: case nh0: if (initial.Equals(collecting)) { Open.SendQuotes -= Quotes.OnReceiveQuotes; } ((IEvents <EventHandler.XingAPI.Quotes>)ctor).Send += Quotes.OnReceiveQuotes; ctor.OnReceiveRealTime(initial.Equals(collecting) ? Open.Code : Strategy.Retrieve.Code); continue; case jif: ((IEvents <NotifyIconText>)ctor).Send += OnReceiveNotifyIcon; ctor.OnReceiveRealTime(initial.Equals(collecting) ? Open.Code : Strategy.Retrieve.Code); continue; default: if (initial.Equals(collecting) == false) { ((IStates <State>)ctor).SendState += Quotes.OnReceiveState; ctor.OnReceiveRealTime(Strategy.Retrieve.Code); } continue; } } if (initial.Equals(collecting) == false) { Opacity = 0; foreach (var ctor in Xing.orders) { ((IMessage <NotifyIconText>)ctor).SendMessage += OnReceiveNotifyIcon; ((IStates <State>)ctor).SendState += Quotes.OnReceiveState; } if (initial.Equals(collecting) == false) { Parallel.ForEach(Specify, new Action <Catalog.XingAPI.Specify>((param) => { switch (param.Strategy) { case basic: new Strategy.XingAPI.Base(param); break; case bantam: new Strategy.XingAPI.Bantam(param); break; case feather: new Strategy.XingAPI.Feather(param); break; case fly: new Strategy.XingAPI.Fly(param); break; case sFly: new Strategy.XingAPI.SuperFly(param); break; case heavy: new Strategy.XingAPI.Heavy(param); break; default: if (param.Time > 0) { new Strategy.XingAPI.Consecutive(param); } break; } })); } } WindowState = Xing.SendNotifyIconText((int)Math.Pow((initial.Equals(collecting) ? Open.Code : Strategy.Retrieve.Code).Length, 4)); if ((DateTime.Now.Hour > 16 || DateTime.Now.Hour == 15 && DateTime.Now.Minute > 45) && initial.Equals(collecting)) { Temporary = new XingAPI.Temporary(Xing.reals[0], Xing.reals[1], new StringBuilder(1024), key); } }