Beispiel #1
0
        public ProjectMetadataScreen()
        {
            Logger.WriteEvent("ProjectMetadataScreen constructor");

            InitializeComponent();

            // position the Description and Vernacular label correctly
            var rowHeight = _tableLayout.GetRowHeights()[0];

            _tableLayout.RowStyles[2].SizeType = SizeType.Absolute;
            _tableLayout.RowStyles[2].Height   = rowHeight;
            _tableLayout.RowStyles[4].SizeType = SizeType.Absolute;
            _tableLayout.RowStyles[4].Height   = rowHeight;

            // continent list
            var continentList = ListConstructor.GetClosedList(ListType.Continents, true, ListConstructor.RemoveUnknown.RemoveAll);

            _continent.DataSource    = continentList;
            _continent.DisplayMember = "Text";
            _continent.ValueMember   = "Value";
            SizeContinentComboBox(_continent);

            // Data-binding doesn't work correctly for country  because it is an open list.
            // Items populated in HandleStringsLocalized.
            _countryList = ListConstructor.GetList(ListType.Countries, false, Localize, ListConstructor.RemoveUnknown.RemoveAll);

            _linkHelp.Click += (s, e) =>
                               Program.ShowHelpTopic("/User_Interface/Tabs/About_This_Project_User_Interface_terms.htm");
        }
Beispiel #2
0
        private void AddDropdownCell(string listType, int row)
        {
            var list = ListConstructor.GetList(listType, true, Localize, ListConstructor.RemoveUnknown.RemoveAll);

            var currentValue = _gridAdditionalFields[1, row].Value.ToString();

            if (list.FindByValue(currentValue) == null)
            {
                currentValue = string.Empty;
                _gridAdditionalFields[1, row].Value = currentValue;
            }

            var cell = new DataGridViewComboBoxCell
            {
                DataSource    = list,
                DisplayMember = "Text",
                ValueMember   = "Value",
                Value         = currentValue,
                FlatStyle     = FlatStyle.Flat
            };

            _gridAdditionalFields[1, row] = cell;

            // Added Application.DoEvents() because it was interferring with the background
            // file processor if it needed to download the list files.
            Application.DoEvents();
        }
        public void GetClosedList_RemoveAll_ReturnNone()
        {
            var countries = ListConstructor.GetClosedList(ListType.Countries, true, ListConstructor.RemoveUnknown.RemoveAll);

            Assert.IsNull(countries.FindByText("Unknown"));
            Assert.IsNull(countries.FindByText("Unspecified"));
            Assert.IsNull(countries.FindByText("Undefined"));
        }
        public void GetList_LeaveUnknown_ReturnUnspecified()
        {
            var countries = ListConstructor.GetList(ListType.Countries, true, null, ListConstructor.RemoveUnknown.LeaveUnknown);

            Assert.NotNull(countries.FindByText("Unknown"));
            Assert.IsNull(countries.FindByText("Unspecified"));
            Assert.IsNull(countries.FindByText("Undefined"));
        }
Beispiel #5
0
        public void ThrowOnGetElementTypeOfInvalidCollectionType(Type collectionType)
        {
            // Arrange
            var ctor = new ListConstructor();

            // Act, Assert
            Assert.Throws <NotSupportedException>(() => ctor.GetElementType(collectionType));
        }
Beispiel #6
0
        public void GetElementTypeOfValidCollectionType(Type collectionType, Type elementType)
        {
            // Arrange
            var ctor = new ListConstructor();

            // Act
            var actual = ctor.GetElementType(collectionType);

            // Assert
            Assert.Equal(elementType, actual);
        }
        public static PersistenceSpecification <T> CheckProperty <T, TProperty>(this PersistenceSpecification <T> spec,
                                                                                Expression <Func <T, TProperty> > expression,
                                                                                TProperty propertyValue,
                                                                                IEqualityComparer propertyComparer)
        {
            Accessor property = ReflectionHelper.GetAccessor(expression);

            if (typeof(TProperty).IsArray)
            {
                // Func matching return value as TProperty is more specific than matching Array or TListElement[],
                // so have to use reflection in array case instead of relying on generic matching.
                return(spec.RegisterCheckedProperty(ListConstructor <T, TProperty> .Create(property, propertyValue), propertyComparer));
            }
            else
            {
                return(spec.RegisterCheckedProperty(new Property <T, TProperty>(property, propertyValue), propertyComparer));
            }
        }