Esempio n. 1
0
        private void ShowNewForm(object sender, EventArgs e)
        {
            if (Application.OpenForms.OfType <frmOrders>().Count() == 1)
            {
                Application.OpenForms.OfType <frmOrders>().First().Activate();
            }
            else
            {
                string    name  = Guid.NewGuid().ToString();
                frmOrders order = new frmOrders();
                order.MdiParent = this;
                order.Name      = name;

                AddContextMenuTabControlItem(name, order);

                order.Show();
            }
        }
Esempio n. 2
0
        private int currentWorkspaceId = 0;//Mantain record of selected workspace
        private void ReteriveWindowLocations(int workSpaceId)
        {
            currentWorkspaceId = workSpaceId;
            var result = SQLiteDBOperation.ReteriveFormLocation(workSpaceId);

            foreach (var item in result)
            {
                switch (item.formName)
                {
                case "frmMarketWatch":
                    this.Invoke((Action) delegate()
                    {
                        frmMarketWatchWin marketWatch = new frmMarketWatchWin();
                        OpenWindows(marketWatch, item);
                    });
                    break;     /* optional */

                case "frmMarketWatchWin":
                    this.Invoke((Action) delegate()
                    {
                        frmMarketWatchWin WatchWindow = new frmMarketWatchWin();
                        OpenWindows(WatchWindow, item);
                    });
                    break;     /* optional */

                case "frmCharts":
                    string title  = item.formTitle;
                    string broker = string.Empty;
                    string symbol = string.Empty;
                    if (!string.IsNullOrEmpty(title))
                    {
                        broker = title.Split('.')[0];
                        symbol = title.Split('.')[1];
                        if (broker.ToLower() == Broker.BitFinex.ToString().ToLower())
                        {
                            symbol = "t" + symbol;
                        }
                    }
                    frmCharts charts = new frmCharts(this, broker, symbol);
                    OpenWindows(charts, item);
                    break;

                case "frmOrders":
                    frmOrders orders = new frmOrders();
                    OpenWindows(orders, item);
                    break;

                case "frmPositions":
                    frmPositions positions = new frmPositions();
                    OpenWindows(positions, item);
                    break;

                case "frmClosedPosition":
                    frmClosedPosition closedPosition = new frmClosedPosition();
                    OpenWindows(closedPosition, item);
                    break;

                case "frmAlertWindow":
                    frmAlertWindow alertWindow = new frmAlertWindow();
                    OpenWindows(alertWindow, item);
                    break;

                case "frmTransaction":
                    frmTransaction transaction = new frmTransaction();
                    OpenWindows(transaction, item);
                    break;

                default:     /* Optional */

                    break;
                }
            }
        }