Example #1
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;
            }
        }
Example #2
0
        internal GoblinBat(char initial, Secret secret, string key, CancellationTokenSource cts, Strategy.Retrieve retrieve)
        {
            var collect = ((char)Port.Collecting).Equals(initial);

            this.key      = key;
            this.initial  = initial;
            this.secret   = secret;
            this.cts      = cts;
            this.retrieve = retrieve;
            InitializeComponent();
            Opacity = 0;

            if (collect)
            {
                Open = OpenAPI.ConnectAPI.GetInstance(key, 205);
                Open.SetAPI(axAPI);
                Open.SendCount += OnReceiveNotifyIcon;
            }
            switch (initial)
            {
            case collecting:
            case trading:
            case (char)83:
                if (Statistical == null)
                {
                    Statistical = initial.Equals((char)Port.Trading) ? new StatisticalControl(Strategy.Retrieve.Code, secret.strategy, secret.rate, secret.commission) : new StatisticalControl(Strategy.Retrieve.Code, secret.rate, secret.commission);
                    panel.Controls.Add(Statistical);
                    Statistical.Dock = DockStyle.Fill;
                    Statistical.Show();
                }
                if (Quotes == null)
                {
                    Quotes = new QuotesControl();
                    panel.Controls.Add(Quotes);
                    Quotes.Dock = DockStyle.Fill;
                    Quotes.Show();
                    strip.ItemClicked += OnItemClick;
                }
                if (collect)
                {
                    Open.SendQuotes += Quotes.OnReceiveQuotes;
                    Open.StartProgress(new OpenAPI.Temporary(Open, new StringBuilder(1024), key));
                }
                else
                {
                    Specify         = Statistical.Statistics(retrieve.GetUserStrategy());
                    Xing            = XingAPI.ConnectAPI.GetInstance(Strategy.Retrieve.Code, Strategy.Retrieve.Date);
                    Xing.Send      += OnReceiveNotifyIcon;
                    notifyIcon.Text = string.Concat("Trading Code_", Strategy.Retrieve.Code);
                    Text            = Xing.Account;
                    BeginInvoke(new Action(() => OnEventConnect()));
                    OnClickMinimized = quo;
                }
                Size = new Size(281, 5);
                break;

            default:
                Open.StartProgress();
                Size = new Size(238, 35);
                break;
            }
            CenterToScreen();
        }
Example #3
0
        internal GoblinBat(char initial, Secret secret)
        {
            this.initial = initial;
            this.secret  = secret;
            InitializeComponent();
            Opacity = 0;
            var collect = ((char)Port.Collecting).Equals(initial);

            if (collect)
            {
                Open = OpenAPI.ConnectAPI.GetInstance(KeyDecoder.GetWindowsProductKeyFromRegistry());
                Open.SetAPI(axAPI);
                Open.SendCount += OnReceiveNotifyIcon;
            }
            switch (initial)
            {
            case collecting:
            case trading:
                if (Quotes == null)
                {
                    Quotes = new QuotesControl();
                    panel.Controls.Add(Quotes);
                    Quotes.Dock = DockStyle.Fill;
                    Quotes.Show();
                    strip.ItemClicked += OnItemClick;
                }
                if (collect)
                {
                    Open.SendQuotes += Quotes.OnReceiveQuotes;
                    Open.StartProgress(new OpenAPI.Temporary(Open, new StringBuilder(1024), KeyDecoder.GetWindowsProductKeyFromRegistry()));
                }
                else
                {
                    BeginInvoke(new Action(() =>
                    {
                        Task = new Task(() =>
                        {
                            Specify = new Catalog.XingAPI.Specify[]
                            {
                                new Catalog.XingAPI.Specify
                                {
                                    Assets   = 90000000,
                                    Code     = Strategy.Retrieve.Code,
                                    Reaction = 500,
                                    Quantity = "1",
                                    RollOver = 'A',
                                    Time     = 1,
                                    Short    = 4,
                                    Long     = 60
                                },
                                new Catalog.XingAPI.Specify
                                {
                                    Assets   = 90000000,
                                    Code     = Strategy.Retrieve.Code,
                                    Reaction = 500,
                                    Quantity = "1",
                                    RollOver = 'A',
                                    Time     = 5,
                                    Short    = 4,
                                    Long     = 60
                                },
                                new Catalog.XingAPI.Specify
                                {
                                    Assets   = 90000000,
                                    Code     = Strategy.Retrieve.Code,
                                    Reaction = 500,
                                    Quantity = "1",
                                    RollOver = 'A',
                                    Time     = 15,
                                    Short    = 4,
                                    Long     = 60
                                },
                                new Catalog.XingAPI.Specify
                                {
                                    Assets   = 90000000,
                                    Code     = Strategy.Retrieve.Code,
                                    Reaction = 500,
                                    Quantity = "1",
                                    RollOver = 'A',
                                    Time     = 30,
                                    Short    = 4,
                                    Long     = 60
                                },
                                new Catalog.XingAPI.Specify
                                {
                                    Assets   = 90000000,
                                    Code     = Strategy.Retrieve.Code,
                                    Reaction = 500,
                                    Quantity = "1",
                                    RollOver = 'A',
                                    Time     = 1440,
                                    Short    = 4,
                                    Long     = 60
                                }
                            };
                        });
                        Task.Start();
                        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;
                        Text             = gs;
                        Application.DoEvents();
                    }));
                }
                Size = new Size(5, 5);
                break;

            default:
                Open.StartProgress();
                Size = new Size(238, 35);
                break;
            }
            CenterToScreen();
        }
Example #4
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;
            }
            ;
        }