Exemplo n.º 1
0
        private void LoadColumnDefs()
        {
            ExtraColumns = new List <ExtraColumnDef>();
            string configFileName = GetConfigFilePath("ColumnDefs.txt");

            if (File.Exists(configFileName))
            {
                using (TextReader reader = new StreamReader(configFileName))
                {
                    for (;;)
                    {
                        string line = reader.ReadLine();
                        if (line == null)
                        {
                            break;
                        }
                        int colonIndex = line.IndexOf(":");
                        if (colonIndex > 0)
                        {
                            int columnWidth;
                            if (int.TryParse(line.Substring(colonIndex + 1).Trim(), out columnWidth))
                            {
                                ExtraColumnDef extraDef = new ExtraColumnDef(line.Substring(0, colonIndex).Trim(), columnWidth);
                                ExtraColumns.Add(extraDef);
                            }
                        }
                        else
                        {
                            MessageBox.Show("Column definition error for folder \"" + LabelText + "\": All lines must be <field name>:<width>");
                        }
                    }
                }
            }
            else
            {
                ExtraColumns.Add(new ExtraColumnDef("Assigned To", 110));
                ExtraColumns.Add(new ExtraColumnDef("Due Date", 110));
                ExtraColumns.Add(new ExtraColumnDef("Created On", 110));
                ExtraColumns.Add(new ExtraColumnDef("Updated On", 110));
            }
        }
 public XmlColumnConverter(ExtraColumnDef columnDef)
 {
     m_ColumnDef = columnDef;
     m_XPath     = (columnDef.xPath != null ? columnDef.xPath : String.Empty);
 }
 private IDataColumnConverter CreateColumnConverter(ExtraColumnDef columnDef)
 {
     return(new XmlColumnConverter(columnDef));
 }