private void ReloadPortfolios() { List <string> portfoliosNames = new List <string>(); List <GridDataAssetsRT> dataAssetses = new List <GridDataAssetsRT>(); UserPortfolios = frmMain2.GetUserPortfolios(); try { foreach (SymbolGroup p in UserPortfolios) { for (int i = 0; i < documentTabStrip1.Controls.Count; i++) { if (!documentTabStrip1.Controls[i].Name.Equals("tab" + p.Name.Trim())) { continue; } portfoliosNames.Add(p.Name); GridDataAssetsRT dataManagerExtends = (GridDataAssetsRT)documentTabStrip1.Controls[i].Controls[0]; dataManagerExtends.assetList = p.Symbols.Split(new char[] { ',' }).ToList(); dataManagerExtends.ReloadDetailsTable(); dataAssetses.Add(dataManagerExtends); break; } } } catch (Exception ex) { Console.WriteLine("\n\nSelectView:ReloadPortfolios() " + ex.Message); } }
//Load User's Porfolios public void LoadPortfolios(List <string> updatePortfolios) { /*Stopwatch timer = new Stopwatch(); * long t1, t2, t3, t4; * t1 = t2 = t3 = t4 = 0; * timer.Start(); * t4 = timer.ElapsedMilliseconds - t3 - t2 - t1; * MessageBox.Show("T1 = " + t1 + "ms\nT2 = " + t2 + "ms\nT3 = " + t3 + "ms\nT4 = " + t4 + "ms\nT5 = "+timer.ElapsedMilliseconds); * */ try { UserPortfolios = frmMain2.GetUserPortfolios(); foreach (SymbolGroup p in UserPortfolios) { bool port = updatePortfolios.Any(updatePortfolio => updatePortfolio.Equals(p.Name)); if (!port) { continue; } foreach (Control control in documentTabStrip1.Controls) { if (!control.Name.Equals("tab" + p.Name)) { continue; } if (control.Controls.Count == 0) { continue; } GridDataAssetsRT dataAssets = (GridDataAssetsRT)control.Controls[0]; dataAssets.assetList = p.Symbols.Split(new char[] { ',' }).ToList(); dataAssets.ReloadAssets(); dataAssets.OrderRefresh(); dataAssets.LoadPerformanceTable(); //dataAssets.ReloadDetailsTable(); } } frmMain2.SaveUserPortfolios(UserPortfolios); } catch (Exception ex) { Telerik.WinControls.RadMessageBox.Show("\n\nSelectView:LoadPortfolios() " + ex.Message); } }
private void Update() { try { foreach (Control control in documentTabStrip1.Controls) { if (control.Controls.Count == 0) { continue; } GridDataAssetsRT dataAssets = (GridDataAssetsRT)control.Controls[0]; dataAssets.UpdateRefresh(); //dataAssets.ReloadDetailsTable(); } frmMain2.SaveUserPortfolios(UserPortfolios); } catch (Exception ex) { Telerik.WinControls.RadMessageBox.Show("\n\nSelectView:Update() " + ex.Message); } }
//Load User's Porfolios public void LoadPortfolios() { try { DocumentWindow tabAll = new DocumentWindow { DocumentButtons = DocumentStripButtons.ActiveWindowList, Name = "tabAll", Text = Program.LanguageDefault.DictionarySelectTools["tabAll"] }; documentTabStrip1.Controls.Add(tabAll); if (InvokeRequired) { Invoke(new Action(() => { UserPortfolios = frmMain2.GetUserPortfolios(); List <string> portfoliosNames = new List <string>(); //gridsDataAssets = new List<GridDataAssets>(); gridsDataAssets = new List <GridDataAssetsRT>(); foreach (SymbolGroup p in UserPortfolios) { portfoliosNames.Add(p.Name); //GridDataAssets dataAssets = new GridDataAssets(this, p.Symbols.ToList()) { Dock = DockStyle.Fill, DisableOrderAssets = true, NamePort = p.Name }; GridDataAssetsRT dataAssets = new GridDataAssetsRT(this, p.Symbols.Split(new char[] { ',' }).ToList()) { Dock = DockStyle.Fill }; DocumentWindow tabPage; if (p.Name.ToUpper() == "ALL") { //tabPage = tabAll; } else { gridsDataAssets.Add(dataAssets); tabPage = new DocumentWindow { DocumentButtons = DocumentStripButtons.ActiveWindowList, Name = "tab" + p.Name.Trim(), Text = p.Name }; documentTabStrip1.Controls.Add(tabPage); tabPage.Controls.Add(gridsDataAssets.Last()); } } GridDataAssetsRT gridDataAll = new GridDataAssetsRT(this, UserPortfolios[0].Symbols.Split(new char[] { ',' }).ToList()) { Dock = DockStyle.Fill }; gridsDataAssets.Insert(0, gridDataAll); tabAll.Controls.Add(gridDataAll); })); } else { UserPortfolios = frmMain2.GetUserPortfolios(); List <string> portfoliosNames = new List <string>(); //gridsDataAssets = new List<GridDataAssets>(); gridsDataAssets = new List <GridDataAssetsRT>(); foreach (SymbolGroup p in UserPortfolios) { portfoliosNames.Add(p.Name); Console.WriteLine("\tCREATING GridDataAssetsRT(" + p.Name + ")"); //GridDataAssets dataAssets = new GridDataAssets(this, p.Symbols.ToList()) { Dock = DockStyle.Fill, DisableOrderAssets = true, NamePort = p.Name }; GridDataAssetsRT dataAssets = new GridDataAssetsRT(this, p.Symbols.Split(new char[] { ',' }).ToList()) { Dock = DockStyle.Fill }; DocumentWindow tabPage; if (p.Name.ToUpper() == "ALL") { //tabPage = tabAll; } else { gridsDataAssets.Add(dataAssets); tabPage = new DocumentWindow { DocumentButtons = DocumentStripButtons.ActiveWindowList, Name = "tab" + p.Name.Trim(), Text = p.Name }; documentTabStrip1.Controls.Add(tabPage); tabPage.Controls.Add(gridsDataAssets.Last()); } } GridDataAssetsRT gridDataAll = new GridDataAssetsRT(this, UserPortfolios[0].Symbols.Split(new char[] { ',' }).ToList()) { Dock = DockStyle.Fill }; gridsDataAssets.Insert(0, gridDataAll); tabAll.Controls.Add(gridDataAll); } } catch (Exception ex) { Telerik.WinControls.RadMessageBox.Show(ex.Message); } }
/* * public void LoadGridDataAssetsAll() * { * GridDataAssets gridDataAssets = new GridDataAssets(this, AllAssets) { Dock = DockStyle.Fill, DisableOrderAssets = false }; * * DocumentWindow tabAll = new DocumentWindow * { * DocumentButtons = DocumentStripButtons.ActiveWindowList, * Name = "All", * Text = Program.LanguageDefault.DictionarySelectTools["tabAll"] * }; * * tabAll.Controls.Add(gridDataAssets); * * documentTabStrip1.Controls.Add(tabAll); * } * * private void ReloadAll() * { * if (File.Exists(ListAssets.Instance().Path)) * _allAssets = ListAssets.Instance().LoadListAssets(ListAssets.Instance().Path); * * AllAssets.Clear(); * * foreach (var assets in _allAssets) * AllAssets.Add(assets.Symbol); * * for (int i = 0; i < documentTabStrip1.Controls.Count; i++) * { * if ((!documentTabStrip1.Controls[i].Name.Equals("All")) || (!documentTabStrip1.Controls[i].Name.Equals("TODOS"))) * continue; * * GridDataAssets gridDataAssets = (GridDataAssets)documentTabStrip1.Controls[i].Controls[0]; * gridDataAssets.DisableOrderAssets = false; * gridDataAssets.AssetList = AllAssets; * gridDataAssets.AllAssets = ListAssets.Instance().LoadListAssets(ListAssets.Instance().Path); * * Invoke((MethodInvoker)(gridDataAssets.LoadTable)); * } * } */ public void CreatePortfolioTab(/*string portfolio*/) { try { UserPortfolios = frmMain2.GetUserPortfolios(); } catch (Exception ex) { Console.WriteLine(ex.Message); } //List<GridDataAssets> dataAssetses = new List<GridDataAssets>(); List <GridDataAssetsRT> dataAssetses = new List <GridDataAssetsRT>(); foreach (SymbolGroup p in UserPortfolios) { bool port = documentTabStrip1.Controls.Cast <DocumentWindow>().Any(control => control.Name.Equals("tab" + p.Name)); if (port) { continue; } //GridDataAssets dataAssets = new GridDataAssets(this, p.Symbols.ToList()) { Dock = DockStyle.Fill, DisableOrderAssets = true, NamePort = p.Name }; GridDataAssetsRT dataAssets = new GridDataAssetsRT(this, p.Symbols.Split(new char[] { ',' }).ToList()) { Dock = DockStyle.Fill }; dataAssetses.Add(dataAssets); DocumentWindow tabPage; if (p.Name.ToUpper() == "ALL") { tabPage = new DocumentWindow { DocumentButtons = DocumentStripButtons.ActiveWindowList, Name = "tabAll", Text = Program.LanguageDefault.DictionarySelectTools["tabAll"] }; } else { tabPage = new DocumentWindow { DocumentButtons = DocumentStripButtons.ActiveWindowList, Name = "tab" + p.Name.Trim(), Text = p.Name }; } tabPage.Controls.Add(dataAssets); if (InvokeRequired) { Invoke(new Action(() => documentTabStrip1.Controls.Add(tabPage))); } else { documentTabStrip1.Controls.Add(tabPage); } } }