コード例 #1
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();
        }
コード例 #2
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");
        }
コード例 #3
0
        public void GetList_RemoveAll_ReturnNone()
        {
            var countries = ListConstructor.GetList(ListType.Countries, true, null, ListConstructor.RemoveUnknown.RemoveAll);

            Assert.IsNull(countries.FindByText("Unknown"));
            Assert.IsNull(countries.FindByText("Unspecified"));
            Assert.IsNull(countries.FindByText("Undefined"));
        }