/// <summary> /// Adds an Item to Items /// </summary> /// <param name="source">Source to use to create item</param> /// <param name="name">Name of the item (UI only)</param> /// <returns></returns> public Item Add(Source source, string name) { var sceneitem = base.Add(source); var item = new Item(sceneitem.GetPointer()) { Name = name }; sceneitem.Dispose(); return item; }
/// <summary> /// Create a property dialog for an existing source /// </summary> /// <param name="source">Source of type ObsSource</param> public TestFilter(Source source) : this() { FilterSource = source; sourceSettings = FilterSource.GetSettings(); FilterListBox.DisplayMember = "Name"; FilterListBox.DataSource = FilterSource.Filters; oldfilters = FilterSource.Filters; undoButton.Enabled = false; defaultButton.Enabled = false; if (FilterSource.Filters.Any()) { Select(FilterSource.Filters.First()); undoButton.Enabled = true; defaultButton.Enabled = true; } defaultButton.Click += (sender, args) => { view.ResetToDefaults(); }; okButton.Click += (o, args) => { if (view != null) { view.UpdateSettings(); } DialogResult = DialogResult.OK; Close(); }; cancelButton.Click += (o, args) => { FilterSource.ClearFilters(); foreach (Filter oldfilter in oldfilters) { FilterSource.AddFilter(oldfilter); } DialogResult = DialogResult.Cancel; Close(); }; undoButton.Click += (sender, args) => { view.ResetChanges(); }; AddFilterButton.Click += (sender, args) => { FilterMenu().Show(this, PointToClient(Cursor.Position)); }; RemoveFilterButton.Click += (sender, args) => { if (SelectedFilter != null) { FilterSource.RemoveFilter(SelectedFilter); propertyPanel.Controls.Clear(); view = null; } }; }