Пример #1
0
        public AddOptimizationLibraryDlg(IEnumerable <OptimizationLibrary> libraries)
        {
            InitializeComponent();

            comboLibrary.Items.AddRange(libraries.Cast <object>().ToArray());
            ComboHelper.AutoSizeDropDown(comboLibrary);

            if (comboLibrary.Items.Count > 0)
            {
                comboLibrary.SelectedIndex = 0;
            }
        }
Пример #2
0
        public async Task <ActionResult> Edit(User user)
        {
            if (ModelState.IsValid)
            {
                db.Entry(user).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            ViewBag.UserTypeId = new SelectList(ComboHelper.GetUserTypeId(), "UserTypeId", "Description", user.UserTypeId);
            return(View(user));
        }
Пример #3
0
        private int ResetResultsCombo(List <string> listNames, ToolStripComboBox combo)
        {
            object selected = combo.SelectedItem;

            combo.Items.Clear();
            foreach (string name in listNames)
            {
                combo.Items.Add(name);
            }
            ComboHelper.AutoSizeDropDown(combo);
            return(selected != null?combo.Items.IndexOf(selected) : -1);
        }
Пример #4
0
        public ActionResult Create([Bind(Include = "CityId,Name,DepartamentsId")] City city)
        {
            if (ModelState.IsValid)
            {
                db.Cities.Add(city);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.DepartamentsId = new SelectList(ComboHelper.GetDepartaments(), "DepartamentsId", "Name");
            return(View());
        }
Пример #5
0
        public ImportIonMobilityFromSpectralLibraryDlg(IEnumerable <LibrarySpec> librarySpecs, CollisionalCrossSectionGridViewDriver gridViewDriver)
        {
            InitializeComponent();

            comboLibrary.Items.AddRange(librarySpecs.Cast <object>().ToArray());
            if ((comboLibrary.Items.Count == 1) && (Source == SpectralLibrarySource.settings))
            {
                comboLibrary.SelectedIndex = 0; // The obvious choice
            }
            ComboHelper.AutoSizeDropDown(comboLibrary);
            _gridViewDriver = gridViewDriver;
        }
Пример #6
0
        public ActionResult Create(User user)
        {
            if (ModelState.IsValid)
            {
                db.Users.Add(user);
                try
                {
                    db.SaveChanges();
                    UserHelper.UsersHelper.CreateUserASP(user.Email, "User");

                    if (user.PhotoFile != null)
                    {
                        var pic      = string.Empty;
                        var folder   = "~/Content/User";
                        var file     = string.Format("{0}.jpg", user.UserId);
                        var response = FilesHelper.UploadPhoto(user.PhotoFile, folder, file);

                        if (response)
                        {
                            pic        = string.Format("{0}/{1}", folder, file);
                            user.Photo = pic;
                        }
                    }
                    db.Entry(user).State = EntityState.Modified;
                    db.SaveChanges();
                    return(RedirectToAction("Index"));
                }
                catch (System.Exception ex)
                {
                    if (ex.InnerException != null &&
                        ex.InnerException.InnerException != null &&
                        ex.InnerException.InnerException.Message.Contains("_Index"))
                    {
                        ModelState.AddModelError(string.Empty, "Telefone ou email ja existentes !!");
                    }
                    else
                    {
                        ModelState.AddModelError(string.Empty, ex.Message);
                    }

                    ViewBag.CityId         = new SelectList(ComboHelper.GetCities(), "CityId", "Name", user.CityId);
                    ViewBag.CompanyId      = new SelectList(ComboHelper.GetCompanys(), "CompanyId", "Name", user.CompanyId);
                    ViewBag.DepartamentsId = new SelectList(ComboHelper.GetDepartaments(), "DepartamentsId", "Name", user.DepartamentsId);
                    return(View(user));
                }
            }

            ViewBag.CityId         = new SelectList(ComboHelper.GetCities(), "CityId", "Name", user.CityId);
            ViewBag.CompanyId      = new SelectList(ComboHelper.GetCompanys(), "CompanyId", "Name", user.CompanyId);
            ViewBag.DepartamentsId = new SelectList(ComboHelper.GetDepartaments(), "DepartamentsId", "Name", user.DepartamentsId);
            return(View(user));
        }
Пример #7
0
        private void UpdateToolbar()
        {
            if (_spectra == null || _spectra.Count < 2)
            {
                toolBar.Visible = false;
            }
            else
            {
                // Check to see if the list of files has changed.
                var listNames    = _spectra.Select(spectrum => spectrum.Identity).ToArray();
                var listExisting = new List <string>();
                foreach (var item in comboSpectrum.Items)
                {
                    listExisting.Add(item.ToString());
                }

                if (!ArrayUtil.EqualsDeep(listNames, listExisting))
                {
                    // If it has, update the list, trying to maintain selection, if possible.
                    object selected = comboSpectrum.SelectedItem;
                    // Unless the current selected index is the one matching the one currently
                    // in use by the precursor (zero), then try to stay viewing the in-use spectrum (zero)
                    int selectedIndex = comboSpectrum.SelectedIndex;

                    _inToolbarUpdate = true;
                    comboSpectrum.Items.Clear();
                    foreach (string name in listNames)
                    {
                        comboSpectrum.Items.Add(name);
                    }

                    if (selectedIndex == 0 || selected == null ||
                        comboSpectrum.Items.IndexOf(selected) == -1)
                    {
                        comboSpectrum.SelectedIndex = 0;
                    }
                    else
                    {
                        comboSpectrum.SelectedItem = selected;
                    }
                    _inToolbarUpdate = false;
                    ComboHelper.AutoSizeDropDown(comboSpectrum);
                }

                // Show the toolbar after updating the spectra
                if (!toolBar.Visible)
                {
                    toolBar.Visible = true;
                }
            }
            FireSelectedSpectrumChanged(false);
        }
Пример #8
0
        private void UpdateCombo()
        {
            var documentRetentionTimes = Document.Settings.DocumentRetentionTimes;
            var newItems = documentRetentionTimes.RetentionTimeSources.Values.Select(retentionTimeSource => new DataFileKey(retentionTimeSource)).ToArray();

            if (newItems.SequenceEqual(comboAlignAgainst.Items.Cast <DataFileKey>()))
            {
                return;
            }
            var selectedIndex = comboAlignAgainst.SelectedIndex;

            comboAlignAgainst.Items.Clear();
            comboAlignAgainst.Items.AddRange(newItems.Cast <object>().ToArray());
            ComboHelper.AutoSizeDropDown(comboAlignAgainst);
            bool updateRows = true;

            if (comboAlignAgainst.Items.Count > 0)
            {
                if (selectedIndex < 0)
                {
                    if (SkylineWindow.SelectedResultsIndex >= 0 && Document.Settings.HasResults)
                    {
                        var chromatogramSet =
                            Document.Settings.MeasuredResults.Chromatograms[SkylineWindow.SelectedResultsIndex];
                        foreach (var msDataFileInfo in chromatogramSet.MSDataFileInfos)
                        {
                            var retentionTimeSource = documentRetentionTimes.RetentionTimeSources.Find(msDataFileInfo);
                            if (retentionTimeSource == null)
                            {
                                continue;
                            }
                            selectedIndex =
                                newItems.IndexOf(
                                    dataFileKey => Equals(retentionTimeSource, dataFileKey.RetentionTimeSource));
                            break;
                        }
                    }
                }

                selectedIndex = Math.Min(comboAlignAgainst.Items.Count - 1,
                                         Math.Max(0, selectedIndex));
                if (comboAlignAgainst.SelectedIndex != selectedIndex)
                {
                    comboAlignAgainst.SelectedIndex = selectedIndex;
                    updateRows = false; // because the selection change will cause an update
                }
            }
            if (updateRows)
            {
                UpdateRows();
            }
        }
Пример #9
0
        public Material(List <string> textures, List <string> figures) : base(textures, figures)
        {
            modelGroupName       = ModelGroupName.Material;
            onlyBinaryProperties = false;
            noPrerequisite       = false;
            Runtime.Image emissiveTexture = new Runtime.Image
            {
                Uri = textures.Find(e => e.Contains("Emissive_Plane"))
            };
            Runtime.Image normalTexture = new Runtime.Image
            {
                Uri = textures.Find(e => e.Contains("Normal_Plane"))
            };
            Runtime.Image occlusionTexture = new Runtime.Image
            {
                Uri = textures.Find(e => e.Contains("Occlusion_Plane"))
            };
            usedTextures.Add(emissiveTexture);
            usedTextures.Add(normalTexture);
            usedTextures.Add(occlusionTexture);
            List <Vector3> planeNormals = new List <Vector3>()
            {
                new Vector3(0.0f, 0.0f, 1.0f),
                new Vector3(0.0f, 0.0f, 1.0f),
                new Vector3(0.0f, 0.0f, 1.0f),
                new Vector3(0.0f, 0.0f, 1.0f)
            };

            requiredProperty = new List <Property>
            {
                new Property(Propertyname.MetallicFactor, 0.0f),
                new Property(Propertyname.BaseColorFactor, new Vector4(0.2f, 0.2f, 0.2f, 1.0f)),
            };
            properties = new List <Property>
            {
                new Property(Propertyname.EmissiveFactor, new Vector3(1.0f, 1.0f, 1.0f)),
                new Property(Propertyname.EmissiveTexture, emissiveTexture),
                new Property(Propertyname.NormalTexture, normalTexture),
                new Property(Propertyname.Scale, 10.0f, Propertyname.NormalTexture),
                new Property(Propertyname.OcclusionTexture, occlusionTexture),
                new Property(Propertyname.Strength, 0.5f, Propertyname.OcclusionTexture)
            };
            specialProperties = new List <Property>
            {
                new Property(Propertyname.VertexNormal, planeNormals),
            };
            specialCombos.Add(ComboHelper.CustomComboCreation(
                                  properties.Find(e => e.name == Propertyname.EmissiveFactor),
                                  properties.Find(e => e.name == Propertyname.EmissiveTexture)));
            removeCombos.Add(ComboHelper.CustomComboCreation(
                                 properties.Find(e => e.name == Propertyname.EmissiveTexture)));
        }
Пример #10
0
        private void InitializeControl()
        {
            //// ShopID ComboBox
            //ComboHelper.AddDataToComboBox(this.shopIdComboBoxEdit, _result,
            //    SimInputData.InputName.StdStep, SimInputData.StdStepSchema.SHOP_ID, false);

            //if (this.shopIdComboBoxEdit.Properties.Items.Contains("ARRAY"))
            //    this.shopIdComboBoxEdit.SelectedIndex = this.shopIdComboBoxEdit.Properties.Items.IndexOf("ARRAY");

            //DateEdit Controls
            this.fromDateEdit.DateTime = ShopCalendar.SplitDate(_planStartTime.AddDays(-2));
            ComboHelper.ShiftName(this.shiftComboBoxEdit, _planStartTime);
        }
Пример #11
0
        private void frmUpdateUser_Load(object sender, EventArgs e)
        {
            ComboHelper.FillUserTypes(cmbSelectUserType);
            cmbSelectUserType.Focus();

            if (CurrentUser.UserID > 0)
            {
                cmbSelectUserType.SelectedValue = CurrentUser.UserType_ID;
                txtFullName.Text  = CurrentUser.FullName;
                txtContactNo.Text = CurrentUser.ContactNo;
                txtEmail.Text     = CurrentUser.Email;
                txtUsername.Text  = CurrentUser.UserName;
            }
        }
        public ActionResult Create(Company company)
        {
            if (ModelState.IsValid)
            {
                db.Companies.Add(company);
                try
                {
                    db.SaveChanges();

                    if (company.LogoFile != null)
                    {
                        var pic      = string.Empty;
                        var folder   = "~/Content/Logos";
                        var file     = string.Format("{0}.jpg", company.CompanyId);
                        var response = FilesHelper.UploadPhoto(company.LogoFile, folder, file);

                        if (response)
                        {
                            pic          = string.Format("{0}/{1}", folder, file);
                            company.Logo = pic;
                        }
                    }
                    db.Entry(company).State = EntityState.Modified;
                    db.SaveChanges();
                    return(RedirectToAction("Index"));
                }
                catch (System.Exception ex)
                {
                    if (ex.InnerException != null &&
                        ex.InnerException.InnerException != null &&
                        ex.InnerException.InnerException.Message.Contains("_Index"))
                    {
                        ModelState.AddModelError(string.Empty, "Não é possivel inserir Compania ou Telefone com o mesmo nome !!");
                    }
                    else
                    {
                        ModelState.AddModelError(string.Empty, ex.Message);
                    }

                    ViewBag.CityId         = new SelectList(ComboHelper.GetCities(), "CityId", "Name", company.CityId);
                    ViewBag.DepartamentsId = new SelectList(ComboHelper.GetDepartaments(), "DepartamentsId", "Name", company.DepartamentsId);
                    return(View(company));
                }
            }

            ViewBag.CityId         = new SelectList(ComboHelper.GetCities(), "CityId", "Name", company.CityId);
            ViewBag.DepartamentsId = new SelectList(ComboHelper.GetDepartaments(), "DepartamentsId", "Name", company.DepartamentsId);
            return(View(company));
        }
Пример #13
0
        // GET: Users/Edit/5
        public async Task <ActionResult> Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            User user = await db.Users.FindAsync(id);

            if (user == null)
            {
                return(HttpNotFound());
            }
            ViewBag.UserTypeId = new SelectList(ComboHelper.GetUserTypeId(), "UserTypeId", "Description", user.UserTypeId);
            return(View(user));
        }
Пример #14
0
        // GET: Cidade/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Cidade cidade = db.Cidades.Find(id);

            if (cidade == null)
            {
                return(HttpNotFound());
            }
            ViewBag.DepartamentoId = new SelectList(ComboHelper.GetDeparatementos(), "DepartamentoId", "Nome", cidade.DepartamentoId);
            return(View(cidade));
        }
Пример #15
0
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            var course = db.Courses.Find(id);

            if (course == null)
            {
                return(HttpNotFound());
            }
            ViewBag.DepartmentId = new SelectList(ComboHelper.GetDepartment(), "DepartmentId", "Name", course.DepartmentId);
            return(View(course));
        }
Пример #16
0
        // GET: Cities/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            City city = db.Cities.Find(id);

            if (city == null)
            {
                return(HttpNotFound());
            }
            ViewBag.DepartmentsId = new SelectList(ComboHelper.GetDepartments(), "DepartmentsId", "Name", city.DepartmentsId);
            return(View(city));
        }
Пример #17
0
 protected override void InitLayout()
 {
     base.InitLayout();
     if (!this.DesignMode && this.FillAtStartup)
     {
         this.Fill();
         if (this.AddEmptyValue)
         {
             DataView view = ComboHelper.GetComboValues(this.DataSet, "RADNIK", "IDRADNIK", "SPOJENOPREZIME", true, "<" + Deklarit.Resources.Resources.Empty + ">");
             this.DataSource    = null;
             this.DisplayMember = "Name";
             this.ValueMember   = "Id";
             this.DataSource    = view;
         }
     }
 }
Пример #18
0
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Department department = db.Departments.Find(id);

            if (department == null)
            {
                return(HttpNotFound());
            }

            ViewBag.UserId = new SelectList(ComboHelper.GetTeacher(), "UserId", "FullName", department.UserId);
            return(View(department));
        }
Пример #19
0
        // GET: Companies/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Company company = db.Companies.Find(id);

            if (company == null)
            {
                return(HttpNotFound());
            }
            ViewBag.CityId       = new SelectList(ComboHelper.getCities(), "CityId", "CitiesName", company.CityId);
            ViewBag.DepartmentId = new SelectList(ComboHelper.getDepartment(), "DepartmentId", "DepartmentName", company.DepartmentId);
            return(View(company));
        }
        // GET: Products/Edit/5
        public async Task <ActionResult> Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Product product = await this.db.Products.FindAsync(id);

            if (product == null)
            {
                return(HttpNotFound());
            }
            var ViewProduct = this.ToProduct(product);

            ViewBag.CategoryId = new SelectList(ComboHelper.GetCategories(), "CategoryId", "Description", product.CategoryId);
            return(View(ViewProduct));
        }
Пример #21
0
        public SchedulingOptionsDlg(SrmDocument document, Func<int, bool> canTriggerReplicate)
        {
            InitializeComponent();

            Icon = Resources.Skyline;

            _document = document;
            _canTriggerReplicate = canTriggerReplicate;

            foreach (var chromatogramSet in document.Settings.MeasuredResults.Chromatograms)
            {
                comboReplicateNames.Items.Add(chromatogramSet);
            }
            ComboHelper.AutoSizeDropDown(comboReplicateNames);

            radioSingleDataSet.Checked = !Settings.Default.ScheduleAvergeRT;
        }
Пример #22
0
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Group group = db.Groups.Find(id);

            if (group == null)
            {
                return(HttpNotFound());
            }

            ViewBag.CourseID = new SelectList(ComboHelper.GetCourse(), "CourseId", "Title", group.CourseID);
            ViewBag.UserId   = new SelectList(ComboHelper.GetTeacher(), "UserId", "FullName", group.UserId);
            return(View(group));
        }
Пример #23
0
        // GET: Products/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Product product = db.Products.Find(id);

            if (product == null)
            {
                return(HttpNotFound());
            }

            ViewBag.CategoryId = new SelectList(ComboHelper.GetCategories(product.CompanyId), "CategoryId", "Description", product.CategoryId);
            ViewBag.TaxId      = new SelectList(ComboHelper.GetTaxes(product.CompanyId), "TaxId", "Description", product.TaxId);
            return(View(product));
        }
Пример #24
0
        // GET: Users/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            User user = db.Users.Find(id);

            if (user == null)
            {
                return(HttpNotFound());
            }
            ViewBag.CityId        = new SelectList(ComboHelper.GetCities(), "CityId", "Name", user.CityId);
            ViewBag.CompanyId     = new SelectList(ComboHelper.GetCompanies(), "CompanyId", "Name", user.CompanyId);
            ViewBag.DepartmentsId = new SelectList(ComboHelper.GetDepartments(), "DepartmentsId", "Name", user.DepartmentsId);
            return(View(user));
        }
Пример #25
0
        public Material_MetallicRoughness(List <string> textures, List <string> figures) : base(textures, figures)
        {
            modelGroupName       = ModelGroupName.Material_MetallicRoughness;
            onlyBinaryProperties = false;
            Runtime.Image baseColorTexture = new Runtime.Image
            {
                Uri = textures.Find(e => e.Contains("BaseColor_Plane"))
            };
            Runtime.Image metallicRoughnessTexture = new Runtime.Image
            {
                Uri = textures.Find(e => e.Contains("MetallicRoughness_Plane"))
            };
            usedTextures.Add(baseColorTexture);
            usedTextures.Add(metallicRoughnessTexture);
            List <Vector4> colorCoord = new List <Vector4>()
            {
                new Vector4(0.0f, 0.0f, 1.0f, 0.8f),
                new Vector4(1.0f, 0.0f, 0.0f, 0.8f),
                new Vector4(0.0f, 0.0f, 1.0f, 0.8f),
                new Vector4(1.0f, 0.0f, 0.0f, 0.8f)
            };

            properties = new List <Property>
            {
                new Property(Propertyname.VertexColor_Vector3_Float, colorCoord, group: 2),
                new Property(Propertyname.BaseColorTexture, baseColorTexture),
                new Property(Propertyname.BaseColorFactor, new Vector4(0.2f, 0.2f, 0.2f, 0.8f)),
                new Property(Propertyname.MetallicFactor, 0.0f),
                new Property(Propertyname.RoughnessFactor, 0.0f),
                new Property(Propertyname.MetallicRoughnessTexture, metallicRoughnessTexture),
            };
            // Not called explicitly, but values are required here to run ApplySpecialProperties
            specialProperties = new List <Property>
            {
                new Property(Propertyname.VertexColor_Vector3_Float, colorCoord, group: 2),
            };
            specialCombos.Add(ComboHelper.CustomComboCreation(
                                  properties.Find(e => e.name == Propertyname.BaseColorFactor),
                                  properties.Find(e => e.name == Propertyname.BaseColorTexture)));
            specialCombos.Add(ComboHelper.CustomComboCreation(
                                  properties.Find(e => e.name == Propertyname.MetallicRoughnessTexture),
                                  properties.Find(e => e.name == Propertyname.MetallicFactor)));
            specialCombos.Add(ComboHelper.CustomComboCreation(
                                  properties.Find(e => e.name == Propertyname.MetallicRoughnessTexture),
                                  properties.Find(e => e.name == Propertyname.RoughnessFactor)));
        }
Пример #26
0
 protected override void InitLayout()
 {
     base.InitLayout();
     if (!this.DesignMode && this.FillAtStartup)
     {
         this.Fill();
         if (this.AddEmptyValue)
         {
             DataView view = ComboHelper.GetComboValues(this.DataSet, "PLVRSTEIZNOSA", "IDPLVRSTEIZNOSA", "NAZIVPLVRSTEIZNOSA", true, "<" + Deklarit.Resources.Resources.Empty + ">");
             this.DataSource    = null;
             view.Sort          = "Name";
             this.DisplayMember = "Name";
             this.ValueMember   = "Id";
             this.DataSource    = view;
         }
     }
 }
Пример #27
0
 public ActionResult Edit(Course course)
 {
     if (ModelState.IsValid)
     {
         try
         {
             db.Entry(course).State = EntityState.Modified;
             db.SaveChanges();
             return(RedirectToAction("Index"));
         }
         catch (Exception)
         {
             ModelState.AddModelError(string.Empty,
                                      "Se produjo un Error a la Hora de editar este curso");
         }
     }
     ViewBag.DepartmentId = new SelectList(ComboHelper.GetDepartment(), "DepartmentId", "Name", course.DepartmentId);
     return(View(course));
 }
        // GET: Products/Create
        public ActionResult Create()
        {
            var user = db
                       .Users
                       .Where(u => u.UserName == User.Identity.Name)
                       .FirstOrDefault();

            if (user == null)
            {
                return(RedirectToAction("Index", "Home"));
            }

            var view = new ProductView {
                UserId = user.UserId,
            };

            ViewBag.CategoryId = new SelectList(ComboHelper.GetCategories(), "CategoryId", "Description");
            return(View(view));
        }
Пример #29
0
        public ActionResult Create([Bind(Include = "ProductId,CompanyId,Description,BarCode,TaxId,CategoryId,Price,Image,Remarks")] Product product)
        {
            if (ModelState.IsValid)
            {
                db.Products.Add(product);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            var user = db.Users.Where(u => u.Email == User.Identity.Name).FirstOrDefault();

            if (user == null)
            {
                return(RedirectToAction("Index", "Home"));
            }

            ViewBag.CategoryId = new SelectList(ComboHelper.GetCategories(user.CompanyId), "CategoryId", "Description", product.CategoryId);
            ViewBag.TaxId      = new SelectList(ComboHelper.GetTaxes(user.CompanyId), "TaxId", "Description", product.TaxId);
            return(View(product));
        }
Пример #30
0
        public void LoadList(string selectedItemLast)
        {
            try
            {
                Combo.BeginUpdate();
                Combo.Items.Clear();
                foreach (TItem item in List.ToArrayStd())
                {
                    string name = List.GetDisplayName(item);
                    int    i    = Combo.Items.Add(name);
                    if (Equals(Combo.Items[i].ToString(), selectedItemLast))
                    {
                        Combo.SelectedIndex = i;
                    }
                }
                // If nothing was added, add a blank to avoid starting with "Add..." selected.
                if (Combo.Items.Count == 0)
                {
                    Combo.Items.Add(string.Empty);
                }
                if (IsVisibleEditting)
                {
                    if (List is IItemEditor <TItem> )
                    {
                        Combo.Items.Add(Resources.SettingsListComboDriver_Add);
                        Combo.Items.Add(Resources.SettingsListComboDriver_Edit_current);
                    }
                    Combo.Items.Add(Resources.SettingsListComboDriver_Edit_list);
                }
                if (Combo.SelectedIndex < 0)
                {
                    Combo.SelectedIndex = 0;
                }

                ComboHelper.AutoSizeDropDown(Combo);
            }
            finally
            {
                Combo.EndUpdate();
            }
        }