Example #1
0
        private void events_TestLoaded(object sender, NUnit.Util.TestEventArgs args)
        {
            treeMenu.Visible = true;

            availableCategories = this.loader.GetCategories();
            availableList.Items.Clear();
            selectedList.Items.Clear();

            availableList.SuspendLayout();
            foreach (string category in availableCategories)
            {
                availableList.Items.Add(category);
            }
            availableList.ResumeLayout();
        }
Example #2
0
        private void events_TestReloaded(object sender, NUnit.Util.TestEventArgs args)
        {
            // Get new list of available categories
            availableCategories = this.loader.GetCategories();

            // Remove any selected items that are no longer available
            int index = selectedList.Items.Count;

            selectedList.SuspendLayout();
            while (--index >= 0)
            {
                string category = selectedList.Items[index].ToString();
                if (!availableCategories.Contains(category))
                {
                    selectedList.Items.RemoveAt(index);
                }
            }
            selectedList.ResumeLayout();

            // Put any unselected available items availableList
            availableList.Items.Clear();
            availableList.SuspendLayout();
            foreach (string category in availableCategories)
            {
                if (selectedList.FindStringExact(category) < 0)
                {
                    availableList.Items.Add(category);
                }
            }
            availableList.ResumeLayout();

            // Tell the tree what is selected
            UpdateCategoryFilter();
        }
        public static void Process(IChangeSet changes, ListBox listBox)
        {
            IDatabase adapter = new ListviewDatabaseAdapter(listBox);

            listBox.SuspendLayout();
            changes.Apply(adapter);
            listBox.ResumeLayout();
        }
Example #4
0
 public override Control CreateEditorControl()
 {
     ListBox listBox = new ListBox();
     listBox.SuspendLayout();
     listBox.Width = _defaultWidth;
     listBox.Height = _defaultHeight;
     listBox.ResumeLayout();
     listBox.SelectionMode = SelectionMode.One;
     listBox.SelectedIndexChanged += OnChange;
     listBox.IntegralHeight = false;
     return listBox;
 }
Example #5
0
        private void events_TestLoaded(object sender, NUnit.Util.TestEventArgs args)
        {
            treeMenu.Visible = true;

            availableCategories = this.loader.GetCategories();
            availableList.Items.Clear();
            selectedList.Items.Clear();

            availableList.SuspendLayout();
            foreach (string category in availableCategories)
            {
                availableList.Items.Add(category);
            }

            // tree may have restored visual state
            if (!tests.CategoryFilter.IsEmpty)
            {
                ITestFilter filter = tests.CategoryFilter;
                if (filter is NUnit.Core.Filters.NotFilter)
                {
                    filter = ((NUnit.Core.Filters.NotFilter)filter).BaseFilter;
                    this.excludeCheckbox.Checked = true;
                }

                foreach (string cat in ((NUnit.Core.Filters.CategoryFilter)filter).Categories)
                {
                    if (this.availableCategories.Contains(cat))
                    {
                        this.availableList.Items.Remove(cat);
                        this.selectedList.Items.Add(cat);
                        this.excludeCheckbox.Enabled = true;
                    }
                }

                UpdateCategoryFilter();
            }

            availableList.ResumeLayout();
        }
 /// <summary>
 /// Edits a value based on some user input which is collected from a character control.
 /// </summary>
 /// <param name="context"></param>
 /// <param name="provider"></param>
 /// <param name="value"></param>
 /// <returns></returns>
 public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
 {
     _dialogProvider = provider.GetService(typeof(IWindowsFormsEditorService)) as IWindowsFormsEditorService;
     ListBox cmb = new ListBox();
     FontFamily[] fams = FontFamily.Families;
     cmb.SuspendLayout();
     foreach (FontFamily fam in fams)
     {
         cmb.Items.Add(fam.Name);
     }
     cmb.SelectedValueChanged += CmbSelectedValueChanged;
     cmb.ResumeLayout();
     if (_dialogProvider != null) _dialogProvider.DropDownControl(cmb);
     string test = (string)cmb.SelectedItem;
     return test;
 }
Example #7
0
        /// <summary>
        /// Swap items in the toolbar listbox.  i1 should always be less than i2
        /// </summary>
        /// <param name="i1"></param>
        /// <param name="i2"></param>
        private void Swap(int i1, int i2)
        {
            bToolbar = true;
            bool b1 = (i1 == lbToolbar.SelectedIndex);

            string s1 = lbToolbar.Items[i1] as string;
            string s2 = lbToolbar.Items[i2] as string;

            lbToolbar.SuspendLayout();
            lbToolbar.Items.RemoveAt(i2);
            lbToolbar.Items.RemoveAt(i1);
            lbToolbar.Items.Insert(i1, s2);
            lbToolbar.Items.Insert(i2, s1);
            lbToolbar.SelectedIndex = b1? i2: i1;
            lbToolbar.ResumeLayout(true);
        }
        private void cmdGetAllLinks_Click(object sender, System.EventArgs e)
        {
            if (webBrowser.ReadyState == WebBrowserReadyState.Complete)
            {
                this.Cursor = Cursors.WaitCursor;
                lstLinks.SuspendLayout();
                lstLinks.Items.Clear();

                HtmlElementCollection elements = webBrowser.Document.GetElementsByTagName("A");
                foreach (HtmlElement element in elements)
                {
                    lstLinks.Items.Add(element.GetAttribute("href"));
                }
                lstLinks.ResumeLayout();
                this.Cursor = Cursors.Default;
            }
        }
Example #9
0
        public CCSListView()
        {
            //  this.ColumnReordered;

            this.SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint , true);
            this.SetStyle(ControlStyles.EnableNotifyMessage , true);
            ColumnFormatList = new List<ColumnFormat>();
            sortedId = 0;
            dir = direction.ASCENDING;

            this.SmallImageList = new ImageList();

            // this.SmallImageList.Images.Add("ASCENDING", AppStatus.Properties.Resources.sortAscending);
            //this.SmallImageList.Images.Add("DESCENDING", AppStatus.Properties.Resources.sortDescending);
            listBox1 = new ListBox();
            listBox1.Anchor = AnchorStyles.Bottom;
            listBox1.ResumeLayout(false);
               // this.Controls.Add(listBox1);
            System.ComponentModel.IContainer components;
            components = new System.ComponentModel.Container();
            components.Add(listBox1);
        }
Example #10
0
        private void UpdateKeyDescriptions(bool keepIndex)
        {
            string[] str =
            {
                "[↑]", "[↓]", "[←]", "[→]",
                "[Z]", "[X]", "[C]",
                "[A]", "[S]", "[D]",
                "[V]", "[B]",
                "[F]", "[G]",
                "[Q]", "[W]", "[E]"
            };
            int index = lstKeyList.SelectedIndex;

            lstKeyList.SuspendLayout();
            lstKeyList.Items.Clear();
            for (int i = 0; i < str.Length; i++)
            {
                var           key = keylist[i];
                StringBuilder sb  = new StringBuilder();
                //bool flag = false;
                //foreach (var kw in key.Works) {
                //    if (flag) sb.Append(", "); else sb.Append("\t: ");
                //    sb.Append(kw.Target.ValName);
                //    flag = true;
                //}
                sb.Append(key.ToString());

                lstKeyList.Items.Add(string.Format("{0} {1}", str[i], sb.ToString()));
            }

            if (keepIndex)
            {
                lstKeyList.SelectedIndex = index;
            }
            lstKeyList.ResumeLayout();
        }
Example #11
0
        //private void UserSettings_Changed(object sender, SettingsEventArgs args)
        //{
        //	//if ( args.SettingName == "Options.ShowCheckBoxes" )
        //	//	this.ShowCheckBoxes = Services.UserSettings.GetSetting( args.SettingName, false );
        //}

        #region IViewControl Implementation

        public void InitializeView(ITestModel model, TestCentricPresenter presenter)
        {
            Model = model;

            ShowCheckBoxes = Model.Services.UserSettings.Gui.TestTree.ShowCheckBoxes;

            Model.Events.TestLoaded += (TestNodeEventArgs e) =>
            {
                treeMenu.Visible = true;

                availableList.Items.Clear();
                selectedList.Items.Clear();

                availableList.SuspendLayout();
                foreach (string category in Model.AvailableCategories)
                {
                    availableList.Items.Add(category);
                }

                // We need to ensure the tree loads first because that's
                // where we restore visual state and possibly change the
                // selected categories.
                tests.Load(e.Test);

                // Reflect any changes in the controls
                if (Model.SelectedCategories != null && Model.SelectedCategories.Length > 0)
                {
                    selectedList.Items.AddRange(Model.SelectedCategories);
                    excludeCheckbox.Checked = Model.ExcludeSelectedCategories;

                    foreach (string cat in Model.SelectedCategories)
                    {
                        if (Model.AvailableCategories.Contains(cat))
                        {
                            availableList.Items.Remove(cat);
                            excludeCheckbox.Enabled = true;
                        }
                    }

                    UpdateCategorySelection();
                }

                availableList.ResumeLayout();
            };

            Model.Events.TestReloaded += (TestNodeEventArgs e) =>
            {
                // Remove any selected items that are no longer available
                int index = selectedList.Items.Count;
                selectedList.SuspendLayout();
                while (--index >= 0)
                {
                    string category = selectedList.Items[index].ToString();
                    if (!Model.AvailableCategories.Contains(category))
                    {
                        selectedList.Items.RemoveAt(index);
                    }
                }
                selectedList.ResumeLayout();

                // Clear check box if there are no more selected items.
                if (selectedList.Items.Count == 0)
                {
                    excludeCheckbox.Checked = excludeCheckbox.Enabled = false;
                }

                // Put any unselected available items on availableList
                availableList.Items.Clear();
                availableList.SuspendLayout();
                foreach (string category in Model.AvailableCategories)
                {
                    if (selectedList.FindStringExact(category) < 0)
                    {
                        availableList.Items.Add(category);
                    }
                }
                availableList.ResumeLayout();

                // Tell the tree what is selected
                UpdateCategorySelection();
            };

            Model.Events.TestUnloaded += (TestEventArgs e) =>
            {
                availableList.Items.Clear();
                selectedList.Items.Clear();
                excludeCheckbox.Checked = false;
                excludeCheckbox.Enabled = false;
                treeMenu.Visible        = false;
            };

            //Services.UserSettings.Changed += new SettingsEventHandler(UserSettings_Changed);
        }
Example #12
0
		void	PopulateListBox( List< File > _files, ListBox _listBox, Label _label, Dictionary< string, ExtensionFilesGroup > _extensionGroup ) {
			_listBox.SuspendLayout();
			_listBox.Items.Clear();
			_listBox.Items.AddRange( _files.ToArray() );
			_listBox.ResumeLayout();

			// Build the extension group
			_extensionGroup.Clear();
			foreach ( File F in _files ) {
				if ( !_extensionGroup.ContainsKey( F.m_extension ) )
					_extensionGroup.Add( F.m_extension, new ExtensionFilesGroup( F.m_extension ) );
				ExtensionFilesGroup	group = _extensionGroup[F.m_extension];
				group.AddFile( F );
			}

			_label.Text = _files.Count + " files. " + _extensionGroup.Keys.Count + " extensions.";
		}
Example #13
0
        public void InitializeView(ITestModel model)
        {
            Model = model;

            model.Events.TestLoaded += (TestNodeEventArgs e) =>
            {
                availableList.Items.Clear();
                selectedList.Items.Clear();

                availableList.SuspendLayout();
                foreach (string category in model.AvailableCategories)
                {
                    availableList.Items.Add(category);
                }

                // We need to ensure the tree loads first and restore the
                // visual state before checking the seleted categories.
                tests.LoadTests(e.Test);

                if (model.Services.UserSettings.Gui.TestTree.SaveVisualState)
                {
                    string fileName = VisualState.GetVisualStateFileName(Model.TestFiles[0]);
                    if (File.Exists(fileName))
                    {
                        var visualState = VisualState.LoadFrom(fileName);
                        tests.RestoreVisualState(visualState);
                        model.SelectCategories(visualState.SelectedCategories, visualState.ExcludeCategories);
                    }
                }

                // Reflect any changes in the controls
                if (model.SelectedCategories != null && model.SelectedCategories.Length > 0)
                {
                    selectedList.Items.AddRange(model.SelectedCategories);
                    excludeCheckbox.Checked = model.ExcludeSelectedCategories;

                    foreach (string cat in model.SelectedCategories)
                    {
                        if (model.AvailableCategories.Contains(cat))
                        {
                            availableList.Items.Remove(cat);
                            excludeCheckbox.Enabled = true;
                        }
                    }

                    UpdateCategorySelection();
                }

                availableList.ResumeLayout();
            };

            model.Events.TestReloaded += (TestNodeEventArgs e) =>
            {
                // Remove any selected items that are no longer available
                int index = selectedList.Items.Count;
                selectedList.SuspendLayout();
                while (--index >= 0)
                {
                    string category = selectedList.Items[index].ToString();
                    if (!model.AvailableCategories.Contains(category))
                    {
                        selectedList.Items.RemoveAt(index);
                    }
                }
                selectedList.ResumeLayout();

                // Clear check box if there are no more selected items.
                if (selectedList.Items.Count == 0)
                {
                    excludeCheckbox.Checked = excludeCheckbox.Enabled = false;
                }

                // Put any unselected available items on availableList
                availableList.Items.Clear();
                availableList.SuspendLayout();
                foreach (string category in model.AvailableCategories)
                {
                    if (selectedList.FindStringExact(category) < 0)
                    {
                        availableList.Items.Add(category);
                    }
                }
                availableList.ResumeLayout();

                // Tell the tree what is selected
                UpdateCategorySelection();
            };

            model.Events.TestUnloaded += (TestEventArgs e) =>
            {
                availableList.Items.Clear();
                selectedList.Items.Clear();
                excludeCheckbox.Checked = false;
                excludeCheckbox.Enabled = false;
            };
        }