示例#1
0
        public static BalanceControl CreateBalanceControl(string dataAreaId, string mainAccountId, string chartOfAccounts, global::Microsoft.Dynamics.DataEntities.MainAccount ledgerBalanceControlMainAccountRole)
        {
            BalanceControl balanceControl = new BalanceControl();

            balanceControl.dataAreaId      = dataAreaId;
            balanceControl.MainAccountId   = mainAccountId;
            balanceControl.ChartOfAccounts = chartOfAccounts;
            if ((ledgerBalanceControlMainAccountRole == null))
            {
                throw new global::System.ArgumentNullException("ledgerBalanceControlMainAccountRole");
            }
            balanceControl.LedgerBalanceControlMainAccountRole = ledgerBalanceControlMainAccountRole;
            return(balanceControl);
        }
示例#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);
            }
        }
示例#4
0
        void OnReceiveNotifyIcon(object sender, NotifyIconText e)
        {
            switch (e.NotifyIcon.GetType().Name)
            {
            case dic:
                var temp = (Dictionary <int, string>)e.NotifyIcon;

                if (temp.TryGetValue(0, out string code))
                {
                    notifyIcon.Text = checkDataBase;
                    Open.StartProgress(3605);
                    notifyIcon.Text = secret.GetIdentify();

                    return;
                }
                var first = temp.First();
                notifyIcon.Text = string.Concat(DateTime.Now.ToShortTimeString(), " Remains_", first.Key, " Code_", first.Value);
                return;

            case sb:
                strip.ItemClicked += OnItemClick;
                BeginInvoke(new Action(() =>
                {
                    if (Quotes == null)
                    {
                        Quotes = new QuotesControl();
                        panel.Controls.Add(Quotes);
                        Open.SendQuotes += Quotes.OnReceiveQuotes;
                        Quotes.Dock      = DockStyle.Fill;
                    }
                    if (Account == null)
                    {
                        Account = new AccountControl();
                        panel.Controls.Add(Account);
                        Account.Dock      = DockStyle.Fill;
                        Open.SendDeposit += Account.OnReceiveDeposit;
                    }
                    if (Balance == null)
                    {
                        Balance = new BalanceControl();
                        panel.Controls.Add(Balance);
                        Balance.Dock      = DockStyle.Fill;
                        Open.SendBalance += Balance.OnReceiveBalance;
                    }
                    if (Statistical == null)
                    {
                        Statistical = new StatisticalAnalysis();
                        panel.Controls.Add(Statistical);
                        Statistical.Dock = DockStyle.Fill;
                    }
                    var chart = Retrieve.GetInstance(KeyDecoder.GetWindowsProductKeyFromRegistry(), Open.Code).Chart;
                    var check = e.NotifyIcon.ToString().Split((char)59);
                    Acc       = new string[check.Length - 3];
                    Server    = check[check.Length - 1].Equals(secret.Mock);

                    if (Server ? false : new VerifyIdentity().Identify(check[check.Length - 3], check[check.Length - 2]) == false)
                    {
                        TimerBox.Show(new Secret(check[check.Length - 2]).Identify, secret.GoblinBat, MessageBoxButtons.OK, MessageBoxIcon.Warning, 3750);
                        Dispose();

                        return;
                    }
                    for (int i = 0; i < check.Length - 3; i++)
                    {
                        Acc[i] = check[i];
                    }

                    new Task(() =>
                    {
                        var specify = new Specify
                        {
                            Account  = Acc,
                            Assets   = 17500000,
                            Code     = Open.Code,
                            Strategy = "TF",
                            Time     = 30,
                            Short    = 4,
                            Long     = 60
                        };
                        new Strategy.OpenAPI.Trading(Open, specify, new Strategy.OpenAPI.Quotes(specify, Open), chart);
                    }).Start();
                    new Task(() =>
                    {
                        var liquidate = new Specify
                        {
                            Account  = Acc,
                            Assets   = 17500000,
                            Code     = Open.Code,
                            Strategy = "WU",
                            Time     = 15,
                            Short    = 4,
                            Long     = 60
                        };
                        new Strategy.OpenAPI.Trading(Open, liquidate, new Strategy.OpenAPI.Quotes(liquidate, Open), chart);
                    }).Start();
                    new Task(() => new Strategy.OpenAPI.Trading(Open, new Specify
                    {
                        Account  = Acc,
                        Assets   = 17500000,
                        Code     = Open.Code,
                        Strategy = "DL",
                        Time     = 1440,
                        Short    = 4,
                        Long     = 60,
                        Reaction = 531
                    }, chart)).Start();
                    Open.SendState += Quotes.OnReceiveState;
                    Open.SendTrend += Quotes.OnReceiveTrend;
                    Retrieve.Dispose();
                }));
                return;

            case str:
                BeginInvoke(new Action(() => Quotes.OnReceiveOrderMsg(e.NotifyIcon.ToString())));
                return;

            case bt:
                if (Array.Exists(XingConnect, o => o.Equals(initial)))
                {
                    BeginInvoke(new Action(() =>
                    {
                        Xing            = XingAPI.ConnectAPI.GetInstance(initial.Equals(trading) ? Strategy.Retrieve.Code : Open.Code, Strategy.Retrieve.Date);
                        Xing.Send      += OnReceiveNotifyIcon;
                        notifyIcon.Text = string.Concat("Trading Code_", initial.Equals(trading) ? Strategy.Retrieve.Code : Open.Code);
                        OnEventConnect();
                        OnClickMinimized = quo;
                        Application.DoEvents();
                    }));
                }
                else
                {
                    Account.Show();
                    Open.SendDeposit -= Account.OnReceiveDeposit;
                    Account.Hide();
                    Balance.Show();
                    Open.SendBalance -= Balance.OnReceiveBalance;
                    Balance.Hide();
                    Open.SendState -= Quotes.OnReceiveState;
                    Open.SendTrend -= Quotes.OnReceiveTrend;
                }
                return;

            case int32:
                if ((int)e.NotifyIcon < 0)
                {
                    if (Temporary != null && initial.Equals(collecting))
                    {
                        Temporary.SetStorage(Open.Code);
                    }

                    Process.Start("shutdown.exe", "-r");
                    Dispose();
                }
                else
                {
                    foreach (var ctor in Xing.querys)
                    {
                        switch (ctor.GetType().Name)
                        {
                        case cfobq10500:
                        case ccebq10500:
                            ((IEvents <Deposit>)ctor).Send -= Account.OnReceiveDeposit;
                            ((IMessage <NotifyIconText>)ctor).SendMessage -= OnReceiveNotifyIcon;
                            Account.Hide();
                            break;

                        case t0441:
                        case cceaq50600:
                            ((IEvents <Balance>)ctor).Send -= Balance.OnReceiveBalance;
                            ((IMessage <NotifyIconText>)ctor).SendMessage -= OnReceiveNotifyIcon;
                            Balance.Hide();
                            break;
                        }
                    }
                    Statistical.Hide();
                    return;
                }
                break;

            case cha:
                switch ((char)e.NotifyIcon)
                {
                case (char)69:
                    new ExceptionMessage(e.NotifyIcon.ToString());
                    Dispose();
                    return;

                case (char)41:
                    if (initial.Equals(trading))
                    {
                        Xing.OnReceiveBalance = false;
                        Process.Start("shutdown.exe", "-r");
                        Dispose();
                    }
                    break;

                case (char)21:
                    if (initial.Equals(trading))
                    {
                        Xing.OnReceiveBalance = true;
                    }

                    break;

                default:
                    return;
                }
                break;

            case boolean:
                break;
            }
        }
示例#5
0
        private void OnReceiveNotifyIcon(object sender, NotifyIconText e)
        {
            switch (e.NotifyIcon.GetType().Name)
            {
            case "StringBuilder":
                strip.ItemClicked += OnItemClick;
                BeginInvoke(new Action(() =>
                {
                    Quotes = new QuotesControl();
                    panel.Controls.Add(Quotes);
                    API.SendQuotes += Quotes.OnReceiveQuotes;
                    Quotes.Dock     = DockStyle.Fill;
                    Account         = new AccountControl();
                    panel.Controls.Add(Account);
                    Account.Dock     = DockStyle.Fill;
                    API.SendDeposit += Account.OnReceiveDeposit;
                    Balance          = new BalanceControl();
                    panel.Controls.Add(Balance);
                    Balance.Dock     = DockStyle.Fill;
                    API.SendBalance += Balance.OnReceiveBalance;
                    Statistical      = new StatisticalControl();
                    panel.Controls.Add(Statistical);
                    Statistical.Dock = DockStyle.Fill;
                    var code         = e.NotifyIcon.ToString().Split(';');
                    var chart        = Retrieve.GetInstance(code[code.Length - 1]).Chart;
                    new Task(() =>
                    {
                        var specify = new Specify
                        {
                            Account  = secret.Accounts,
                            Assets   = 17500000,
                            Code     = code[code.Length - 1],
                            Strategy = "TF",
                            Time     = 30,
                            Short    = 4,
                            Long     = 60
                        };
                        new Trading(API, specify, new Statistic.Quotes(specify, API), chart);
                    }).Start();
                    new Task(() =>
                    {
                        var liquidate = new Specify
                        {
                            Account  = secret.Accounts,
                            Assets   = 17500000,
                            Code     = code[code.Length - 1],
                            Strategy = "WU",
                            Time     = 15,
                            Short    = 4,
                            Long     = 60
                        };
                        new Trading(API, liquidate, new Statistic.Quotes(liquidate, API), chart);
                    }).Start();
                    new Task(() => new Trading(API, new Specify
                    {
                        Account  = secret.Accounts,
                        Assets   = 17500000,
                        Code     = code[code.Length - 1],
                        Strategy = "DL",
                        Time     = 1440,
                        Short    = 4,
                        Long     = 60,
                        Reaction = 531
                    }, chart)).Start();
                    API.SendState += Quotes.OnReceiveState;
                    API.SendTrend += Quotes.OnReceiveTrend;
                    Retrieve.Dispose();
                }));
                return;

            case "String":
                BeginInvoke(new Action(() => Quotes.OnReceiveOrderMsg(e.NotifyIcon.ToString())));
                return;

            case "Byte":
                Account.Show();
                API.SendDeposit -= Account.OnReceiveDeposit;
                Account.Hide();
                Balance.Show();
                API.SendBalance -= Balance.OnReceiveBalance;
                Balance.Hide();
                BackColor        = Color.FromArgb(121, 133, 130);
                Opacity          = 0.8135;
                OnClickMinimized = "quotes";
                WindowState      = FormWindowState.Minimized;
                API.SendState   -= Quotes.OnReceiveState;
                API.SendTrend   -= Quotes.OnReceiveTrend;
                return;

            case "Char":
                Dispose();
                break;
            }
            ;
        }