public static void Exit(Retrieve dataRetriever) { dataRetriever.Dispose(); Environment.Exit(Constants.ErrorExitCode); }
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; } ; }