private void FillItems(Epoche selected) { ImageComboBoxItem item; // Create an image collection if (this.Properties.SmallImages == null) { this.ImageList = new ImageList(); this.ImageList.Images.Add(Collection.Properties.Resources.PICTO_EPOCHE_OFF_16); this.ImageList.Images.Add(Collection.Properties.Resources.PICTO_EPOCHE_I_16); this.ImageList.Images.Add(Collection.Properties.Resources.PICTO_EPOCHE_II_16); this.ImageList.Images.Add(Collection.Properties.Resources.PICTO_EPOCHE_III_16); this.ImageList.Images.Add(Collection.Properties.Resources.PICTO_EPOCHE_IV_16); this.ImageList.Images.Add(Collection.Properties.Resources.PICTO_EPOCHE_V_16); this.ImageList.Images.Add(Collection.Properties.Resources.PICTO_EPOCHE_VI_16); this.Properties.SmallImages = this.ImageList; } this.Properties.Items.Clear(); if (OTCContext.Project != null) { item = new ImageComboBoxItem("Not specified", Epoche.NotDefined, (int)Epoche.NotDefined); this.Properties.Items.Add(item); if (selected == Epoche.NotDefined) { this.EditValue = item; } item = new ImageComboBoxItem("Era I", Epoche.EpocheI, (int)Epoche.EpocheI); this.Properties.Items.Add(item); if (selected == Epoche.EpocheI) { this.EditValue = item; } item = new ImageComboBoxItem("Era II", Epoche.EpocheII, (int)Epoche.EpocheII); this.Properties.Items.Add(item); if (selected == Epoche.EpocheII) { this.EditValue = item; } item = new ImageComboBoxItem("Era III", Epoche.EpocheIII, (int)Epoche.EpocheIII); this.Properties.Items.Add(item); if (selected == Epoche.EpocheIII) { this.EditValue = item; } item = new ImageComboBoxItem("Era IV", Epoche.EpocheIV, (int)Epoche.EpocheIV); this.Properties.Items.Add(item); if (selected == Epoche.EpocheIV) { this.EditValue = item; } item = new ImageComboBoxItem("Era V", Epoche.EpocheV, (int)Epoche.EpocheV); this.Properties.Items.Add(item); if (selected == Epoche.EpocheV) { this.EditValue = item; } item = new ImageComboBoxItem("Era VI", Epoche.EpocheVI, (int)Epoche.EpocheVI); this.Properties.Items.Add(item); if (selected == Epoche.EpocheVI) { this.EditValue = item; } if (this.EditValue == null) { this.EditValue = this.Properties.Items[0]; } } }
/// <summary> /// Sets the selected element in the editor. /// </summary> /// <param name="selected">Selected item.</param> public void SetSelectedElement(Epoche selected) { this.FillItems(selected); }