Пример #1
0
        void OnReceiveItem(string item)
        {
            switch (item)
            {
            case quo:
                if (Array.Exists(XingConnect, o => o.Equals(initial)))
                {
                    foreach (var ctor in Xing.orders)
                    {
                        if (initial.Equals(trading))
                        {
                            ((IStates <State>)ctor).SendState += Quotes.OnReceiveState;
                        }

                        ((IMessage <NotifyIconText>)ctor).SendMessage += OnReceiveNotifyIcon;
                    }
                    for (int i = 0; i < Xing.reals.Length; i++)
                    {
                        switch (i)
                        {
                        case 0:
                            ((IEvents <EventHandler.XingAPI.Quotes>)Xing.reals[i]).Send += Quotes.OnReceiveQuotes;
                            continue;

                        case 1:
                            if (initial.Equals(trading))
                            {
                                ((ITrends <Trends>)Xing.reals[i]).SendTrend += Quotes.OnReceiveTrend;
                            }

                            continue;

                        case 2:
                            Text = XingAPI.ConnectAPI.Code;
                            continue;

                        default:
                            if (initial.Equals(trading))
                            {
                                ((IStates <State>)Xing.reals[i]).SendState += Quotes.OnReceiveState;
                            }

                            continue;
                        }
                    }
                    Xing.OnReceiveBalance = true;
                }
                else
                {
                    Open.SendQuotes += Quotes.OnReceiveQuotes;
                    Open.SendState  += Quotes.OnReceiveState;
                    Open.SendTrend  += Quotes.OnReceiveTrend;
                }
                Size = new Size(323, 493);
                Quotes.Show();
                break;

            case ex:
                Text = secret.GetIdentify();
                Size = new Size(241, 0);
                CenterToScreen();
                Close();
                return;

            case st:
                if (Xing != null && Array.Exists(XingConnect, o => o.Equals(initial)))
                {
                    Text = Xing.GetAccountName(Xing.Accounts.Length == 1 ? Xing.Accounts[0] : Array.Find(Xing.Accounts, o => o.Substring(o.Length - 2, 2).Equals("02")));
                }

                Size = new Size(795, 433);
                Statistical.Show();
                break;

            case acc:
                if (Array.Exists(XingConnect, o => o.Equals(initial)))
                {
                    Text = (Xing.Accounts.Length == 1 ? Xing.Accounts[0] : Array.Find(Xing.Accounts, o => o.Substring(o.Length - 2, 2).Equals("02"))).Insert(5, "-").Insert(3, "-");
                    var query = Xing.querys[0];
                    ((IEvents <Deposit>)query).Send += Account.OnReceiveDeposit;
                    ((IMessage <NotifyIconText>)query).SendMessage += OnReceiveNotifyIcon;
                    query.QueryExcute();
                }
                else
                {
                    Open.SendDeposit += Account.OnReceiveDeposit;
                    Open.LookUpTheDeposit(Acc);
                }
                Size = new Size(749, 372);
                Account.Show();
                break;

            case bal:
                if (Array.Exists(XingConnect, o => o.Equals(initial)))
                {
                    Text = Xing.DetailName;
                    var query = Xing.querys[1];
                    ((IEvents <Balance>)query).Send += Balance.OnReceiveBalance;
                    ((IMessage <NotifyIconText>)query).SendMessage += OnReceiveNotifyIcon;
                    query.QueryExcute();
                }
                else
                {
                    Open.SendBalance += Balance.OnReceiveBalance;
                    Open.LookUpTheBalance(Acc);
                }
                Size = new Size(249, 0);
                Balance.SendReSize += OnReceiveSize;
                break;
            }
        }
Пример #2
0
        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());
            }
        }
Пример #3
0
        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);
            }
        }