/// <summary>
        /// Textarea is cleared and enabled,
        /// does not check if there already is text possible to be saved,
        /// calls OpenReadFile in ReadWriteDialog class.
        /// Does not check if there already is text that might be saved prior opening new file.
        /// </summary>
        public void Open()
        {
            //window.text.Document.Blocks.Clear();
            EnableEditing();
            //string contents;
            try
            {
                textForGrid = ReadWriteDialog.OpenReadCSVFile(window, out fileName);


                //window.text.AppendText(text);
                window.Title = fileName;

                var source = new BindingSource();

                //ObservableCollection<Data> list = new ObservableCollection<Data> { };
                List <Data> list = new List <Data>();

                int i = 0;
                foreach (var v in textForGrid)
                {
                    list.Add(new Data(textForGrid[i][0], textForGrid[i][1], textForGrid[i][2]));
                }
                source.DataSource            = list;
                window.dataGrid1.ItemsSource = source;
            }
            catch (Exception e)
            {
                System.Windows.MessageBox.Show(e.ToString());
            }
        }
示例#2
0
        public void Open()
        {
            EnableEditing();

            try
            {
                textForGrid = ReadWriteDialog.OpenReadCSVFile(window, out fileName);
                data.gridFill(window, textForGrid);
                window.Title = fileName;
            }
            catch (Exception e)
            {
                System.Windows.MessageBox.Show(e.ToString());
            }
        }