Esempio n. 1
0
        private void OnRowValuesChanged()
        {
            if (AssociatedObject == null)
            {
                return;
            }
            if (RowValues == null)
            {
                return;
            }
            _journalDataTable = RowValues;

            AssociatedObject.Columns.Clear();

            int index = 0;

            if (IsTransponed)
            {
                if (_journalDataTable.IsBaseNumeration && _journalDataTable.RowHeadersStrings != null)
                {
                    AssociatedObject.Columns.Add(CreateGridTemplateColumn(index++, "#"));
                }

                AssociatedObject.Columns.Add(CreateGridTemplateColumn(index++, ""));
                if (_journalDataTable.RowHeadersStrings != null)
                {
                    foreach (string rowHeadersString in _journalDataTable.RowHeadersStrings)
                    {
                        AssociatedObject.Columns.Add(CreateGridTemplateColumn(index, rowHeadersString));
                        index++;
                    }
                }
            }
            else
            {
                if (_journalDataTable.RowHeadersStrings != null)
                {
                    AssociatedObject.Columns.Add(CreateGridTemplateColumn(index++, ""));
                }

                if ((_journalDataTable.ColumnNamesStrings != null) && (_journalDataTable.IsBaseNumeration))
                {
                    AssociatedObject.Columns.Add(CreateGridTemplateColumn(index++, "№"));
                }

                if (_journalDataTable.ColumnNamesStrings != null)
                {
                    foreach (string columnName in _journalDataTable.ColumnNamesStrings)
                    {
                        AssociatedObject.Columns.Add(CreateGridTemplateColumn(index, columnName));
                        index++;
                    }
                }
            }

            _journalDataTable.TableUpdateAction = OnRowValuesChanged;
        }
Esempio n. 2
0
        private void OnRowValuesChanged()
        {
            if (AssociatedObject == null)
            {
                return;
            }
            if (RowValues == null)
            {
                return;
            }
            _journalDataTable = RowValues;


            if (IsTransponed)
            {
                if (_journalDataTable.ColumnNamesStrings != null)
                {
                    _collection = new ObservableCollection <List <ILocalAndDeviceValueContainingViewModel> >();

                    int rowIndex = 0;
                    foreach (string columnNameString in _journalDataTable.ColumnNamesStrings)
                    {
                        List <ILocalAndDeviceValueContainingViewModel> localAndDeviceValueContainingViewModels =
                            new List <ILocalAndDeviceValueContainingViewModel>();
                        _journalDataTable.Values.ForEach((list =>
                        {
                            if (list.Count > rowIndex)
                            {
                                localAndDeviceValueContainingViewModels.Add(list[rowIndex]);
                            }
                        }));

                        rowIndex++;
                        InsertRow(localAndDeviceValueContainingViewModels);
                    }
                }

                AssociatedObject.ItemsSource = _collection;
            }
            else
            {
                _collection = new ObservableCollection <List <ILocalAndDeviceValueContainingViewModel> >();

                AssociatedObject.ItemsSource = _collection;
                _journalDataTable.Values.ForEach((list => { InsertRow(list); }));
            }

            _journalDataTable.FormattedValueViewModelAddedAction = InsertRow;
            _journalDataTable.TableUpdateAction = OnRowValuesChanged;
        }
        private void OnRowValuesChanged()
        {
            if (AssociatedObject == null)
            {
                return;
            }
            if (RowValues == null)
            {
                return;
            }
            _journalDataTable = RowValues;

            AssociatedObject.Columns.Clear();

            int index = 0;

            if (IsTransponed)
            {
                if (_journalDataTable.IsBaseNumeration && _journalDataTable.RowHeadersStrings != null)
                {
                    AssociatedObject.Columns.Add(CreateGridTemplateColumn(index++, "#"));
                }

                AssociatedObject.Columns.Add(CreateGridTemplateColumn(index++, ""));
                if (_journalDataTable.RowHeadersStrings != null)
                {
                    foreach (string rowHeadersString in _journalDataTable.RowHeadersStrings)
                    {
                        AssociatedObject.Columns.Add(CreateGridTemplateColumn(index, rowHeadersString));
                        index++;
                    }
                }


                if (_journalDataTable.ColumnNamesStrings != null)
                {
                    _collection = new ObservableCollection <List <ILocalAndDeviceValueContainingViewModel> >();

                    int rowIndex = 0;
                    foreach (string columnNameString in _journalDataTable.ColumnNamesStrings)
                    {
                        List <ILocalAndDeviceValueContainingViewModel> localAndDeviceValueContainingViewModels =
                            new List <ILocalAndDeviceValueContainingViewModel>();
                        _journalDataTable.Values.ForEach((list =>
                        {
                            if (list.Count > rowIndex)
                            {
                                localAndDeviceValueContainingViewModels.Add(list[rowIndex]);
                            }
                        }));

                        rowIndex++;
                        InsertRow(localAndDeviceValueContainingViewModels);
                    }
                }

                AssociatedObject.ItemsSource = _collection;
            }
            else
            {
                if (_journalDataTable.RowHeadersStrings != null)
                {
                    AssociatedObject.Columns.Add(CreateGridTemplateColumn(index++, ""));
                }

                if ((_journalDataTable.ColumnNamesStrings != null) && (_journalDataTable.IsBaseNumeration))
                {
                    AssociatedObject.Columns.Add(CreateGridTemplateColumn(index++, "№"));
                }

                if (_journalDataTable.ColumnNamesStrings != null)
                {
                    foreach (string columnName in _journalDataTable.ColumnNamesStrings)
                    {
                        AssociatedObject.Columns.Add(CreateGridTemplateColumn(index, columnName));
                        index++;
                    }
                }

                _collection = new ObservableCollection <List <ILocalAndDeviceValueContainingViewModel> >();

                AssociatedObject.ItemsSource = _collection;
                _journalDataTable.Values.ForEach((list => { InsertRow(list); }));
            }

            _journalDataTable.FormattedValueViewModelAddedAction = InsertRow;
            _journalDataTable.TableUpdateAction = OnRowValuesChanged;
        }