Esempio n. 1
0
File: GUI.cs Progetto: odasm/rMOD
        private void loadSQLBtn_Click(object sender, EventArgs e)
        {
            if (RDBControls.StructureListIndex != -1)
            {
                string tableName = null;
                using (InputGUI input = new InputGUI("Please enter the table name", StructureManager.TableName(RDBControls.StructureListValue)))
                {
                    if (input.ShowDialog() != DialogResult.OK)
                    {
                        return;
                    }
                    if (string.IsNullOrEmpty(input.Value))
                    {
                        return;
                    }

                    tableName = input.Value;

                    tabs.TabPages[tabIdx].Text = tableName;

                    int rowCount = Database.FetchRowCount(tableName);

                    changeTabsState(false);
                    rCore.SetData(Database.FetchTable(rowCount, tableName));
                    Grid.LoadData(RDBControls.ColumnsSet);
                    tabs.TabPages[tabIdx].ToolTipText = string.Format("Table Name: {0}\nRows: {1}", tableName, rowCount);
                    disableStructureList();
                    changeTabsState(true);
                }
            }
            else
            {
                MessageBox.Show("You haven't loaded a Structure LUA yet!", "Notice", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
Esempio n. 2
0
File: GUI.cs Progetto: QstarLLC/rMOD
        async void saveSQLBtn_Click(object sender, EventArgs e)
        {
            if (TabControls.GridRows > 0)
            {
                string tableName = null;
                using (InputGUI input = new InputGUI("Please enter the table name", StructureManager.TableName(TabControls.StructureListValue)))
                {
                    input.ShowDialog();
                    tableName = input.Input;
                }

                if (!string.IsNullOrEmpty(tableName))
                {
                    UpdateStatusText("Saving to database...");
                    await Task.Run(() => { Database.ExportToTable(rCore.Data, tableName); });

                    UpdateStatusText("");
                }
            }
        }