Пример #1
0
        private void SetRowValue(RowModel row, ColumnModel column, DataRow dic)
        {
            string val;
            var    key = column.Index.ToString();
            var    raw = row.LastRaw(column.Index);

            // Get first index of new line
            if (raw == null)
            {
                val = null;
            }
            else
            {
                if (raw.Length > 500)
                {
                    raw = raw.Substring(0, 500) + "...";
                }
                var newLine = raw.IndexOf('\n');
                if (newLine == 0)
                {
                    val = "...";
                }
                else if (newLine > 0)
                {
                    val = raw.Substring(0, newLine) + "...";
                }
                else
                {
                    val = raw;
                }
            }

            if (row.WillInsert)
            {
                dic[key + "_background"] = "New";
            }
            else if (row.WillDelete)
            {
                dic[key + "_background"] = "Deleted";
            }
            else if (row.IsModified(column.Index))
            {
                dic[key + "_background"] = "Modified";
            }
            else
            {
                dic[key + "_background"] = null;
            }

            if (val == null)
            {
                dic[key]            = "NULL";
                dic[key + "_color"] = "SecondaryTextBrush";
            }
            else
            {
                dic[key]            = val;
                dic[key + "_color"] = "CommonTextBrush";
            }
        }