Exemplo n.º 1
0
 public FormResultQuery(MySQLWorker mySQL, string mySQLCommand)
 {
     InitializeComponent();
     MySQL                     = mySQL;
     MySQLCommand              = mySQLCommand;
     dgvConstructor.RowsAdded += DgvConstructor_RowsAdded;
     dgvConstructor.Resize    += DgvConstructor_Resize;
     dgvConstructor.ColumnHeadersHeightSizeModeChanged += DgvConstructor_ColumnHeadersHeightSizeModeChanged;
 }
Exemplo n.º 2
0
        private void DownloadFromDbData(MySQLWorker MySQL)
        {
            this.MySQL = MySQL;
            tablesInForm.Clear();
            RelationshipsDrawer.relationships.Clear();
            MySQL.Connection();
            List <string> tableNames         = MySQL.GetTableNames();
            int           startPointMod      = 0;
            List <NamesAndCoordinates> names = null;

            if (File.Exists("Constructor/" + MySQL.Db + ".json"))
            {
                StreamReader sr   = new StreamReader(File.OpenRead("Constructor/" + MySQL.Db + ".json"));
                string       json = sr.ReadToEnd();
                sr.Close();
                names = JsonSerializer.Deserialize <List <NamesAndCoordinates> >(json);
            }
            foreach (string table in tableNames)
            {
                List <Field>   fields     = MySQL.GetFieldsInTable(table);
                Point          startPoint = GetStartPoint(startPointMod, names, table);
                TableInDiagram tID        = new TableInDiagram(startPoint, table, fields, new List <string>());
                tablesInForm.Add(tID);
                startPointMod++;
                this.Invoke(new Action(() =>
                {
                    sLabel.Text = "Обработка таблицы " + table + " " + startPointMod + " из " + tableNames.Count + 1;
                }));
            }
            RelationshipsDrawer.tables        = tablesInForm;
            RelationshipsDrawer.relationships = MySQL.GetRelationships(tableNames);
            pbDiagram.Invalidate();
            this.Invoke(new Action(() =>
            {
                vsbDiagram.Value = 0;
                sLabel.Text      = "Загрузка из БД завершена успешно";
            }));
        }