private void buttonModifyOrder_Click(object sender, EventArgs e) { List <Order> orders = GetSelectedOrders(); if (orders.Count > 1 || orders.Count == 0) { MessageBox.Show("Select a single order to modify."); return; } ActiveOrder selectedOrder = (ActiveOrder)orders[0]; if (selectedOrder.IsOpenOrPending == false || selectedOrder.OrderExecutionProvider == null) //|| selectedOrder.OrderExecutionProvider.DataProvider == null //|| selectedOrder.OrderExecutionProvider.DataProvider.Quotes == null) { return; } ModifyOrderControl control = new ModifyOrderControl(ModifyOrderControl.ModeEnum.Modify, selectedOrder); control.Visible = true; HostingForm form = new HostingForm("Modify order", control); form.ShowDialog(); }
private void buttonAddOrder_Click(object sender, EventArgs e) { if (_selectedSession == null) { MessageBox.Show("Select a session to send order to."); return; } if (_selectedSession.DataProvider.OperationalState != OperationalStateEnum.Operational || _selectedSession.OrderExecutionProvider.OperationalState != OperationalStateEnum.Operational) { MessageBox.Show("Session data or order execution provider not operational."); return; } NewOrderControl control = new NewOrderControl(_selectedSession.DataProvider.Quotes, _selectedSession.Info, false, false); control.CreatePlaceOrderEvent += new NewOrderControl.CreatePlaceOrderDelegate(SubmitPositionOrder); HostingForm f = new HostingForm("New Order", control); f.FormBorderStyle = FormBorderStyle.FixedSingle; f.ShowDialog(); control.CreatePlaceOrderEvent -= new NewOrderControl.CreatePlaceOrderDelegate(SubmitPositionOrder); }
private void toolStripButtonSkipTo_Click(object sender, EventArgs e) { HostingForm form = new HostingForm("Fast Run", new TimeManagementSkipToControl(_control)); form.FormBorderStyle = FormBorderStyle.FixedDialog; form.ShowDialog(); }
private void buttonCloseOrder_Click(object sender, EventArgs e) { List <Order> orders = GetSelectedOrders(); if (orders.Count > 1 || orders.Count == 0) { MessageBox.Show("Select a single order to close."); return; } if (orders[0] is ActiveOrder) { ActiveOrder order = (ActiveOrder)orders[0]; if (order.IsOpenOrPending == false) { return; } if (order.State == OrderStateEnum.Submitted) { string message; if (order.Cancel(out message)) { MessageBox.Show("Order canceled.", "Success", MessageBoxButtons.OK); } else { MessageBox.Show("Order cancel failed [" + message + "].", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { ModifyOrderControl control = new ModifyOrderControl(ModifyOrderControl.ModeEnum.Close, order); HostingForm form = new HostingForm("Modify order", control); form.ShowDialog(); } } else if (orders[0] is PassiveOrder) { PassiveOrder order = (PassiveOrder)orders[0]; if (order.State != OrderStateEnum.Submitted) { MessageBox.Show("Passive orders can only be canceled."); return; } string operationResultMessage = string.Empty; if (order.CloseOrCancel(null, null, out operationResultMessage) == false) { MessageBox.Show("Failed to cancel order [" + operationResultMessage + "].", "Order Cancel Failed", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } }
/// <summary> /// 弹出窗口 /// </summary> public void CallNextPatient(string name) { RtCallMessageFrm rcf = new RtCallMessageFrm(name); HostingForm f = new HostingForm(); f.Height = rcf.Height; f.Width = rcf.Width; f.StartPosition = FormStartPosition.CenterScreen; f.TopMost = true; f.Controls.Add(rcf); f.ShowDialog(); }
private void toolStripButtonIndicators_Click(object sender, EventArgs e) { if (Session == null) { return; } ExpertSessionIndicatorsControl control = new ExpertSessionIndicatorsControl(_session, chartControl.Panes); control.AddIndicatorEvent += new ExpertSessionIndicatorsControl.AddIndicatorDelegate(control_AddIndicatorEvent); control.RemoveIndicatorEvent += new ExpertSessionIndicatorsControl.RemoveIndicatorDelegate(control_RemoveIndicatorEvent); HostingForm form = new HostingForm("Session " + _session.Info.Name + " Indicators", control); form.FormBorderStyle = FormBorderStyle.FixedDialog; form.ShowDialog(); }
private void toolStripButtonNewOrder_Click(object sender, EventArgs e) { if (_manager == null) { return; } Position position = SelectedPosition; if (position == null) { MessageBox.Show("Select a position to put order to."); return; } if (position.DataDelivery.OperationalState != OperationalStateEnum.Operational || position.OrderExecutionProvider.OperationalState != OperationalStateEnum.Operational) { MessageBox.Show("Position data or order execution provider not operational."); return; } IQuoteProvider quotes = _manager.ObtainQuoteProvider(position.DataDelivery.SourceId, position.Symbol); DataSessionInfo?info = _manager.GetSymbolDataSessionInfo(position.DataDelivery.SourceId, position.Symbol); if (info.HasValue == false) { MessageBox.Show("Failed to establish position session.", Application.ProductName + " - Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } NewOrderControl control = new NewOrderControl(quotes, info.Value, true, true); control.CreatePlaceOrderEvent += new NewOrderControl.CreatePlaceOrderDelegate(SubmitPositionOrder); HostingForm f = new HostingForm("New Order", control); f.FormBorderStyle = FormBorderStyle.FixedSingle; f.MaximizeBox = false; f.ShowDialog(); control.CreatePlaceOrderEvent -= new NewOrderControl.CreatePlaceOrderDelegate(SubmitPositionOrder); }