private void Smart_Click(object sender, EventArgs e) { socket?.Send(Subs.Messages(SubsType.SubsAndGetExist)); if (rbReal.Checked) { socket?.Send(Subs.BoxState(SubsType.SubsAndGetExist)); socket?.Send(Subs.Balances(SubsType.SubsAndGetExist, SysType.Real)); } else { socket?.Send(Subs.Balances(SubsType.SubsAndGetExist, SysType.Demo)); } smart_subs = true; }
private void SendSubs_Click(object sender, EventArgs e) { if (clbName.CheckedItems.Count == 0) { MessageBox.Show("No Subs Name checked", "Warning"); return; } if (clbType.CheckedItems.Count == 0) { MessageBox.Show("No Subs Type checked", "Warning"); return; } MarketType market; foreach (var proc in clbName.CheckedItems) { foreach (var type in clbType.CheckedItems) { var subs_type = SubsType.GetExist; switch (type.ToString()) { case "Only get": subs_type = SubsType.GetExist; break; case "Subscribe and get": subs_type = SubsType.SubsAndGetExist; break; case "Subscribe and get next": subs_type = SubsType.SubsAndGetNextChange; break; case "Unsubscribe": subs_type = SubsType.UnSubs; break; case "Unsubscribe and get": subs_type = SubsType.UnSubsAndGetExist; break; default: subs_type = SubsType.GetExist; break; } string mess = null; switch (proc.ToString()) { case "User keys": if (!rbReal.Checked) { MessageBox.Show("User keys only for Real", "Warning"); return; } mess = Subs.BoxState(subs_type); break; case "Balances": mess = Subs.Balances(subs_type, rbReal.Checked ? SysType.Real : SysType.Demo); break; case "Market balance": if (!rbReal.Checked) { MessageBox.Show("Market balance only for Real", "Warning"); return; } market = GetMarket(); if (market == MarketType.Empty) { return; } mess = Subs.Balance(subs_type, market); break; case "Orders": market = GetMarket(); if (market == MarketType.Empty) { return; } mess = Subs.Orders(subs_type, market, rbReal.Checked ? SysType.Real : SysType.Demo); break; case "Deals": market = GetMarket(); if (market == MarketType.Empty) { return; } mess = Subs.Deals(subs_type, market, rbReal.Checked ? SysType.Real : SysType.Demo); break; case "Messages": mess = Subs.Messages(subs_type); break; default: break; } if (!string.IsNullOrWhiteSpace(mess)) { socket?.Send(mess); } } } }