예제 #1
0
        public MainWindow()
        {
            InitializeComponent();

            try
            {
                DataStructure loadedDS = DataStructure.LoadDataStructure(Properties.Settings.Default.DataStructureFileLocation);
                if (loadedDS.ErrorExists)
                {
                    MessageBox.Show(loadedDS.GetErrorLogs(), Properties.Resources.Message_DataStructureParseError_Caption);
                }
                else
                {
                    foreach (Field field in loadedDS.GetTableFields())
                    {
                        DataGridTextColumn textColumn = new DataGridTextColumn();
                        textColumn.Header  = field.Name;
                        textColumn.Binding = new Binding(field.Id);
                        dataGrid.Columns.Add(textColumn);
                    }

                    Data.LoadData();
                    dataGrid.ItemsSource = Data.GetAllData();
                }
            }
            catch (Exception e)
            {
                MessageBox.Show(this, Properties.Resources.Message_CouldNotLoadDataStructure_Text, Properties.Resources.Message_CouldNotLoadDataStructure_Caption);
            }
        }