Esempio n. 1
0
        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();
        }
Esempio n. 2
0
        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();
        }