Exemple #1
0
        private void open_Click(object sender, RoutedEventArgs e)
        {
            FileAccess.OpenDialog();

            if (Global.FileFound == true)                                                   // Get the selected file name and display in a TextBox
            {
                if (dataGrid.Items.Count != 0)                                              //check if datagrid currently has any data
                {
                    this.dataGrid.ItemsSource = null;                                       //delete contents of datagrid
                    GridFGV.grid.Clear();                                                   //remove contents of GridFGV accessor
                }
                string[] lines;
                FileAccess.ReadFile(Global.Filename, out lines);                             // Open document
                Global.Filesize = lines.Count();
                List cmds = new List();
                int  i    = 0;
                foreach (string line in lines)
                {
                    string[] entry;
                    entry = line.Split(',');                                                //convert comma seperated string to 1-d array
                    if (entry.Count() > 4)                                                  //check that the file has correct number of columns
                    {
                        textBox.Text = "Invalid file: number of columns not compatible";
                        break;
                    }
                    Grid_List.Add(entry[0], entry[1], entry[2]);

                    this.dataGrid.ItemsSource = GridFGV.grid;
                    i++;
                }
            }
        }
Exemple #2
0
 private void add_Click(object sender, RoutedEventArgs e)
 {
     Grid_List.Add(index.Text, command.Text, comment.Text);
     this.Close();
 }