Ejemplo n.º 1
0
        /// <summary>
        /// Shows the add layer window.
        /// </summary>
        /// <param name="sender">Sender that raised the event.</param>
        /// <param name="e">The event args.</param>
        public void ButtonClick(object sender, EventArgs e)
        {
            // check if it's a valid SpatiaLite layer
            using (OpenFileDialog fd = new OpenFileDialog
            {
                Title = Resources.OpenSpatialiteDatabase,
                Filter = Resources.SpatialiteDatabaseFilter
            })
            {
                if (fd.ShowDialog() == DialogResult.OK)
                {
                    string cs            = SqLiteHelper.GetSqLiteConnectionString(fd.FileName);
                    bool   isValidSchema = SpatiaLiteHelper.CheckSpatiaLiteSchema(cs);
                    if (!isValidSchema)
                    {
                        MessageBox.Show(string.Format(Resources.DatabaseNotValid, fd.FileName));
                        return;
                    }

                    using (FrmAddLayer frm = new FrmAddLayer(cs, App.Map))
                    {
                        frm.Show();
                    }
                }
            }
        }
Ejemplo n.º 2
0
        public void ButtonClick(object sender, EventArgs e)
        {
            //check if it's a valid SpatiaLite layer
            OpenFileDialog fd = new OpenFileDialog();

            fd.Title  = "Open SpatiaLite database";
            fd.Filter = "SpatiaLite database|*.sqlite";
            if (fd.ShowDialog() == DialogResult.OK)
            {
                string cs            = SQLiteHelper.GetSQLiteConnectionString(fd.FileName);
                bool   isValidSchema = SpatiaLiteHelper.CheckSpatiaLiteSchema(cs);
                if (!isValidSchema)
                {
                    MessageBox.Show("The database " + fd.FileName + " is not a valid SpatiaLite database. Table geometry_columns not found.");
                    return;
                }
                else
                {
                    frmAddLayer frm = new frmAddLayer(cs, App.Map);
                    frm.Show();
                }
            }
        }