Пример #1
0
 private static void ConfigItem(DataItems.DescEnum d,
                                string title1, string title2,
                                RevisionDataDisplay display)
 {
     d.Display = display;
     ConfigItem((DataItems.RootEnum)d, title1, title2);
 }
Пример #2
0
        // this is the formatted item placed into
        // a left / center / right padded space
        // exactly ColWidth in size
        // and then the margins are added to
        // the left / right sides resp.
        public static string FormatForColumn(string value,
                                             RevisionDataDisplay dd,
                                             char left = ' ', char right = ' ',
                                             RevisionMetaData.Justification justification = RevisionMetaData.Justification.UNDEFINED)
        {
            if (string.IsNullOrWhiteSpace(value))
            {
                value = "";
            }

            string formatted;

            formatted = Abbreviate(value, dd.ColWidth, '…');

            if (justification == RevisionMetaData.Justification.UNDEFINED)
            {
                formatted = Justify(formatted, dd.JustifyColumn, dd.ColWidth, left, right);
            }
            else
            {
                formatted = Justify(formatted, justification, dd.ColWidth, left, right);
            }

            formatted = ApplyMargin(formatted, dd.MarginLeft,
                                    dd.MarginRight, left, right);

            return(formatted);
        }
Пример #3
0
 private static void ConfigItem(DataItems.DataEnum i,
                                string title1, string title2,
                                EFieldSource source, RevisionDataDisplay display)
 {
     i.Source  = source;
     i.Display = display;
     ConfigItem((DataItems.RootEnum)i, title1, title2);
 }
Пример #4
0
        // this is the formatted item placed into
        // a left / center / right padded space
        // exactly KeyWidth in size
        // this gets no margins
        public static string FormatForKey(dynamic data, RevisionDataDisplay dd)
        {
            if (data == null)
            {
                return(null);
            }

            string formatted = Abbreviate(Format(data, dd.FormatString),
                                          dd.KeyWidth, (char)0);

            formatted = Justify(formatted, dd.JustifyColumn, dd.KeyWidth);

            return(formatted);
        }
Пример #5
0
 public static string Format(dynamic data, RevisionDataDisplay dd)
 {
     return(Format(data, dd.FormatString));
 }