private void BindOpenedTablesAliasToRepeater() { ArrayList aliasList = new ArrayList(); ITableEnumerator iEnum = MapInfo.Engine.Session.Current.Catalog.EnumerateTables(); while (iEnum.MoveNext()) { aliasList.Add(iEnum.Current.Alias); } Repeater1.DataSource = aliasList; Repeater1.DataBind(); }
private void button2_Click(object sender, System.EventArgs e) { int n = 0; Table [] tables = null; ITableEnumerator tenum = Session.Current.Catalog.EnumerateTables(TableFilterFactory.FilterMappableTables()); while (tenum.MoveNext()) { n++; } tables = new Table[n]; n = 0; foreach (Table t in tenum) { tables[n++] = t; } NewMapDlg dlg; if (n > 0) { dlg = new NewMapDlg(tables); if (dlg.ShowDialog() == DialogResult.OK) { // build map using MapTableLoader tables = dlg.SelectedTables; n = dlg.SelectionCount; } else { return; } } // now build map from tables if any Map m; if (n == 0) { m = Session.Current.MapFactory.CreateEmptyMap(null, null, IntPtr.Zero, mapControl1.Size); } else { m = Session.Current.MapFactory.Create(IntPtr.Zero, mapControl1.Size, new MapTableLoader(tables)); } SetMap(m); UpdateMapComboBox(); }
private void mnuCloseTable_Click(object sender, System.EventArgs e) { Catalog catalog = Session.Current.Catalog; ITableEnumerator tables = catalog.EnumerateTables(); ArrayList tablesList = new ArrayList(); while (tables.MoveNext()) { tablesList.Add(tables.Current); } CloseTableDlg closeTableDlg = new CloseTableDlg(); closeTableDlg.Items.AddRange(tablesList); closeTableDlg.SelectedIndex = 0; if (closeTableDlg.ShowDialog() == DialogResult.OK) { ArrayList selectedTables = closeTableDlg.SelectedItems; IEnumerator tableToClose = selectedTables.GetEnumerator(); while (tableToClose.MoveNext()) { catalog.CloseTable(((MapInfo.Data.Table)tableToClose.Current).Alias); } // if all the tables were closed, reset the menus if (tablesList.Count == selectedTables.Count) { // remove the layers from the map so that theme layers get removed RemoveAllMapLayers(); mnuCloseTable.Enabled = false; mnuCloseAll.Enabled = false; mnuTheme.Enabled = false; mnuAddTheme.Enabled = false; mnuRemoveTheme.Enabled = false; mnuModifyTheme.Enabled = false; } } }