Exemple #1
0
 private void MenuItemNewOrderClick(object sender, EventArgs e)
 {
     if (!AccountStatus.Instance.isAuthorized)
     {
         MessageBox.Show(Localizer.GetString("MessagePleaseLogInOnServer"), Localizer.GetString("TitleError"));
         return;
     }
     if (ActiveMdiChild == null || ActiveMdiChild is ChartForm == false)
     {
         if (dlgOrder == null || !dlgOrder.IsHandleCreated)
         {
             dlgOrder = new OrderDlg();
             dlgOrder.ShowDialog();
         }
         else
             dlgOrder.Visible = true;
         return;
     }
     var chart = (ChartForm)ActiveMdiChild;
     PlaceNewOrder(chart.chart.Symbol);
 }
        // ReSharper restore MemberCanBeMadeStatic.Local
        // ReSharper disable MemberCanBeMadeStatic.Local
        private void BtnNewPendingOrderClick(object sender, EventArgs e)
        {
            if (!AccountStatus.Instance.isAuthorized)
            {
                MessageBox.Show(EnumFriendlyName<RequestStatus>.GetString(RequestStatus.Unauthorized),
                    Localizer.GetString("TitleError"));
                return;
            }

            var orderType = tabControl.SelectedTab == pageDelayedOrders
                                ? OrderDlg.OrderDialogMode.OrderNewPending
                                : OrderDlg.OrderDialogMode.OrderNewMarket;
            var dlg = new OrderDlg(orderType);
            dlg.ShowDialog();
        }
        private void EditOrderBtnClick(object sender, EventArgs e)
        {
            var id = -1;
            foreach (var row in gridOpenPos.rows)
            {
                if (!row.Selected) continue;
                var deal = (MarketOrder)row.ValueObject;
                if (deal.State != PositionState.Opened) return;
                id = deal.ID;
                break;
            }

            if (id < 0) return;
            var dlg = new OrderDlg(OrderDlg.OrderDialogMode.OrderEditMarket, id);
            dlg.ShowDialog();
            ShowOpenPositions();
            Refresh();
        }
        private void BtnEditPendingOrderClick(object sender, EventArgs e)
        {
            var row = gridPendingOrders.rows.FirstOrDefault(r => r.Selected);
            if (row == null) return;
            var orderId = ((PendingOrder)row.ValueObject).ID;

            var dlg = new OrderDlg(OrderDlg.OrderDialogMode.OrderEditPending, orderId);
            dlg.ShowDialog();
        }