Exemple #1
0
        private void загрузитьЗадачуToolStripMenuItem_Click(object sender, EventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();

            openFileDialog.Filter           = "txt files (*.txt)|*.txt|All files (*.*)|*.*";
            openFileDialog.FilterIndex      = 2;
            openFileDialog.RestoreDirectory = true;

            if (openFileDialog.ShowDialog() != DialogResult.OK)
            {
                return;
            }
            StreamReader SR = new StreamReader(openFileDialog.OpenFile());

            textBoxEqvNum.Text = SR.ReadLine();;
            textBoxVarNum.Text = SR.ReadLine();

            int i = 0, j = 0;

            for (i = 0; i < DataGridMain.ColumnCount; i++)
            {
                for (j = 0; j < DataGridMain.RowCount - 1; j++)
                {
                    DataGridMain[i, j].Value = SR.ReadLine();
                }
            }

            DataGridMain.Refresh();
            SR.Close();
        }
Exemple #2
0
        private void экспортИзБазыДанныхToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Database databaseSQLite = new Database();
            LoadMenu loadMenu       = new LoadMenu();

            loadMenu.indexSave = 3;
            loadMenu.ShowDialog();
            //OpenFileDialog openFileDialog = new OpenFileDialog();
            //openFileDialog.Filter = "txt files (*.txt)|*.txt|All files (*.*)|*.*";
            //openFileDialog.FilterIndex = 2;
            //openFileDialog.RestoreDirectory = true;

            //if (openFileDialog.ShowDialog() != DialogResult.OK) return;
            if (loadMenu.fileName != null)
            {
                string query = "select File from SaveLinearSystemTask where Name=" + "\"" + loadMenu.fileName + "\"";
                databaseSQLite.OpenConnection();
                SQLiteCommand myCommand = new SQLiteCommand(query, databaseSQLite.myConnection);
                using (SQLiteDataReader reader = myCommand.ExecuteReader())
                {
                    if (reader.HasRows)       // если есть данные
                    {
                        while (reader.Read()) // построчно считываем данные
                        {
                            string data = (string)reader.GetValue(0);
                            File.WriteAllText("temp.txt", data);
                        }
                    }
                }
                databaseSQLite.CloseConnection();
                StreamReader SR = new StreamReader("temp.txt");

                textBoxEqvNum.Text = SR.ReadLine();;
                textBoxVarNum.Text = SR.ReadLine();

                int i = 0, j = 0;
                for (i = 0; i < DataGridMain.ColumnCount; i++)
                {
                    for (j = 0; j < DataGridMain.RowCount - 1; j++)
                    {
                        DataGridMain[i, j].Value = SR.ReadLine();
                    }
                }

                DataGridMain.Refresh();
                SR.Close();
            }
        }
Exemple #3
0
        private void BindGrid()
        {
            var dgBinding = new Binding()
            {
                Source = Library,
                Mode   = BindingMode.OneWay
            };

            DataGridMain.SetBinding(ItemsControl.ItemsSourceProperty, dgBinding);

            #region Create Datagrid columns

            if (!_initGrid)
            {
                DataGridMain.AutoGenerateColumns = false;

                DataGridMain.Columns.Add(new DataGridTextColumn()
                {
                    Binding = new Binding("Name")
                    {
                        Mode = BindingMode.OneWay
                    },
                    Header = "Name"
                });

                //DataGridMain.Columns.Add(new DataGridTextColumn()
                //{
                //	Binding = new Binding("Title") { Mode = BindingMode.OneWay },
                //	Header = "Title"
                //});

                DataGridMain.Columns.Add(new DataGridTextColumn()
                {
                    Binding = new Binding("PlaylistPath")
                    {
                        Mode = BindingMode.OneWay
                    },
                    Header = "Path"
                });

                DataGridMain.Columns.Add(new DataGridCheckBoxColumn()
                {
                    Binding = new Binding("Process")
                    {
                        Mode = BindingMode.TwoWay
                    },
                    Header = CreateHeader("Extract", "Extract playlist items")
                });

                DataGridMain.Columns.Add(new DataGridCheckBoxColumn()
                {
                    Binding = new Binding("WillRepair")
                    {
                        Mode = BindingMode.TwoWay
                    },
                    Header = CreateHeader("Repair", "Repair playlist from invalid path items")
                });

                _initGrid = true;
            }

            #endregion
        }