private void СортироватьToolStripMenuItem_DropDownItemClicked(object sender, ToolStripItemClickedEventArgs e) { ToolStripMenuItem Clickeditem = e.ClickedItem as ToolStripMenuItem; if (sender is ToolStripMenuItem item) { int index = (item).DropDownItems.IndexOf(Clickeditem); SortIndex = index; TabPage tabPage = LayoutTemplates.GetTabPage(index); tabControl1.TabPages.Clear(); tabControl1.Controls.Add(tabPage); } else { MessageBox.Show("Error"); } }
private async void MainForm_Load(object sender, EventArgs e) { Form l = new LoadingOptions(); l.ShowDialog(); Company.SectortsPath = ConfigurationManager.AppSettings["SectorsListPath"]; Company[] c; if (isParallelEnabled) { loadScreen = new LoadingScreen(); loadScreen.Show(); loadingInProgress = true; c = await GetCompaniesAsync(); loadingInProgress = false; } else { loadScreen = new LoadingScreen(); loadScreen.Show(); loadingInProgress = true; c = await Task.Run(() => GetCompanies()); loadingInProgress = false; } UserConfigOperator.InitializeFields(c); LayoutTemplates.companies = c; this.сортироватьToolStripMenuItem.DropDownItems.AddRange(LayoutTemplates.GetSortMethodsList()); TabPage tabPage = LayoutTemplates.GetTabPage(SortIndex); tabControl1.Controls.Add(tabPage); this.Enabled = true; loadScreen.Close(); loadScreen.Dispose(); }
public void RefreshPage() { tabControl1.TabPages.Remove(tabControl1.TabPages[0]); tabControl1.TabPages.Add(LayoutTemplates.GetTabPage(SortIndex)); }