BeginUpdate() public method

public BeginUpdate ( ) : void
return void
Exemplo n.º 1
0
        private void RandomTiler_Load(object sender, System.EventArgs e)
        {
            RandomTiles tiles = RandomTiles.Load();

            cmbTileSet.BeginUpdate();

            foreach (RandomTilesList tileset in tiles.List)
            {
                cmbTileSet.Items.Add(tileset);
            }

            cmbTileSet.EndUpdate();

            if (cmbTileSet.Items.Count > 0)
            {
                cmbTileSet.SelectedIndex = 0;
            }

            HueGroups hues = HueGroups.Load();

            cmbHues.BeginUpdate();

            foreach (HuesCollection huelist in hues.Groups)
            {
                cmbHues.Items.Add(huelist);
            }

            cmbHues.EndUpdate();

            if (cmbHues.Items.Count > 0)
            {
                cmbHues.SelectedIndex = 0;
            }

            UpdateFillText();

            // Maps
            cmbMap.BeginUpdate();

            for (int i = 0; i < 4; i++)
            {
                if (Pandora.Profile.Travel.EnabledMaps[i])
                {
                    cmbMap.Items.Add(Pandora.Profile.Travel.MapNames[i]);
                }
            }

            cmbMap.EndUpdate();

            if (cmbMap.Items.Count > 0)
            {
                cmbMap.SelectedIndex = 0;
            }
        }
Exemplo n.º 2
0
        void FillMembersComboBox()
        {
            IClass c = GetCurrentSelectedClass();

            if (c != null && lastClassInMembersComboBox != c)
            {
                lastClassInMembersComboBox = c;
                ArrayList items       = new ArrayList();
                bool      partialMode = false;
                IClass    currentPart = c;
                if (c.IsPartial)
                {
                    CompoundClass cc = c.GetCompoundClass() as CompoundClass;
                    if (cc != null)
                    {
                        partialMode = true;
                        c           = cc;
                    }
                }

                lock (c) {
                    int       lastIndex = 0;
                    IComparer comparer  = new Comparer(System.Globalization.CultureInfo.InvariantCulture);

                    foreach (IMethod m in c.Methods)
                    {
                        items.Add(new ComboBoxItem(m, m.Name, ClassBrowserIconService.GetIcon(m), partialMode ? currentPart.Methods.Contains(m) : true));
                    }
                    items.Sort(lastIndex, c.Methods.Count, comparer);
                    lastIndex = items.Count;

                    foreach (IProperty p in c.Properties)
                    {
                        items.Add(new ComboBoxItem(p, p.Name, ClassBrowserIconService.GetIcon(p), partialMode ? currentPart.Properties.Contains(p) : true));
                    }
                    items.Sort(lastIndex, c.Properties.Count, comparer);
                    lastIndex = items.Count;

                    foreach (IField f in c.Fields)
                    {
                        items.Add(new ComboBoxItem(f, f.Name, ClassBrowserIconService.GetIcon(f), partialMode ? currentPart.Fields.Contains(f) : true));
                    }
                    items.Sort(lastIndex, c.Fields.Count, comparer);
                    lastIndex = items.Count;

                    foreach (IEvent evt in c.Events)
                    {
                        items.Add(new ComboBoxItem(evt, evt.Name, ClassBrowserIconService.GetIcon(evt), partialMode ? currentPart.Events.Contains(evt) : true));
                    }
                    items.Sort(lastIndex, c.Events.Count, comparer);
                    lastIndex = items.Count;
                }

                membersComboBox.BeginUpdate();
                membersComboBox.Items.Clear();
                membersComboBox.Items.AddRange(items.ToArray());
                membersComboBox.EndUpdate();
                UpdateMembersComboBox();
            }
        }
 private static void LoadExt( string a, ComboBox b )
 {
     b.BeginUpdate();
     try {
         b.Items.Clear();
         var exts = GetAppForExt( a );
         b.Items.AddRange( exts );
         var current = Ext.GetCurrentProgID( a );
         b.Items.Add( "None" );
         if ( current != null ) {
             if ( !exts.Any( x => x.Name.Replace( " ", "." ) == current ) ) {
                 b.Items.Add( "Other" );
                 b.SelectedIndex = b.Items.Count - 1;
             }
             else
                 b.SelectedItem = b.Items.OfType<App>().First( x => x.Name.Replace( " ", "." ) == current );
         }
         else {
             b.SelectedIndex = b.Items.Count - 1;
         }
     }
     catch ( Exception ex ) {
         Console.WriteLine( ex.Message );
     }
     b.EndUpdate();
 }
        void FillClassComboBox(bool isUpdateRequired)
        {
            ArrayList items = new ArrayList();

            AddClasses(items, currentCompilationUnit.Classes);
            if (isUpdateRequired)
            {
                classComboBox.BeginUpdate();
            }
            classComboBox.Items.Clear();
            membersComboBox.Items.Clear();
            classComboBox.Items.AddRange(items.ToArray());
            if (items.Count == 1)
            {
                try {
                    autoselect = false;
                    classComboBox.SelectedIndex = 0;
                    FillMembersComboBox();
                } finally {
                    autoselect = true;
                }
            }
            if (isUpdateRequired)
            {
                classComboBox.EndUpdate();
            }
            UpdateClassComboBox();
        }
Exemplo n.º 5
0
        private void UpdateProps()
        {
            if (cmbProp.Text.Length > 0)
            {
                Pandora.Profile.Props.FBProps.AddString(cmbProp.Text);
            }

            if (cmbValue.Text.Length > 0)
            {
                Pandora.Profile.Props.FBValues.AddString(cmbValue.Text);
            }

            cmbProp.BeginUpdate();
            cmbValue.BeginUpdate();

            cmbProp.Items.Clear();
            cmbValue.Items.Clear();

            cmbProp.Items.AddRange(Pandora.Profile.Props.FBProps.GetArray());
            cmbValue.Items.AddRange(Pandora.Profile.Props.FBValues.GetArray());

            cmbProp.EndUpdate();
            cmbValue.EndUpdate();

            cmbProp.Text  = "";
            cmbValue.Text = "";
        }
Exemplo n.º 6
0
 internal void PopulateAnalyzers(ComboBox cbAnalyzers)
 {
     cbAnalyzers.BeginUpdate();
     cbAnalyzers.Items.Clear();
     cbAnalyzers.Items.AddRange(Analyzing.GetAnalyzerNames().ToArray());
     cbAnalyzers.EndUpdate();
 }
Exemplo n.º 7
0
        protected override void ResetSettings()
        {
            // Initialize the ComboBox settings
            if (cmbxPhotographer.Items.Count == 0)
            {
                // Create the list of photographers
                cmbxPhotographer.BeginUpdate();
                cmbxPhotographer.Items.Clear();
                cmbxPhotographer.Items.Add("unknown");

                foreach (Photograph ph in _album)
                {
                    if (ph.Photographer != null && !cmbxPhotographer.Items.Contains(ph.Photographer))
                    {
                        cmbxPhotographer.Items.Add(ph.Photographer);
                    }
                }
                cmbxPhotographer.EndUpdate();
            }

            Photograph p = _album.CurrentPhoto;

            if (p != null)
            {
                txtPhotoFile.Text             = p.FileName;
                txtCaption.Text               = p.Caption;
                txtDate.Text                  = p.DateTaken.ToString();
                cmbxPhotographer.SelectedItem = p.Photographer;
                txtNotes.Text                 = p.Notes;
            }
        }
        /// <summary>
        /// Intializes the combox box containing the searchable properties available.
        /// </summary>
        private void InitializePropertyComboBox()
        {
            //get the entire extended list of properties
            PropDef[] defs = m_connection.WebServiceManager.PropertyService.GetPropertyDefinitionsByEntityClassId(VDF.Vault.Currency.Entities.EntityClassIds.Files);

            if (defs != null && defs.Length > 0)
            {
                Array.Sort(defs, new PropertyDefinitionSorter());

                //wait to draw the combo box until we've added all of the properties
                m_propertyComboBox.BeginUpdate();

                m_propertyComboBox.Items.Clear();

                foreach (PropDef def in defs)
                {
                    //create a list item type that will hold the property
                    ListBoxPropDefItem item = new ListBoxPropDefItem(def);

                    m_propertyComboBox.Items.Add(item);
                }

                //indicate that we've finished updated the combobox and it can now be re-drawn
                m_propertyComboBox.EndUpdate();
            }
        }
Exemplo n.º 9
0
        private void comboBoxCategory_SelectedIndexChanged(object sender, System.EventArgs e)
        {
            ArrayList instCategList   = ((InstrumentManager)this.parentForm).instCategList;
            string    currentCategory = this.comboBoxCategory.Text;

            comboBoxSubCategory.Items.Clear();
            this.comboBoxSubCategory.Text = "";
            comboBoxSubCategory.BeginUpdate();
            for (int categoryCounter = 0; categoryCounter < instCategList.Count; categoryCounter++)
            {
                Category category = (Category)instCategList[categoryCounter];

                if (category.SubCategoryList.Count > 0 && currentCategory == category.CategoryName)
                {
                    ArrayList subCategoryList = (ArrayList)category.SubCategoryList;

                    for (int subCategoryCounter = 0; subCategoryCounter < subCategoryList.Count; subCategoryCounter++)
                    {
                        SubCategory subCategory = (SubCategory)subCategoryList[subCategoryCounter];
                        comboBoxSubCategory.Items.Add("" + subCategory.SubCategoryName);
                    }
                }
                else
                {
                    this.buttonBrows.Enabled = true;
                    this.textBoxFile.Enabled = true;
                }
            }

            comboBoxSubCategory.EndUpdate();
        }
Exemplo n.º 10
0
        /// <summary>
        /// Called when the user has typed in a query but has not hit enter before the timeout, so we should
        /// show a dropdown list of other suggestions.
        /// </summary>
        /// <param name="source">unused</param>
        /// <param name="e">unused</param>
        public void onTimer(Object source, ElapsedEventArgs e)
        {
            if (listBox.Text == "")
            {
                return;
            }
            delayTimer.Stop();
            if (this.Visible != true)
            {
                return;
            }
            updateFields(listBox.Text);

            if (currentMatches.Count <= 1)
            {
                return;
            }

            listBox.Items.Clear();

            listBox.BeginUpdate();
            for (int i = 0; i < currentMatches.Count; i++)
            {
                listBox.Items.Insert(i, currentMatches[i]);
            }

            listBox.EndUpdate();

            listBox.DroppedDown = true;
            listBox.Select(listBox.Text.Length, 0);
        }
Exemplo n.º 11
0
 private void addGrandButton_Click(object sender, System.EventArgs e)
 {
     comboBox1.BeginUpdate();
     for (int i = 0; i < 1000; i++)
     {
         comboBox1.Items.Add("Item 1" + i.ToString());
     }
     comboBox1.EndUpdate();
 }
Exemplo n.º 12
0
        /// <summary>
        /// Refreshes the combo box used to search
        /// </summary>
        private void RefreshSearches()
        {
            cmbSearch.BeginUpdate();
            cmbSearch.Items.Clear();

            cmbSearch.Items.AddRange(Pandora.Profile.Props.RecentClasses.GetArray());

            cmbSearch.EndUpdate();
        }
Exemplo n.º 13
0
 /// <summary>
 /// Clears and fills the control with the given data. 
 /// </summary>
 /// <param name="ctrl">Combobox control to fill</param>
 /// <param name="data">List of data</param>
 /// <param name="none">Flag to fill the first position with "None"</param>
 /// <remarks>Painting is suspended until after items have been added</remarks>
 public static void Populate(ComboBox ctrl, IList<dynamic> data, bool none)
 {
     ctrl.BeginUpdate();
     ctrl.Items.Clear();
     if (none)
         ctrl.Items.Add("<None>");
     for (int i = 1; i < data.Count; i++)
         ctrl.Items.Add(data[i].ToString());
     ctrl.EndUpdate();
 }
		public static bool BuildNamespacesList(ComboBox help2Collections, string selectedHelp2Collection)
		{
			if (help2Collections == null)
			{
				throw new ArgumentNullException("help2Collections");
			}

			HxRegistryWalkerClass registryWalker;
			IHxRegNamespaceList help2Namespaces;
			try
			{
				registryWalker = new HxRegistryWalkerClass();
				help2Namespaces = registryWalker.get_RegisteredNamespaceList("");
			}
			catch (System.Runtime.InteropServices.COMException)
			{
				help2Namespaces = null;
				registryWalker = null;
			}

			if (registryWalker == null || help2Namespaces == null || help2Namespaces.Count == 0)
			{
				return false;
			}

			help2Collections.Items.Clear();
			help2Collections.BeginUpdate();
			try
			{
				string currentDescription = string.Empty;

				foreach (IHxRegNamespace currentNamespace in help2Namespaces)
				{
					help2Collections.Items.Add
						((string)currentNamespace.GetProperty(HxRegNamespacePropId.HxRegNamespaceDescription));

					if (!string.IsNullOrEmpty(selectedHelp2Collection) &&
					    string.Compare(selectedHelp2Collection, currentNamespace.Name) == 0)
					{
						currentDescription =
							(string)currentNamespace.GetProperty(HxRegNamespacePropId.HxRegNamespaceDescription);
					}
				}

				if (!string.IsNullOrEmpty(currentDescription))
					help2Collections.SelectedIndex = help2Collections.Items.IndexOf(currentDescription);
				else
					help2Collections.SelectedIndex = 0;
			}
			finally
			{
				help2Collections.EndUpdate();
			}
			return true;
		}
Exemplo n.º 15
0
        private void DeleteInstrument_Load(object sender, System.EventArgs e)
        {
            ArrayList instCategList = ((InstrumentManager)this.parentForm).instCategList;

            comboBoxCategory.BeginUpdate();
            for (int categoryCounter = 0; categoryCounter < instCategList.Count; categoryCounter++)
            {
                Category category = (Category)instCategList[categoryCounter];
                comboBoxCategory.Items.Add("" + category.CategoryName);
            }
            comboBoxCategory.EndUpdate();
        }
Exemplo n.º 16
0
 private void InitializeDrawType()
 {
     CBox_DrawType.BeginUpdate();
     {
         CBox_DrawType.Items.Clear();
         foreach (var value in Enum.GetValues(typeof(DrawDataType)))
         {
             CBox_DrawType.Items.Add(value);
         }
     }
     CBox_DrawType.EndUpdate();
 }
Exemplo n.º 17
0
        public static void SetListItems(ComboBox comboBox, ListItemWithId[] items)
        {
            comboBox.Text = "";
            comboBox.Items.Clear();

            comboBox.BeginUpdate();

            for (int i = 0; i < items.Length; i++)
                comboBox.Items.Add(items[i]);

            comboBox.EndUpdate();
        }
Exemplo n.º 18
0
        private void PopulateLevelList()
        {
            cboLevel.BeginUpdate();
            cboLevel.Items.Clear();

            for (int i = 0; i < _levelZ.Count; ++i)
            {
                cboLevel.Items.Add(string.Format("Level {0}", i + 1));
            }

            cboLevel.SelectedIndex = 0;
            cboLevel.EndUpdate();
        }
Exemplo n.º 19
0
        private void AddInstrument_Load(object sender, System.EventArgs e)
        {
            ArrayList instCategList = ((InstrumentManager)this.parentForm).instCategList;

            comboBoxCategory.BeginUpdate();
            for (int categoryCounter = 0; categoryCounter < instCategList.Count; categoryCounter++)
            {
                Category category = (Category)instCategList[categoryCounter];
                comboBoxCategory.Items.Add("" + category.CategoryName);
            }
            comboBoxCategory.EndUpdate();
            this.buttonBrows.Enabled = false;
            this.textBoxFile.Enabled = false;
        }
Exemplo n.º 20
0
		public static void UpdateList(ComboBox comboBox, SelectableListNodeList items)
		{
			comboBox.SelectedIndexChanged -= EhComboBoxSelectionChanged;
			comboBox.BeginUpdate();
			comboBox.Items.Clear();
			for (int i = 0; i < items.Count; i++)
			{
				comboBox.Items.Add(items[i]);
				if (items[i].Selected)
					comboBox.SelectedIndex = i;
			}
			comboBox.EndUpdate();
			comboBox.SelectedIndexChanged += EhComboBoxSelectionChanged;
		}
Exemplo n.º 21
0
        /// <summary>
        /// Updates the custom parameters displayed in the combo box
        /// </summary>
        private void UpdateCustomParams()
        {
            if (cmbCustomParams.Text != null && cmbCustomParams.Text.Length > 0)
            {
                Pandora.Profile.Items.CustomParams.AddString(cmbCustomParams.Text);

                cmbCustomParams.BeginUpdate();
                cmbCustomParams.Items.Clear();

                cmbCustomParams.Items.AddRange(Pandora.Profile.Items.CustomParams.GetArray());

                cmbCustomParams.EndUpdate();
            }
        }
Exemplo n.º 22
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="comboBox"></param>
        /// <param name="lista"></param>
        public static void Popola(ref ComboBox comboBox, object lista, string DisplayMember, string ValueMember)
        {
            comboBox.BeginUpdate();

            comboBox.Items.Clear();

            // List<TipoUtensile> tipiUtensili = new TipoUtensileDao(MyApplication.GetConnection()).ListaOrdinata();
            if (lista != null)
            {
                comboBox.DataSource = lista;
                comboBox.DisplayMember = DisplayMember;
                comboBox.ValueMember = ValueMember;
            }
            comboBox.EndUpdate();
        }
Exemplo n.º 23
0
        private void comboBox_SelectedIndexChanged(object sender, System.EventArgs e)
        {
            Graphics grp = this.CreateGraphics();
            int      sel = comboBox.SelectedIndex;

            if (sel == -1)
            {
                return;
            }
            perfigures[3] = (comboBox.Items[sel].ToString() == "Pass")
                                ? -1 : perfigures[3] = (int)comboBox.Items[sel];
            if (perfigures[3] != -1)
            {
                bestPerfigure   = perfigures[3];
                playerPerfigure = 3;
                comboBox.BeginUpdate();
                for (int i = 0; i <= sel; i++)
                {
                    comboBox.Items.RemoveAt(0);
                }
                comboBox.EndUpdate();
                for (int i = 0; i < 3; i++)
                {
                    PlayerPrefigure(i);
                }
            }
            else
            {
                bestPerfigure = 0;
                for (int i = 0; i < 3; i++)
                {
                    if (maxPerfigures[i] > bestPerfigure)
                    {
                        bestPerfigure   = maxPerfigures[i];
                        playerPerfigure = i;
                    }
                }
                for (int i = 0; i < 4; i++)
                {
                    perfigures[i] = -1;
                }
                perfigures[playerPerfigure] = bestPerfigure;
                ok.Enabled       = true;
                comboBox.Enabled = false;
            }
            Invalidate(false);
        }
Exemplo n.º 24
0
        private void popCboCustomers()
        {
            OleDbDataReader dr;

            dr = db.GetCustomers();

            comboBox1.Items.Clear();
            comboBox1.BeginUpdate();
            while (dr.Read())
            {
                comboBox1.Items.Add(dr.GetString(0));
            }
            comboBox1.EndUpdate();

            // always call Close when done reading, this frees up the
            // connection to service other requests.
            dr.Close();
        }
Exemplo n.º 25
0
 public static void InitComboBox(System.Windows.Forms.ComboBox box, SelectableListNodeList names)
 {
     box.BeginUpdate();
     box.Items.Clear();
     foreach (SelectableListNode node in names)
     {
         box.Items.Add(node);
     }
     foreach (SelectableListNode node in names)
     {
         if (node.Selected)
         {
             box.SelectedItem = node;
             break;
         }
     }
     box.EndUpdate();
 }
Exemplo n.º 26
0
        private void FillClassComboBox(bool isUpdateRequired, mappers map)
        {
            ArrayList items = new ArrayList();

            ArrayList ns = new ArrayList();

            FillNamespace(ns);

            AddClasses(items, map);
            if (isUpdateRequired)
            {
                _classComboBox.BeginUpdate();
                namespaceComboBox.BeginUpdate();
            }
            namespaceComboBox.Items.Clear();
            _classComboBox.Items.Clear();
            _membersComboBox.Items.Clear();
            _classComboBox.Items.AddRange(items.ToArray());
            namespaceComboBox.Items.AddRange(ns.ToArray());
            if (items.Count == 1)
            {
                try
                {
                    _autoselect = false;
                    _classComboBox.SelectedIndex = 0;
                    FillMembersComboBox();
                }
                finally
                {
                    _autoselect = true;
                }
            }
            if (isUpdateRequired)
            {
                _classComboBox.EndUpdate();
                namespaceComboBox.EndUpdate();
            }
            // UpdateClassComboBox();

            if (namespaceComboBox.Items.Count > 0)
            {
                namespaceComboBox.SelectedIndex = 0;
            }
        }
Exemplo n.º 27
0
        private void UpdateTypes(bool clear)
        {
            if (cbType.Text != "")
            {
                Options.RecentTypes.AddString(cbType.Text);
            }

            cbType.BeginUpdate();
            cbType.Items.Clear();
            cbType.Items.AddRange(Options.RecentTypes.GetArray());
            cbType.EndUpdate();

            cbType.SelectedIndex = -1;

            if (!clear && cbType.Items.Count > 0)
            {
                cbType.SelectedIndex = 0;
            }
        }
Exemplo n.º 28
0
        private void UpdateTypes()
        {
            string type = null;

            if (cmbType.Text.Length > 0)
            {
                type = cmbType.Text;
            }

            if (type != null)
            {
                Pandora.Profile.Props.FBTypes.AddString(type);
            }

            cmbType.BeginUpdate();
            cmbType.Items.Clear();
            cmbType.Items.AddRange(Pandora.Profile.Props.FBTypes.GetArray());
            cmbType.EndUpdate();
        }
 private void loadDataSetList()
 {
     //
     //  Loop over project items and fill _datasetList with information
     //
     if (_ownerProject != null)
     {
         findDataSets(null, _ownerProject.ProjectItems);
     }
     //
     //  Display datasets found
     //
     comboBoxExistingDatasets.BeginUpdate();
     foreach (DictionaryEntry entry in _datasetList)
     {
         comboBoxExistingDatasets.Items.Add((string)entry.Key);
     }
     comboBoxExistingDatasets.EndUpdate();
 }
Exemplo n.º 30
0
        protected void LoadRemotes(GitClient client, ComboBox remoteBox)
        {
            var config = client.GetConfig(RepositoryPath);

            var currentBranch = client.GetCurrentBranch(RepositoryPath);

            string currentBranchRemote = config.GetString("branch", currentBranch.ShortName, "remote");

            remoteBox.BeginUpdate();
            remoteBox.Items.Clear();

            foreach (string remote in config.GetSubsections("remote"))
            {
                remoteBox.Items.Add(remote);

                if (remote == currentBranchRemote)
                    remoteBox.SelectedIndex = remoteBox.Items.Count - 1;
            }

            remoteBox.EndUpdate();
        }
        /// <summary>
        /// Updates the path combo box to show all parents of the current directory.
        /// </summary>
        private void UpdatePathComboBox()
        {
            ddVisitedLocations.BeginUpdate();
            ddVisitedLocations.Items.Clear();
            ddVisitedLocations.Items.Add(CurrentDirectory);

            DirectoryInfo dir = CurrentDirectory;

            while (dir.Parent != null)
            {
                ddVisitedLocations.Items.Add(dir.Parent);
                dir = dir.Parent;
            }
            foreach (DirectoryInfo d in this.CustomPlaces)
            {
                ddVisitedLocations.Items.Add(d);
            }

            ddVisitedLocations.SelectedIndex = 0;
            ddVisitedLocations.EndUpdate();
        }
Exemplo n.º 32
0
        /// <summary>
        /// Setup the categories from the database.
        /// </summary>
        private void SetupCategories()
        {
            int i;

            cMainCategory.BeginUpdate();
            cMainCategory.Items.Clear();
            cMainCategory.Items.Add("All");

            for (i = 0; i < pdb.catMgr.sortedCategories.Count; i++)
            {
                cMainCategory.Items.Add((string)pdb.catMgr.sortedCategories.GetKey(i));
            }

            cMainCategory.Items.Add(pdb.catMgr.GetCategoryName(0));

            if (categoryIdx < 0 || categoryIdx > cMainCategory.Items.Count)
            {
                categoryIdx = 0;
            }

            cMainCategory.EndUpdate();
        }
        private void SelectPar(object sender, EventArgs e)
        {
            Debug.Assert(sender == cmbHoles, "SelectPar method called by wrong control");

            cmbPar.BeginUpdate();
            cmbPar.Items.Clear();
            if ((int)cmbHoles.SelectedItem == 9)
            {
                cmbPar.Items.Add(36);
                cmbPar.Items.Add(35);
                cmbPar.Items.Add(27);
            }
            else
            {
                cmbPar.Items.Add(72);
                cmbPar.Items.Add(71);
                cmbPar.Items.Add(70);
                cmbPar.Items.Add(54);
            }
            cmbPar.SelectedIndex = 0;
            cmbPar.EndUpdate();
        }
Exemplo n.º 34
0
        private void comboBoxCategory_SelectedIndexChanged(object sender, System.EventArgs e)
        {
            ArrayList instCategList   = ((InstrumentManager)this.parentForm).instCategList;
            string    currentCategory = this.comboBoxCategory.Text;

            comboBoxSubCategory.Items.Clear();
            this.comboBoxSubCategory.Text = "";
            comboBoxSubCategory.BeginUpdate();
            comboBoxName.Items.Clear();
            for (int categoryCounter = 0; categoryCounter < instCategList.Count; categoryCounter++)
            {
                Category category = (Category)instCategList[categoryCounter];
                if (category.SubCategoryList.Count > 0 && currentCategory == category.CategoryName)
                {
                    ArrayList subCategoryList = (ArrayList)category.SubCategoryList;
                    for (int subCategoryCounter = 0; subCategoryCounter < subCategoryList.Count; subCategoryCounter++)
                    {
                        SubCategory subCategory = (SubCategory)subCategoryList[subCategoryCounter];
                        comboBoxSubCategory.Items.Add("" + subCategory.SubCategoryName);
                        ArrayList imageList = (ArrayList)subCategory.ImageList;
                        for (int imageCounter = 0; imageCounter < imageList.Count; imageCounter++)
                        {
                            myImage my_image = (myImage)imageList[imageCounter];
                            comboBoxName.Items.Add(my_image.instrumentName);
                        }
                    }
                }
                else if (currentCategory == category.CategoryName)
                {
                    ArrayList imageList = (ArrayList)category.ImageList;
                    for (int imageCounter = 0; imageCounter < imageList.Count; imageCounter++)
                    {
                        myImage my_image = (myImage)imageList[imageCounter];
                        comboBoxName.Items.Add(my_image.instrumentName);
                    }
                }
            }
            comboBoxSubCategory.EndUpdate();
        }
Exemplo n.º 35
0
        private void LoadFont()
        {
            FontComboItem  item;
            FontCollection fontCollection = new InstalledFontCollection();

            ComboFont.Items.Clear();

            ComboFont.BeginUpdate();
            for (int i = 0; i < fontCollection.Families.Length; i++)
            {
                if (!fontCollection.Families[i].IsStyleAvailable(FontStyle.Regular))
                {
                    continue;
                }


                item = new FontComboItem(fontCollection.Families[i].Name);
                ComboFont.Items.Add(item);
            }
            ComboFont.EndUpdate();
            ComboFont.Text = this.Font.FontFamily.Name;
        }
Exemplo n.º 36
0
        private void InitializeConditionComboBox()
        {
            //wait to draw the combo box until we've populated it with conditions
            m_conditionComboBox.BeginUpdate();

            //populate the combo box with the conditions
            m_conditionComboBox.Items.AddRange(new Condition[]
            {
                Condition.CONTAINS,
                Condition.EQUALS,
                Condition.DOES_NOT_CONTAIN,
                Condition.IS_EMPTY,
                Condition.IS_NOT_EMPTY,
                Condition.LESS_THAN_OR_EQUAL,
                Condition.LESS_THAN,
                Condition.GREATER_THAN_OR_EQUAL,
                Condition.GREATER_THAN,
                Condition.NOT_EQUAL
            });

            //indicated that we're finished populating the combobox and that it can be re-drawn
            m_conditionComboBox.EndUpdate();
        }
        private void SelectPar(object sender, EventArgs e)
        {
            Debug.Assert(sender == cmbHoles,
                         "SelectPar method called by wrong control");

            cmbPar.BeginUpdate();
            cmbPar.Items.Clear();
            if ((int)cmbHoles.SelectedItem == Globals.NineHoles)
            {
                cmbPar.Items.Add((int)CoursePar._36);
                cmbPar.Items.Add((int)CoursePar._35);
                cmbPar.Items.Add((int)CoursePar._27);
            }
            else
            {
                cmbPar.Items.Add((int)CoursePar._72);
                cmbPar.Items.Add((int)CoursePar._71);
                cmbPar.Items.Add((int)CoursePar._70);
                cmbPar.Items.Add((int)CoursePar._54);
            }
            cmbPar.SelectedIndex = 0;
            cmbPar.EndUpdate();

            //While I am in here I need to create the listview on the fly
            //The listview depends upon the number of holes
            if (ThisCourse != null)
            {
                Debug.WriteLine(ThisCourse.Name);
            }

            if (ThisCourse != null && !cmdEdit.Enabled)
            {
                ThisCourse.NumberOfHoles = (int)cmbHoles.SelectedItem;
            }

            SetupTeeList();
        }
Exemplo n.º 38
0
        /// <summary>
        /// Updates the recent arguments combo box
        /// </summary>
        private void UpdateRecentArgs()
        {
            string arg = cmbArgs.Text;

            if (arg.Length > 0)
            {
                Pandora.Profile.Admin.Args.AddString(arg);
            }

            cmbArgs.BeginUpdate();
            cmbArgs.Items.Clear();

            foreach (string s in Pandora.Profile.Admin.Args.List)
            {
                cmbArgs.Items.Add(s);
            }

            cmbArgs.EndUpdate();

            if (arg.Length > 0)
            {
                cmbArgs.SelectedItem = arg;
            }
        }
        private void SetComboEditValues(ComboBox pControl, string pValue, bool pAddDefaultsOnly)
        {
            // FF: load values from database also
            if (!pAddDefaultsOnly)
                pControl.Text = FDecoder.Name;

            pControl.BeginUpdate();
            try
            {
                pControl.Items.Clear();
                
                if (!pAddDefaultsOnly)
                    pControl.Items.Add(pValue);
            }
            finally
            {
                pControl.EndUpdate();
            }
        }
Exemplo n.º 40
0
        public static void Redraw( ComboBox list, GroupBox gb, params Button[] buttons )
        {
            list.Visible = true;
            list.BeginUpdate();
            list.Items.Clear();
            list.SelectedIndex = -1;

            for(int i=0;i<buttons.Length;i++)
                buttons[i].Visible = false;

            for (int i=0;i<m_List.Count;i++)
                list.Items.Add( m_List[i] );
            list.EndUpdate();

            gb.Visible = false;
        }
Exemplo n.º 41
0
 /// <summary>
 /// FillvariableCombo()
 /// </summary>
 /// <param name="cmb">ComboBox to be filled</param>
 /// <param name="scopeWord">The scope of the variable</param>
 protected void FillVariableCombo(ComboBox cmb, VariableType scopeWord)
 {
     cmb.Items.Clear();
     List<EpiInfo.Plugin.IVariable> vars = this.EpiInterpreter.Context.GetVariablesInScope((VariableScope)scopeWord);
     cmb.BeginUpdate();
     foreach (EpiInfo.Plugin.IVariable var in vars)
     {
         if (!(var is Epi.Fields.PredefinedDataField))
         {
             cmb.Items.Add(var.Name.ToString());
         }
     }
     cmb.EndUpdate();
     cmb.Sorted = true;
     cmb.Refresh();
 }
Exemplo n.º 42
0
            public FormField(Field f, XDataForm form, int tabIndex)
            {
                m_field = f;
                m_type = f.Type;
                m_var = f.Var;
                m_val = f.Vals;
                m_required = f.IsRequired;
                m_form = form;

                Panel p = null;
                if (m_type != FieldType.hidden)
                {
                    p = new Panel();
                    p.Parent = m_form.pnlFields;
                    p.TabIndex = tabIndex;
                }

                switch (m_type)
                {
                    case FieldType.hidden:
                        break;
                    case FieldType.boolean:
                        CheckBox cb = new CheckBox();
                        cb.Checked = f.BoolVal;
                        cb.Text = null;
                        m_control = cb;
                        break;
                    case FieldType.text_multi:
                        TextBox mtxt = new TextBox();
                        mtxt.Multiline = true;
                        mtxt.ScrollBars = ScrollBars.Vertical;
                        mtxt.Lines = m_val;
                        mtxt.Height = m_form.btnOK.Height * 3;
                        m_control = mtxt;
                        break;
                    case FieldType.text_private:
                        TextBox ptxt = new TextBox();
                        ptxt.Lines = m_val;
                        ptxt.PasswordChar = '*';
                        m_control = ptxt;
                        break;
                    case FieldType.list_single:
                        ComboBox box = new ComboBox();
                        box.DropDownStyle = ComboBoxStyle.DropDownList;
                        box.BeginUpdate();
                        string v = null;
                        if (m_val.Length > 0)
                            v = m_val[0];
                        foreach (Option o in f.GetOptions())
                        {
                            int i = box.Items.Add(o);

                            if (o.Val == v)
                            {
                                box.SelectedIndex = i;
                            }
                        }
                        box.EndUpdate();
                        m_control = box;
                        break;

                    case FieldType.list_multi:
                        //ListBox lb = new ListBox();
                        CheckedListBox lb = new CheckedListBox();
                        //lb.SelectionMode = SelectionMode.MultiExtended;
                        lb.VisibleChanged += new EventHandler(lb_VisibleChanged);
                        m_control = lb;
                        break;

                    case FieldType.jid_single:
                        TextBox jtxt = new TextBox();
                        jtxt.Lines = m_val;
                        jtxt.Validating += new CancelEventHandler(jid_Validating);
                        jtxt.Validated += new EventHandler(jid_Validated);
                        m_control = jtxt;
                        m_form.error.SetIconAlignment(m_control, ErrorIconAlignment.MiddleLeft);
                        break;

                    case FieldType.jid_multi:
                        JidMulti multi = new JidMulti();
                        multi.AddRange(m_val);
                        m_control = multi;
                        break;

                    case FieldType.Fixed:
                        // All of this so that we can detect URLs.
                        // We can't just make it disabled, because then the URL clicked
                        // event handler doesn't fire, and there's no way to set the
                        // text foreground color.
                        // It would be cool to make copy work, but it doesn't work for
                        // labels, either.
                        RichTextBox rich = new RichTextBox();
                        rich.DetectUrls = true;
                        rich.Text = string.Join("\r\n", f.Vals);
                        rich.ScrollBars = RichTextBoxScrollBars.None;
                        rich.Resize += new EventHandler(lbl_Resize);
                        rich.BorderStyle = BorderStyle.None;
                        rich.LinkClicked += new LinkClickedEventHandler(rich_LinkClicked);
                        rich.BackColor = System.Drawing.SystemColors.Control;
                        rich.KeyPress += new KeyPressEventHandler(rich_KeyPress);
                        rich.GotFocus += new EventHandler(rich_GotFocus);
                        rich.AcceptsTab = false;
                        rich.AutoSize = false;
                        m_control = rich;
                        break;
                    default:
                        TextBox txt = new TextBox();
                        txt.Lines = m_val;
                        m_control = txt;
                        break;
                }

                if (m_type != FieldType.hidden)
                {
                    m_control.Parent = p;

                    if (f.Desc != null)
                        form.tip.SetToolTip(m_control, f.Desc);

                    String lblText = "";

                    if (f.Label != "")
                        lblText = f.Label + ":";
                    else if (f.Var != "")
                        lblText = f.Var + ":";

                    if (lblText != "")
                    {
                        m_label = new Label();
                        m_label.Parent = p;
                        m_label.Text = lblText;

                        if (m_required)
                        {
                            m_label.Text = "* " + m_label.Text;
                            m_form.error.SetIconAlignment(m_control, ErrorIconAlignment.MiddleLeft);

                            m_control.Validating += new CancelEventHandler(m_control_Validating);
                            m_control.Validated += new EventHandler(m_control_Validated);
                        }
                        Graphics graphics = m_label.CreateGraphics();
                        SizeF s = m_label.Size;
                        s.Height = 0;
                        int chars;
                        int lines;
                        SizeF textSize = graphics.MeasureString(m_label.Text, m_label.Font, s, StringFormat.GenericDefault, out chars, out lines);
                        m_label.Height = (int) (textSize.Height);

                        if (lines > 1)
                            m_label.TextAlign = ContentAlignment.MiddleLeft;
                        else
                            m_label.TextAlign = ContentAlignment.TopLeft;

                        m_label.Top = 0;
                        p.Controls.Add(m_label);
                        m_control.Location = new Point(m_label.Width + 3, 0);
                        m_control.Width = p.Width - m_label.Width - 6;
                        p.Height = Math.Max(m_label.Height, m_control.Height) + 4;
                    }
                    else
                    {
                        m_control.Location = new Point(0, 0);
                        m_control.Width = p.Width - 6;
                        p.Height = m_control.Height + 4;
                    }
                    m_control.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
                    p.Controls.Add(m_control);
                    p.Dock = DockStyle.Top;
                    m_form.pnlFields.Controls.Add(p);

                    if (m_form.m_type != XDataType.form)
                        m_control.Enabled = false;
                }
            }
Exemplo n.º 43
0
 /// <summary>
 /// FillvariableCombo()
 /// </summary>
 /// <param name="cmb">ComboBox to be filled</param>
 /// <param name="scopeWord">The scope of the variable</param>
 /// <param name="typ">Limit selection to (DataType)</param>
 protected void FillVariableCombo(ComboBox cmb, VariableType scopeWord, DataType typ)
 {
     cmb.Items.Clear();
     VariableCollection vars = this.EpiInterpreter.Context.MemoryRegion.GetVariablesInScope(scopeWord);
     cmb.BeginUpdate();
     foreach (IVariable var in vars)
     {
         int VType = (int)var.DataType;
         int FType = (int)typ;
         if (!(var is Epi.Fields.PredefinedDataField) && ((VType & FType) == VType))
         {
             cmb.Items.Add(var.Name.ToString());
         }
     }
     cmb.EndUpdate();
     cmb.Sorted = true;
     cmb.Refresh();
 }
Exemplo n.º 44
0
        private void SetComboBox(ComboBox box)
        {
            box.BeginUpdate();
            box.Items.Clear();

            if (history.Count != 0)
            {
                foreach (var o in history)
                    box.Items.Add(o);

                box.Text = history[0];
            }

            box.EndUpdate();
        }
Exemplo n.º 45
0
 private void LoadItemsIntoComboBox( ComboBox combobox, IEnumerable<object> items )
 {
     combobox.BeginUpdate();
     foreach( var item in items )
         combobox.Items.Add(item);
     combobox.EndUpdate();
 }
Exemplo n.º 46
0
		public void BeginEndUpdateTest ()
		{
			Form myform = new Form ();
			myform.ShowInTaskbar = false;
			myform.Visible = true;
			ComboBox cmbbox = new ComboBox ();
			cmbbox.Items.Add ("A");
			cmbbox.Visible = true;
			myform.Controls.Add (cmbbox);
			cmbbox.BeginUpdate ();
			for (int x = 1 ; x < 5000 ; x++) {
				cmbbox.Items.Add ("Item " + x.ToString ());
			}
			cmbbox.EndUpdate ();
			myform.Dispose ();
		}
Exemplo n.º 47
0
        /// <summary>
        /// Fills given combobox with given values and saves selection.
        /// </summary>
        /// <param name="target">Combobox to fill.</param>
        /// <param name="values">Values to use.</param>
        private void FillCombobox(ComboBox target, string[] values)
        {
            // Store selected item
            object selected = target.SelectedItem;

            target.BeginUpdate();

            // Clear collection
            target.Items.Clear();

            // Add kinds if any
            if (values != null)
                target.Items.AddRange(values);
            
            // If stored selected item is valid, store it
            if (selected != null && target.Items.Contains(selected))
                target.SelectedItem = selected;
            // Otherwize select first item
            else if (target.Items.Count > 0)
                target.SelectedItem = target.Items[0];

            target.EndUpdate();
        } 
Exemplo n.º 48
0
        protected void FillVariableCombo(ComboBox cmb )
        {
            cmb.Items.Clear();
            //VariableCollection vars = this.EpiInterpreter.Context.MemoryRegion.GetVariablesInScope(scopeWord);
            cmb.BeginUpdate();
            foreach (DataColumn Column in this.mainForm.EpiInterpreter.Context.DataSet.Tables["output"].Columns)
            {
                if (!(Column.DataType.FullName.ToString() == "System.DateTime"))
                {
                    cmb.Items.Add(Column.ColumnName.ToString());
                }

            }

            cmb.EndUpdate();
            cmb.Sorted = true;
            cmb.Refresh();
        }
Exemplo n.º 49
0
        /// <summary>
        ///     リスト項目の値を更新する
        /// </summary>
        /// <param name="control">コントロール</param>
        /// <param name="unit">ユニット</param>
        public void UpdateListItems(ComboBox control, Unit unit)
        {
            control.BeginUpdate();
            control.Items.Clear();
            ScenarioEditorItemId itemId = (ScenarioEditorItemId) control.Tag;
            switch (itemId)
            {
                case ScenarioEditorItemId.UnitLocation:
                case ScenarioEditorItemId.UnitBase:
                    List<Province> provinces = (List<Province>) GetListItems(itemId, unit);
                    if (provinces != null)
                    {
                        foreach (Province province in provinces)
                        {
                            ProvinceSettings settings = Scenarios.GetProvinceSettings(province.Id);
                            control.Items.Add(Scenarios.GetProvinceName(province, settings));
                        }
                    }
                    break;

                case ScenarioEditorItemId.UnitLeader:
                    List<Leader> leaders = (List<Leader>) GetListItems(itemId, unit);
                    foreach (Leader leader in leaders)
                    {
                        control.Items.Add(leader.Name);
                    }
                    break;
            }
            control.EndUpdate();
        }
Exemplo n.º 50
0
        /// <summary>
        /// Creates Control control from given IXAttribute.
        /// </summary>
        /// <param name="attribute">Given IXAttribute.</param>
        /// <returns>Label control according to given IXAttribute.</returns>
        internal Control GetControl(IXAttribute attribute)
        {
            var control = new Control();

            if (attribute is XAttribute<string>)
            {
                var stringAttribute = (XAttribute<string>)attribute;
                var textBox = new TextBox();
                control = textBox;
                control.DataBindings.Add("Text", stringAttribute, "Value");
            }
            else if (attribute is XAttribute<int>)
            {
                var intAttribute = (XAttribute<int>)attribute;
                var numericUpDown = new NumericUpDown();
                numericUpDown.DataBindings.Add("Value", intAttribute, "Value");
                control = numericUpDown;
            }
            else if (attribute is XAttribute<bool>)
            {
                var boolAttribute = (XAttribute<bool>)attribute;
                var checkBox = new CheckBox();
                control = checkBox;
                checkBox.DataBindings.Add("Checked", boolAttribute, "Value");
            }
            else if (attribute is XAttribute<DateTime>)
            {
                var dateTimeAttribute = (XAttribute<DateTime>)attribute;
                var dateTimePicker = new DateTimePicker();

                if (!dateTimeAttribute.Value.HasMeaning())
                {
                    dateTimeAttribute.Value = DateTime.Now;
                }

                dateTimePicker.DataBindings.Add("Value", dateTimeAttribute, "Value");
                control = dateTimePicker;
            }
            else if (attribute is XEnumerationAttribute<string>)
            {
                var enumerationAttribute = (XEnumerationAttribute<string>)attribute;
                var enumeration = enumerationAttribute.Enumeration;

                var comboBox = new ComboBox();

                comboBox.BeginUpdate();
                comboBox.Items.Clear();
                foreach (var item in enumeration)
                {
                    comboBox.Items.Add(item);
                }
                comboBox.EndUpdate();

                comboBox.SelectedItem = enumerationAttribute.Value;
                comboBox.DataBindings.Add("Text", enumerationAttribute, "Value");
                control = comboBox;
            }

            control.Name = attribute.Name;
            control.Tag = attribute;

            return control;
        }
Exemplo n.º 51
0
        public void layOutParameters()
        {
            this.SuspendLayout();

            equationStatusLabel.Enabled = false;
            equationStatusLabel.Visible = false;

            equationTextBox.Enabled = false;
            equationTextBox.Visible = false;
            if (currentWaveform != null)
            {
                equationTextBox.Text = currentWaveform.EquationString;
            }

            equationHelpText.Visible = false;

            upButton.Enabled = false;
            upButton.Visible = false;

            downButton.Visible = false;
            downButton.Enabled = false;

            sortButton.Visible = false;
            scaleButton.Visible = false;

            // REO 10/2008
            // first, remove the old stuff
            disableLoadFileControls();
            hideXYLabels();

            if (specializedParameters != null)
            {
                foreach (HorizontalParameterEditor ed in specializedParameters)
                {
                    this.specialParametersBox.Controls.Remove(ed);
                    ed.Dispose();
                }
                foreach (Label lab in specializedParameterLabels)
                {
                    this.specialParametersBox.Controls.Remove(lab);
                    lab.Dispose();
                }
            }
            specializedParameters = null;
            specializedParameterLabels = null;

            if (xyParameters != null)
            {
                foreach (HorizontalParameterEditor ed in xyParameters)
                {
                    this.Controls.Remove(ed);
                    ed.Dispose();
                }
                foreach (Label lab in xyParameterLabels)
                {
                    this.Controls.Remove(lab);
                    lab.Dispose();
                }
            }
            xyParameterLabels = null;
            xyParameters = null;

            if (combinationParameters != null)
            {
                foreach (ComboBox box in combinationParameters)
                {
                    this.Controls.Remove(box);
                    box.Dispose();
                }
            }

            combinationParameters = null;

            if (currentWaveform != null)
            {

                if (currentWaveform.interpolationType.xyParametersEnabled)
                {
                    if (currentWaveform.interpolationType.xyParametersFixed)
                    {
                        sortButton.Visible = false;
                        scaleButton.Visible = false;
                    }
                    else
                    {
                        sortButton.Visible = true;
                        scaleButton.Visible = true;
                    }
                }

                // lay out specialized param editors

                if (currentWaveform.interpolationType.extraParametersEnabled)
                {
                    specializedParameters = new List<HorizontalParameterEditor>();
                    specializedParameterLabels = new List<Label>();

                    for (int i = 0; i < currentWaveform.interpolationType.extraParametersCount; i++)
                    {
                        HorizontalParameterEditor hpe = new HorizontalParameterEditor(
                            currentWaveform.ExtraParameters[i]);

                        hpe.updateGUI += this.updateGUI;

                        hpe.Location = new Point(specialParametersStartPoint.Location.X,
                            specialParametersStartPoint.Location.Y + i * y_parameter_spacing);
                        hpe.Visible = true;
                        hpe.Enabled = true;
                        hpe.Size = specialParametersStartPoint.Size;

                        specializedParameters.Add(hpe);

                        Label lab = new Label();
                        lab.Text = currentWaveform.interpolationType.extraParametersNames[i];
                        lab.Location = new Point(specializedLabelStart.Location.X,
                            specializedLabelStart.Location.Y + i * y_parameter_spacing);
                        lab.Visible = true;
                        lab.Enabled = true;

                        specializedParameterLabels.Add(lab);

                    }

                    specialParametersBox.Controls.AddRange(specializedParameters.ToArray());
                    specialParametersBox.Controls.AddRange(specializedParameterLabels.ToArray());
                }

                // REO 10/2008
                // Now lay out load file box
                if (currentWaveform.interpolationType.canReadDataFromFile)
                {
                    enableLoadFileControls();
                }

                // Now lay out XY parameters.

                if (currentWaveform.interpolationType.xyParametersEnabled)
                {
                    xyParameters = new List<HorizontalParameterEditor>();
                    xyParameterLabels = new List<Label>();

                    if (currentWaveform.interpolationType.xyParametersFixed)
                    {
                        for (int i = 0; i < currentWaveform.interpolationType.xyParametersCount; i++)
                        {
                            addXYParameterEditor(i);
                        }

                    }
                    else
                    {
                        for (int i = 0; i < currentWaveform.XValues.Count; i++)
                        {
                            addXYParameterEditor(i);
                        }

                        enableAndPositionUpDownButtons();
                    }

                    if (xyParameters.Count != 0)
                    {
                        showXYLabels();
                    }

                    this.Controls.AddRange(xyParameters.ToArray());
                    this.Controls.AddRange(xyParameterLabels.ToArray());
                    //    foreach (HorizontalParameterEditor hpe in xyParameters)
                    //       this.Controls.Add(hpe);
                    //   foreach (Label lab in xyParameterLabels)
                    //       this.Controls.Add(lab);
                }

                // REO 10/2008: added +fileControlOffsetY to position around file load box
                // Now layout waveform combination parameters

                if (currentWaveform.interpolationType.referencesOtherWaveforms)
                {
                    combinationParameters = new List<ComboBox>();
                    combinationBoxIsAWaveform = new Dictionary<ComboBox, bool>();

                    for (int i = 0; i < currentWaveform.ReferencedWaveforms.Count; i++)
                    {
                        ComboBox box = new ComboBox();
                        combinationBoxIsAWaveform.Add(box, true);
                        box.Size = waveformCombosStart.Size;
                        box.Location = new Point(waveformCombosStart.Location.X,
                            waveformCombosStart.Location.Y
                            + 2 * i * y_parameter_spacing
                            + fileControlOffsetY);

                        foreach (Waveform wf in Storage.sequenceData.CommonWaveforms)
                        {
                            if (wf.ToString() == null)
                                wf.WaveformName = "Name Required";
                            box.Items.Add(wf);
                        }

                        box.DropDownStyle = ComboBoxStyle.DropDownList;
                        box.Name = i.ToString();
                        box.SelectedIndexChanged += combinerComboBoxValueChanged;

                        box.SelectedItem = currentWaveform.ReferencedWaveforms[i];

                        combinationParameters.Add(box);

                    }

                    for (int i = 0; i < currentWaveform.WaveformCombiners.Count; i++)
                    {
                        ComboBox box = new ComboBox();
                        combinationBoxIsAWaveform.Add(box, false);
                        box.Size = waveformCombosStart.Size;
                        box.Location = new Point(waveformCombosStart.Location.X,
                            waveformCombosStart.Location.Y
                            + (2 * i + 1) * y_parameter_spacing
                            + fileControlOffsetY);

                        box.BeginUpdate();
                        foreach (Waveform.InterpolationType.CombinationOperators oper in Waveform.InterpolationType.allCombinationOperators)
                        {
                            box.Items.Add(oper);
                        }
                        box.EndUpdate();

                        box.DropDownStyle = ComboBoxStyle.DropDownList;
                        box.Name = i.ToString();
                        box.SelectedIndexChanged += combinerComboBoxValueChanged;

                        box.SelectedItem = currentWaveform.WaveformCombiners[i];
                        combinationParameters.Add(box);

                    }

                    this.Controls.AddRange(combinationParameters.ToArray());

                    //  foreach (ComboBox box in combinationParameters)
                    //      this.Controls.Add(box);

                    enableAndPositionUpDownButtons();
                }
            }
            if (currentWaveform != null)
            {
                if (currentWaveform.interpolationType.equationParameterEnabled)
                {
                    equationTextBox.Visible = true;
                    equationTextBox.Enabled = true;
                    equationStatusLabel.Visible = true;
                    equationStatusLabel.Enabled = true;

                    equationHelpText.Visible = true;

                    updateEquationStatusLabel();
                }
            }

            this.ResumeLayout();
        }
 private void UpdateComboBox(ComboBox box, object source, object defaultValue)
 {
     box.BeginUpdate();
     object obj2 = (box.SelectedItem == null) ? defaultValue : box.SelectedItem;
     box.DataSource = source;
     box.SelectedItem = obj2;
     if (box.SelectedIndex < 0)
     {
         box.SelectedIndex = 0;
     }
     box.EndUpdate();
 }
Exemplo n.º 53
0
        /// <summary>
        ///     リスト項目の値を更新する
        /// </summary>
        /// <param name="control">コントロール</param>
        /// <param name="division">師団</param>
        /// <param name="settings">国家設定</param>
        public void UpdateListItems(ComboBox control, Division division, CountrySettings settings)
        {
            control.BeginUpdate();
            control.Items.Clear();
            ScenarioEditorItemId itemId = (ScenarioEditorItemId) control.Tag;
            UnitClass uc;
            switch (itemId)
            {
                case ScenarioEditorItemId.DivisionUnitType:
                case ScenarioEditorItemId.DivisionBrigadeType1:
                case ScenarioEditorItemId.DivisionBrigadeType2:
                case ScenarioEditorItemId.DivisionBrigadeType3:
                case ScenarioEditorItemId.DivisionBrigadeType4:
                case ScenarioEditorItemId.DivisionBrigadeType5:
                    List<UnitType> types = (List<UnitType>) GetListItems(itemId, division);
                    foreach (UnitType type in types)
                    {
                        control.Items.Add(Units.Items[(int) type]);
                    }
                    break;

                case ScenarioEditorItemId.DivisionModel:
                    uc = Units.Items[(int) division.Type];
                    for (int i = 0; i < uc.Models.Count; i++)
                    {
                        string name = uc.GetCountryModelName(i, settings.Country);
                        if (string.IsNullOrEmpty(name))
                        {
                            name = uc.GetModelName(i);
                        }
                        control.Items.Add(name);
                    }
                    break;

                case ScenarioEditorItemId.DivisionBrigadeModel1:
                    uc = Units.Items[(int) division.Extra1];
                    for (int i = 0; i < uc.Models.Count; i++)
                    {
                        string name = uc.GetCountryModelName(i, settings.Country);
                        if (string.IsNullOrEmpty(name))
                        {
                            name = uc.GetModelName(i);
                        }
                        control.Items.Add(name);
                    }
                    break;

                case ScenarioEditorItemId.DivisionBrigadeModel2:
                    uc = Units.Items[(int) division.Extra2];
                    for (int i = 0; i < uc.Models.Count; i++)
                    {
                        string name = uc.GetCountryModelName(i, settings.Country);
                        if (string.IsNullOrEmpty(name))
                        {
                            name = uc.GetModelName(i);
                        }
                        control.Items.Add(name);
                    }
                    break;

                case ScenarioEditorItemId.DivisionBrigadeModel3:
                    uc = Units.Items[(int) division.Extra3];
                    for (int i = 0; i < uc.Models.Count; i++)
                    {
                        string name = uc.GetCountryModelName(i, settings.Country);
                        if (string.IsNullOrEmpty(name))
                        {
                            name = uc.GetModelName(i);
                        }
                        control.Items.Add(name);
                    }
                    break;

                case ScenarioEditorItemId.DivisionBrigadeModel4:
                    uc = Units.Items[(int) division.Extra4];
                    for (int i = 0; i < uc.Models.Count; i++)
                    {
                        string name = uc.GetCountryModelName(i, settings.Country);
                        if (string.IsNullOrEmpty(name))
                        {
                            name = uc.GetModelName(i);
                        }
                        control.Items.Add(name);
                    }
                    break;

                case ScenarioEditorItemId.DivisionBrigadeModel5:
                    uc = Units.Items[(int) division.Extra5];
                    for (int i = 0; i < uc.Models.Count; i++)
                    {
                        string name = uc.GetCountryModelName(i, settings.Country);
                        if (string.IsNullOrEmpty(name))
                        {
                            name = uc.GetModelName(i);
                        }
                        control.Items.Add(name);
                    }
                    break;
            }
            control.EndUpdate();
        }
Exemplo n.º 54
0
 public static void InitializeSubtitleFormatComboBox(ComboBox comboBox, IEnumerable<string> formatNames, string selectedName)
 {
     var selectedIndex = 0;
     comboBox.BeginUpdate();
     comboBox.Items.Clear();
     using (var graphics = comboBox.CreateGraphics())
     {
         var maxWidth = 0.0F;
         foreach (var name in formatNames)
         {
             var index = comboBox.Items.Add(name);
             if (name.Equals(selectedName, StringComparison.OrdinalIgnoreCase))
                 selectedIndex = index;
             var width = graphics.MeasureString(name, comboBox.Font).Width;
             if (width > maxWidth)
                 maxWidth = width;
         }
         comboBox.DropDownWidth = (int)Math.Round(maxWidth + 7.5);
     }
     comboBox.SelectedIndex = selectedIndex;
     comboBox.EndUpdate();
 }
Exemplo n.º 55
0
 public static void InitializeTextEncodingComboBox(ComboBox comboBox)
 {
     var defaultEncoding = Configuration.Settings.General.DefaultEncoding;
     var selectedItem = (TextEncodingListItem)null;
     comboBox.BeginUpdate();
     comboBox.Items.Clear();
     using (var graphics = comboBox.CreateGraphics())
     {
         var maxWidth = 0.0F;
         foreach (var encoding in Configuration.AvailableEncodings)
         {
             if (encoding.CodePage >= 949 && !encoding.IsEbcdic())
             {
                 var item = new TextEncodingListItem(encoding);
                 if (selectedItem == null && item.Equals(defaultEncoding))
                     selectedItem = item;
                 var width = graphics.MeasureString(item.DisplayName, comboBox.Font).Width;
                 if (width > maxWidth)
                     maxWidth = width;
                 if (encoding.CodePage.Equals(Encoding.UTF8.CodePage))
                     comboBox.Items.Insert(0, item);
                 else
                     comboBox.Items.Add(item);
             }
         }
         comboBox.DropDownWidth = (int)Math.Round(maxWidth + 7.5);
     }
     if (selectedItem == null)
         comboBox.SelectedIndex = 0; // UTF-8 if DefaultEncoding is not found
     else
         comboBox.SelectedItem = selectedItem;
     comboBox.EndUpdate();
     Configuration.Settings.General.DefaultEncoding = (comboBox.SelectedItem as TextEncodingListItem).Encoding.WebName;
 }
Exemplo n.º 56
0
        /// <summary>
        /// FillWeightVariableCombo()
        /// </summary>
        /// <param name="cmb">ComboBox to be filled</param>
        /// <param name="scopeWord">The scope of the variable</param>
        protected void FillWeightVariableCombo(ComboBox cmb, VariableType scopeWord)
        {
            cmb.Items.Clear();
            VariableCollection vars = this.EpiInterpreter.Context.MemoryRegion.GetVariablesInScope(scopeWord);
            cmb.BeginUpdate();

            foreach (IVariable var in vars)
            {
                if (this.EpiInterpreter.Context.DataSet.Tables["output"].Columns.Contains(var.Name))
                {
                    Type type = this.EpiInterpreter.Context.DataSet.Tables["output"].Columns[var.Name].DataType;

                    switch (Type.GetTypeCode(type))
                    {
                        case TypeCode.Boolean:
                        case TypeCode.Byte:
                        case TypeCode.SByte:
                        case TypeCode.UInt16:
                        case TypeCode.UInt32:
                        case TypeCode.UInt64:
                        case TypeCode.Int16:
                        case TypeCode.Int32:
                        case TypeCode.Int64:
                        case TypeCode.Decimal:
                        case TypeCode.Double:
                        case TypeCode.Single:
                            cmb.Items.Add(var.Name.ToString());
                            break;
                    }
                }
            }

            cmb.EndUpdate();
            cmb.Sorted = true;
            cmb.Refresh();
        }
Exemplo n.º 57
0
    void InitializeComboBox(ComboBox box, SelectableListNodeList list)
    {
      box.BeginUpdate();
      box.Items.Clear();


      for (int i = 0; i < list.Count; i++)
      {
        SelectableListNode node = list[i];

        box.Items.Add(node);
        if (node.Selected)
          box.SelectedIndex=i;
      }

      box.EndUpdate();
    }
Exemplo n.º 58
0
        /// <summary>
        ///     編集項目の値を更新する
        /// </summary>
        /// <param name="control">コントロール</param>
        /// <param name="settings">国家設定</param>
        public void UpdateItemValue(ComboBox control, CountrySettings settings)
        {
            ScenarioEditorItemId itemId = (ScenarioEditorItemId) control.Tag;
            switch (itemId)
            {
                case ScenarioEditorItemId.CountryRegularId:
                    Country country = (Country) (GetItemValue(itemId, settings) ?? Country.None);
                    control.SelectedIndex = Array.IndexOf(Countries.Tags, country) + 1;
                    break;

                case ScenarioEditorItemId.CabinetHeadOfState:
                case ScenarioEditorItemId.CabinetHeadOfGovernment:
                case ScenarioEditorItemId.CabinetForeignMinister:
                case ScenarioEditorItemId.CabinetArmamentMinister:
                case ScenarioEditorItemId.CabinetMinisterOfSecurity:
                case ScenarioEditorItemId.CabinetMinisterOfIntelligence:
                case ScenarioEditorItemId.CabinetChiefOfStaff:
                case ScenarioEditorItemId.CabinetChiefOfArmy:
                case ScenarioEditorItemId.CabinetChiefOfNavy:
                case ScenarioEditorItemId.CabinetChiefOfAir:
                    List<Minister> ministers = (List<Minister>) GetListItems(itemId);
                    control.BeginUpdate();
                    control.Items.Clear();
                    foreach (Minister minister in ministers)
                    {
                        control.Items.Add(minister.Name);
                    }
                    control.EndUpdate();
                    object val = GetItemValue(itemId, settings);
                    if (val != null)
                    {
                        control.SelectedIndex = ministers.FindIndex(minister => minister.Id == (int) val);
                    }
                    break;
            }
        }
Exemplo n.º 59
0
		public FontDialog( )
		{
			form = new DialogForm (this);
			example_panel_text = char_sets [0];
			
			okButton = new Button( );
			cancelButton = new Button( );
			applyButton = new Button( );
			helpButton = new Button( );
			
			fontTextBox = new TextBox( );
			fontstyleTextBox = new TextBox( );
			fontsizeTextBox = new TextBox( );
			
			fontListBox = new MouseWheelListBox ();
			fontsizeListBox = new MouseWheelListBox ();
			fontstyleListBox = new MouseWheelListBox ();
			
			fontLabel = new Label( );
			fontstyleLabel = new Label( );
			sizeLabel = new Label( );
			scriptLabel = new Label( );
			
			exampleGroupBox = new GroupBox( );
			
			effectsGroupBox = new GroupBox( );
			underlinedCheckBox = new CheckBox( );
			strikethroughCheckBox = new CheckBox( );
			scriptComboBox = new ComboBox( );
			
			examplePanel = new Panel( );
			
			colorComboBox = new ColorComboBox( this );
			
			exampleGroupBox.SuspendLayout( );
			effectsGroupBox.SuspendLayout( );
			form.SuspendLayout( );
			
			form.FormBorderStyle = FormBorderStyle.FixedDialog;
			form.MaximizeBox = false;
			
			// fontsizeListBox
			fontsizeListBox.Location = new Point( 284, 47 );
			fontsizeListBox.Size = new Size( 52, 95 );
			fontsizeListBox.TabIndex = 10;
			fontListBox.Sorted = true;
			// fontTextBox
			fontTextBox.Location = new Point( 16, 26 );
			fontTextBox.Size = new Size( 140, 21 );
			fontTextBox.TabIndex = 5;
			fontTextBox.Text = "";
			// fontstyleLabel
			fontstyleLabel.Location = new Point( 164, 10 );
			fontstyleLabel.Size = new Size( 100, 16 );
			fontstyleLabel.TabIndex = 1;
			fontstyleLabel.Text = "Font Style:";
			// typesizeTextBox
			fontsizeTextBox.Location = new Point( 284, 26 );
			fontsizeTextBox.Size = new Size( 52, 21 );
			fontsizeTextBox.TabIndex = 7;
			fontsizeTextBox.Text = "";
			fontsizeTextBox.MaxLength = 2;
			// schriftartListBox
			fontListBox.Location = new Point( 16, 47 );
			fontListBox.Size = new Size( 140, 95 );
			fontListBox.TabIndex = 8;
			fontListBox.Sorted = true;
			// exampleGroupBox
			exampleGroupBox.Controls.Add( examplePanel );
			exampleGroupBox.FlatStyle = FlatStyle.System;
			exampleGroupBox.Location = new Point( 164, 158 );
			exampleGroupBox.Size = new Size( 172, 70 );
			exampleGroupBox.TabIndex = 12;
			exampleGroupBox.TabStop = false;
			exampleGroupBox.Text = "Example";
			// fontstyleListBox
			fontstyleListBox.Location = new Point( 164, 47 );
			fontstyleListBox.Size = new Size( 112, 95 );
			fontstyleListBox.TabIndex = 9;
			// schriftartLabel
			fontLabel.Location = new Point( 16, 10 );
			fontLabel.Size = new Size( 88, 16 );
			fontLabel.TabIndex = 0;
			fontLabel.Text = "Font:";
			// effectsGroupBox
			effectsGroupBox.Controls.Add( underlinedCheckBox );
			effectsGroupBox.Controls.Add( strikethroughCheckBox );
			effectsGroupBox.Controls.Add( colorComboBox );
			effectsGroupBox.FlatStyle = FlatStyle.System;
			effectsGroupBox.Location = new Point( 16, 158 );
			effectsGroupBox.Size = new Size( 140, 116 );
			effectsGroupBox.TabIndex = 11;
			effectsGroupBox.TabStop = false;
			effectsGroupBox.Text = "Effects";
			// strikethroughCheckBox
			strikethroughCheckBox.FlatStyle = FlatStyle.System;
			strikethroughCheckBox.Location = new Point( 8, 16 );
			strikethroughCheckBox.TabIndex = 0;
			strikethroughCheckBox.Text = "Strikethrough";
			// colorComboBox
			colorComboBox.Location = new Point( 8, 70 );
			colorComboBox.Size = new Size( 130, 21 );
			// sizeLabel
			sizeLabel.Location = new Point( 284, 10 );
			sizeLabel.Size = new Size( 100, 16 );
			sizeLabel.TabIndex = 2;
			sizeLabel.Text = "Size:";
			// scriptComboBox
			scriptComboBox.Location = new Point( 164, 253 );
			scriptComboBox.Size = new Size( 172, 21 );
			scriptComboBox.TabIndex = 14;
			scriptComboBox.DropDownStyle = ComboBoxStyle.DropDownList;
			// okButton
			okButton.FlatStyle = FlatStyle.System;
			okButton.Location = new Point( 352, 26 );
			okButton.Size = new Size( 70, 23 );
			okButton.TabIndex = 3;
			okButton.Text = "OK";
			// cancelButton
			cancelButton.FlatStyle = FlatStyle.System;
			cancelButton.Location = new Point( 352, 52 );
			cancelButton.Size = new Size( 70, 23 );
			cancelButton.TabIndex = 4;
			cancelButton.Text = "Cancel";
			// applyButton
			applyButton.FlatStyle = FlatStyle.System;
			applyButton.Location = new Point( 352, 78 );
			applyButton.Size = new Size( 70, 23 );
			applyButton.TabIndex = 5;
			applyButton.Text = "Apply";
			// helpButton
			helpButton.FlatStyle = FlatStyle.System;
			helpButton.Location = new Point( 352, 104 );
			helpButton.Size = new Size( 70, 23 );
			helpButton.TabIndex = 6;
			helpButton.Text = "Help";
			// underlinedCheckBox
			underlinedCheckBox.FlatStyle = FlatStyle.System;
			underlinedCheckBox.Location = new Point( 8, 36 );
			underlinedCheckBox.TabIndex = 1;
			underlinedCheckBox.Text = "Underlined";
			// fontstyleTextBox
			fontstyleTextBox.Location = new Point( 164, 26 );
			fontstyleTextBox.Size = new Size( 112, 21 );
			fontstyleTextBox.TabIndex = 6;
			fontstyleTextBox.Text = "";
			// scriptLabel
			scriptLabel.Location = new Point( 164, 236 );
			scriptLabel.Size = new Size( 100, 16 );
			scriptLabel.TabIndex = 13;
			scriptLabel.Text = "Script:";
			// examplePanel
			examplePanel.Location = new Point( 8, 20 );
			examplePanel.TabIndex = 0;
			examplePanel.Size = new Size( 156, 40 );
			examplePanel.BorderStyle = BorderStyle.Fixed3D;
			
			form.AcceptButton = okButton;
			form.CancelButton = cancelButton;
			
			form.Controls.Add( scriptComboBox );
			form.Controls.Add( scriptLabel );
			form.Controls.Add( exampleGroupBox );
			form.Controls.Add( effectsGroupBox );
			form.Controls.Add( fontsizeListBox );
			form.Controls.Add( fontstyleListBox );
			form.Controls.Add( fontListBox );
			form.Controls.Add( fontsizeTextBox );
			form.Controls.Add( fontstyleTextBox );
			form.Controls.Add( fontTextBox );
			form.Controls.Add( cancelButton );
			form.Controls.Add( okButton );
			form.Controls.Add( sizeLabel );
			form.Controls.Add( fontstyleLabel );
			form.Controls.Add( fontLabel );
			form.Controls.Add( applyButton );
			form.Controls.Add( helpButton );
			
			exampleGroupBox.ResumeLayout( false );
			effectsGroupBox.ResumeLayout( false );
			
			form.Size = new Size( 430, 318 );
			
			form.FormBorderStyle = FormBorderStyle.FixedDialog;
			form.MaximizeBox = false;
			
			form.Text = "Font";
			
			form.ResumeLayout( false );
			
			scriptComboBox.BeginUpdate ();
			scriptComboBox.Items.AddRange (char_sets_names);
			scriptComboBox.SelectedIndex = 0;
			scriptComboBox.EndUpdate ();
			
			applyButton.Hide( );
			helpButton.Hide( );
			colorComboBox.Hide( );
			
			cancelButton.Click += new EventHandler( OnClickCancelButton );
			okButton.Click += new EventHandler( OnClickOkButton );
			applyButton.Click += new EventHandler (OnApplyButton);
			examplePanel.Paint += new PaintEventHandler( OnPaintExamplePanel );
			fontListBox.SelectedIndexChanged += new EventHandler( OnSelectedIndexChangedFontListBox );
			fontsizeListBox.SelectedIndexChanged += new EventHandler( OnSelectedIndexChangedSizeListBox );
			fontstyleListBox.SelectedIndexChanged += new EventHandler( OnSelectedIndexChangedFontStyleListBox );
			underlinedCheckBox.CheckedChanged += new EventHandler( OnCheckedChangedUnderlinedCheckBox );
			strikethroughCheckBox.CheckedChanged += new EventHandler( OnCheckedChangedStrikethroughCheckBox );
			scriptComboBox.SelectedIndexChanged += new EventHandler (OnSelectedIndexChangedScriptComboBox);
			
			fontTextBox.KeyPress += new KeyPressEventHandler (OnFontTextBoxKeyPress);
			fontstyleTextBox.KeyPress += new KeyPressEventHandler (OnFontStyleTextBoxKeyPress);
			fontsizeTextBox.KeyPress += new KeyPressEventHandler (OnFontSizeTextBoxKeyPress);
			
			fontTextBox.TextChanged += new EventHandler (OnFontTextBoxTextChanged);
			fontstyleTextBox.TextChanged += new EventHandler (OnFontStyleTextTextChanged);
			fontsizeTextBox.TextChanged += new EventHandler (OnFontSizeTextBoxTextChanged);
			
			fontTextBox.KeyDown += new KeyEventHandler (OnFontTextBoxKeyDown);
			fontstyleTextBox.KeyDown += new KeyEventHandler (OnFontStyleTextBoxKeyDown);
			fontsizeTextBox.KeyDown += new KeyEventHandler (OnFontSizeTextBoxKeyDown);
			
			fontTextBox.MouseWheel += new MouseEventHandler (OnFontTextBoxMouseWheel);
			fontstyleTextBox.MouseWheel += new MouseEventHandler (OnFontStyleTextBoxMouseWheel);
			fontsizeTextBox.MouseWheel += new MouseEventHandler (OnFontSizeTextBoxMouseWheel);
			
			PopulateFontList ();
		}
Exemplo n.º 60
0
        /// <summary>
        ///     国家コンボボックスを更新する
        /// </summary>
        /// <param name="control">コントロール</param>
        /// <param name="allowEmpty">空項目を許可するかどうか</param>
        private void UpdateCountryComboBox(ComboBox control, bool allowEmpty)
        {
            Graphics g = Graphics.FromHwnd(Handle);
            int margin = DeviceCaps.GetScaledWidth(2) + 1;

            int width = control.Width;
            control.BeginUpdate();
            control.Items.Clear();
            if (allowEmpty)
            {
                control.Items.Add("");
            }
            foreach (Country country in Countries.Tags)
            {
                string s = Countries.GetTagName(country);
                control.Items.Add(s);
                width = Math.Max(width,
                    (int) g.MeasureString(s, control.Font).Width + SystemInformation.VerticalScrollBarWidth + margin);
            }
            control.DropDownWidth = width;
            control.EndUpdate();
        }