예제 #1
0
 private void AddClasses(ArrayList items, mappers map)
 {
     foreach (TypeDeclaration d in map.Classes)
     {
         items.Add(new ComboBoxItem(d, d.Name, (int)0, true, "Class"));
     }
     foreach (DelegateDeclaration d in map.Delegates)
     {
         items.Add(new ComboBoxItem(d, d.Name, (int)0, true, "delegate"));
     }
 }
예제 #2
0
        public async void PopulateCombo()
        {
            // ignore simple movements



            try
            {
                running = true;

                await Task.Delay(2000);

                mappers maps = VSParsers.CSParsers.AnalyzeCSharpFile(textAreaControl.FileName, textAreaControl.Document.Text);

                //ParseInformation parseInfo = Parser.ProjectParser.GetParseInformation(textAreaControl.FileName);
                //if (parseInfo != null)
                //{
                //    if (currentCompilationUnit != (ICompilationUnit)parseInfo.MostRecentCompilationUnit)
                {
                    //currentCompilationUnit = (ICompilationUnit)parseInfo.MostRecentCompilationUnit;
                    //if (currentCompilationUnit != null)
                    {
                        this.Invoke(new Action(() =>
                        {
                            FillClassComboBox(true, maps);
                            FillMembersComboBox();
                            UpdateMembersComboBox();
                        }));
                    }
                }
                // else
                {
                    // UpdateClassComboBox();
                    //UpdateMembersComboBox();
                }
                //}


                running = false;
            }
            catch (Exception ex)
            {
                running = false;
            }
        }
예제 #3
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;
            }
        }