/// <summary> /// Open OpenPosition forms /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void positionToolStripMenuItem_Click(object sender, EventArgs e) { //if (Application.OpenForms.OfType<frmPositions>().Count() == 1) //{ // Application.OpenForms.OfType<frmPositions>().First().Activate(); //} //else //{ var name = Guid.NewGuid().ToString(); frmPositions positions = new frmPositions(); positions.MdiParent = this; positions.Name = name; AddContextMenuTabControlItem(name, positions); positions.Show(); //} }
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; } } }