Exemplo n.º 1
0
        public Shell(string filename) : base(0, 0, Application.Cols, Application.Lines)
        {
            string connectionString;

            tables = new TablesList();

            connectionString = "URI=file:" + filename;
            dbConnection     = (IDbConnection) new SqliteConnection(connectionString);
            dbConnection.Open();
            command             = dbConnection.CreateCommand();
            sql                 = "SELECT name FROM sqlite_master WHERE type='table' ORDER BY name";
            command.CommandText = sql;
            reader              = command.ExecuteReader();
            while (reader.Read())
            {
                tables.Add(reader.GetString(0));
            }
            currentTable = tables.items [0];

            Frame tablesFrame = new Frame("Tables");

            Add(tablesFrame);

            tablesFrame.x = 0;
            tablesFrame.y = 0;

            tablesFrame.w = TABLES_WIDTH;
            tablesFrame.h = Application.Lines;

            tables_view = new ListView(1, 1, 1, tables.Items, tables);
            tablesFrame.Add(tables_view);

            recordsFrame   = new Frame("Records");
            recordsFrame.x = TABLES_WIDTH;
            recordsFrame.y = 0;
            recordsFrame.w = Application.Cols - TABLES_WIDTH - 1;
            recordsFrame.h = Application.Lines;
            Add(recordsFrame);

            UpdateRecordsView();

            tables.newSel += new TablesList.TableSelectionChanged(UpdateRecordsForNewSelectedTable);
        }
Exemplo n.º 2
0
 private void UpdateRecordsForNewSelectedTable(TablesList t, EventArgs e)
 {
     currentTable = t.items[tables_view.Selected];
     UpdateRecordsView();
 }