// recursive depth-first search for repeated collection private bool FindRepeatedCollection(ArrayList collections) { for (int i = 0; i < Count; ++i) { CollectionContainer cc = this[i] as CollectionContainer; if (cc != null && cc.Collection != null) { CompositeCollection composite = cc.Collection as CompositeCollection; if (composite != null) { if (composite.FindRepeatedCollection(collections)) { return(true); } } else if (collections.IndexOf(cc.Collection) > -1) { return(true); } else { collections.Add(cc.Collection); } } } return(false); }
// Token: 0x06001B48 RID: 6984 RVA: 0x00080651 File Offset: 0x0007E851 private void AddCollectionContainer(CollectionContainer cc) { if (this.InternalList.Contains(cc)) { throw new ArgumentException(SR.Get("CollectionContainerMustBeUniqueForComposite"), "cc"); } CollectionChangedEventManager.AddHandler(cc, new EventHandler <NotifyCollectionChangedEventArgs>(this.OnContainedCollectionChanged)); }
// Unhook a newly-deleted CollectionContainer private void RemoveCollectionContainer(CollectionContainer cc) { CollectionChangedEventManager.RemoveHandler(cc, OnContainedCollectionChanged); #if DEBUG _hasRepeatedCollectionIsValid = false; #endif }
/// <summary>Inserts an item in the collection at a given index. All items after the given position are moved down by one. </summary> /// <param name="insertIndex">The index to insert the item at.</param> /// <param name="insertItem">The item reference to add to the collection.</param> /// <exception cref="T:System.ArgumentOutOfRangeException">If index is out of range.</exception> // Token: 0x06001B32 RID: 6962 RVA: 0x000803CC File Offset: 0x0007E5CC public void Insert(int insertIndex, object insertItem) { CollectionContainer collectionContainer = insertItem as CollectionContainer; if (collectionContainer != null) { this.AddCollectionContainer(collectionContainer); } this.InternalList.Insert(insertIndex, insertItem); this.OnCollectionChanged(NotifyCollectionChangedAction.Add, insertItem, insertIndex); }
// Token: 0x06001B4D RID: 6989 RVA: 0x000806F8 File Offset: 0x0007E8F8 internal void GetCollectionChangedSources(int level, Action <int, object, bool?, List <string> > format, List <string> sources) { format(level, this, new bool?(false), sources); foreach (object obj in this.InternalList) { CollectionContainer collectionContainer = obj as CollectionContainer; if (collectionContainer != null) { collectionContainer.GetCollectionChangedSources(level + 1, format, sources); } } }
internal void GetCollectionChangedSources(int level, Action <int, object, bool?, List <string> > format, List <string> sources) { format(level, this, false, sources); foreach (object o in InternalList) { CollectionContainer cc = o as CollectionContainer; if (cc != null) { cc.GetCollectionChangedSources(level + 1, format, sources); } } }
/// <summary>Adds the specified item to this collection.</summary> /// <param name="newItem">New item to add to the collection.</param> /// <returns>Zero-based index where the new item is added.</returns> // Token: 0x06001B2E RID: 6958 RVA: 0x00080328 File Offset: 0x0007E528 public int Add(object newItem) { CollectionContainer collectionContainer = newItem as CollectionContainer; if (collectionContainer != null) { this.AddCollectionContainer(collectionContainer); } int num = this.InternalList.Add(newItem); this.OnCollectionChanged(NotifyCollectionChangedAction.Add, newItem, num); return(num); }
// Hook up to a newly-added CollectionContainer private void AddCollectionContainer(CollectionContainer cc) { if (InternalList.Contains(cc)) { throw new ArgumentException(SR.Get(SRID.CollectionContainerMustBeUniqueForComposite), "cc"); } CollectionChangedEventManager.AddHandler(cc, OnContainedCollectionChanged); #if DEBUG _hasRepeatedCollectionIsValid = false; #endif }
/// <summary> /// Add an item to this collection. /// </summary> /// <param name="newItem"> /// New item to be added to collection /// </param> /// <returns> /// Zero-based index where the new item is added. /// </returns> /// <exception cref="ArgumentException"> /// CompositeCollection can only accept CollectionContainers it doesn't already have. /// </exception> public int Add(object newItem) { CollectionContainer cc = newItem as CollectionContainer; if (cc != null) { AddCollectionContainer(cc); } int addedIndex = InternalList.Add(newItem); OnCollectionChanged(NotifyCollectionChangedAction.Add, newItem, addedIndex); return(addedIndex); }
/// <summary> /// Insert an item in the collection at a given index. All items /// after the given position are moved down by one. /// </summary> /// <param name="insertIndex"> /// The index at which to inser the item /// </param> /// <param name="insertItem"> /// The item reference to be added to the collection /// </param> /// <exception cref="ArgumentOutOfRangeException"> /// Thrown if index is out of range /// </exception> public void Insert(int insertIndex, object insertItem) { CollectionContainer cc = insertItem as CollectionContainer; if (cc != null) { AddCollectionContainer(cc); } // ArrayList implementation checks index and will throw out of range exception InternalList.Insert(insertIndex, insertItem); OnCollectionChanged(NotifyCollectionChangedAction.Add, insertItem, insertIndex); }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: #line 14 "..\..\..\Windows\AddEntityTypeWindow.xaml" ((ICSharpCode.Data.EDMDesigner.Core.UI.Windows.AddEntityTypeWindow)(target)).Loaded += new System.Windows.RoutedEventHandler(this.Window_Loaded); #line default #line hidden return; case 2: this.entityTypeNameTextBox = ((System.Windows.Controls.TextBox)(target)); return; case 3: this.baseEntityTypeComboBox = ((ICSharpCode.Data.EDMDesigner.Core.UI.UserControls.ComboBoxEditableWhenFocused)(target)); return; case 4: this.nullEntityTypeCollection = ((System.Windows.Data.CollectionContainer)(target)); return; case 5: this.entityTypeCollection = ((System.Windows.Data.CollectionContainer)(target)); return; case 6: #line 53 "..\..\..\Windows\AddEntityTypeWindow.xaml" ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.CancelButton_Click); #line default #line hidden return; case 7: #line 54 "..\..\..\Windows\AddEntityTypeWindow.xaml" ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.OkButton_Click); #line default #line hidden return; } this._contentLoaded = true; }
/// <summary> /// Clears the collection. Releases the references on all items /// currently in the collection. /// </summary> public void Clear() { // unhook contained collections for (int k = 0, n = InternalList.Count; k < n; ++k) { CollectionContainer cc = this[k] as CollectionContainer; if (cc != null) { RemoveCollectionContainer(cc); } } InternalList.Clear(); OnCollectionChanged(NotifyCollectionChangedAction.Reset); }
/// <summary>Removes an item from the collection at the given index. All remaining items move up by one. </summary> /// <param name="removeIndex">The index at which to remove an item.</param> /// <exception cref="T:System.ArgumentOutOfRangeException">If index is out of range.</exception> // Token: 0x06001B34 RID: 6964 RVA: 0x00080428 File Offset: 0x0007E628 public void RemoveAt(int removeIndex) { if (0 <= removeIndex && removeIndex < this.Count) { object obj = this[removeIndex]; CollectionContainer collectionContainer = obj as CollectionContainer; if (collectionContainer != null) { this.RemoveCollectionContainer(collectionContainer); } this.InternalList.RemoveAt(removeIndex); this.OnCollectionChanged(NotifyCollectionChangedAction.Remove, obj, removeIndex); return; } throw new ArgumentOutOfRangeException("removeIndex", SR.Get("ItemCollectionRemoveArgumentOutOfRange")); }
public dynWorkspaceViewModel(dynWorkspaceModel model, DynamoViewModel vm) { _model = model; this.CurrentOffset = new Point(10,10); var nodesColl = new CollectionContainer(); nodesColl.Collection = Nodes; WorkspaceElements.Add(nodesColl); var connColl = new CollectionContainer(); connColl.Collection = Connectors; WorkspaceElements.Add(connColl); var notesColl = new CollectionContainer(); notesColl.Collection = Notes; WorkspaceElements.Add(notesColl); //var watch3DColl = new CollectionContainer(); //watch3DColl.Collection = Watch3DViewModels; //WorkspaceElements.Add(watch3DColl); Watch3DViewModels.Add(new Watch3DFullscreenViewModel(this)); //respond to collection changes on the model by creating new view models //currently, view models are added for notes and nodes //connector view models are added during connection _model.Nodes.CollectionChanged += Nodes_CollectionChanged; _model.Notes.CollectionChanged += Notes_CollectionChanged; _model.Connectors.CollectionChanged += Connectors_CollectionChanged; _model.PropertyChanged += ModelPropertyChanged; HideCommand = new DelegateCommand<object>(Hide, CanHide); CrossSelectCommand = new DelegateCommand<object>(CrossingSelect, CanCrossSelect); ContainSelectCommand = new DelegateCommand<object>(ContainSelect, CanContainSelect); SetCurrentOffsetCommand = new DelegateCommand<object>(SetCurrentOffset, CanSetCurrentOffset); NodeFromSelectionCommand = new DelegateCommand(CreateNodeFromSelection, CanCreateNodeFromSelection); SetZoomCommand = new DelegateCommand<object>(SetZoom, CanSetZoom); DynamoSelection.Instance.Selection.CollectionChanged += NodeFromSelectionCanExecuteChanged; // sync collections Nodes_CollectionChanged(null, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, _model.Nodes)); Connectors_CollectionChanged(null, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, _model.Connectors)); Notes_CollectionChanged(null, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, _model.Notes)); }
/// <summary>Clears the collection.</summary> // Token: 0x06001B2F RID: 6959 RVA: 0x00080360 File Offset: 0x0007E560 public void Clear() { int i = 0; int count = this.InternalList.Count; while (i < count) { CollectionContainer collectionContainer = this[i] as CollectionContainer; if (collectionContainer != null) { this.RemoveCollectionContainer(collectionContainer); } i++; } this.InternalList.Clear(); this.OnCollectionChanged(NotifyCollectionChangedAction.Reset); }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.columnComboBox = ((ICSharpCode.Data.EDMDesigner.Core.UI.UserControls.ComboBoxEditableWhenFocused)(target)); return; case 2: this.columnNullValues = ((System.Windows.Data.CollectionContainer)(target)); return; case 3: this.columns = ((System.Windows.Data.CollectionContainer)(target)); return; } this._contentLoaded = true; }
/// <summary> /// Removes an item from the collection at the given index. All /// remaining items move up by one. /// </summary> /// <param name="removeIndex"> /// The index at which to remove an item. /// </param> /// <exception cref="ArgumentOutOfRangeException"> /// Thrown if index is out of range /// </exception> public void RemoveAt(int removeIndex) { if ((0 <= removeIndex) && (removeIndex < Count)) { object removedItem = this[removeIndex]; CollectionContainer cc = removedItem as CollectionContainer; if (cc != null) { RemoveCollectionContainer(cc); } InternalList.RemoveAt(removeIndex); OnCollectionChanged(NotifyCollectionChangedAction.Remove, removedItem, removeIndex); } else { throw new ArgumentOutOfRangeException("removeIndex", SR.Get(SRID.ItemCollectionRemoveArgumentOutOfRange)); } }
public dynWorkspaceViewModel(dynWorkspaceModel model, DynamoViewModel vm) { _model = model; var nodesColl = new CollectionContainer { Collection = Nodes }; WorkspaceElements.Add(nodesColl); var connColl = new CollectionContainer { Collection = Connectors }; WorkspaceElements.Add(connColl); var notesColl = new CollectionContainer { Collection = Notes }; WorkspaceElements.Add(notesColl); //respond to collection changes on the model by creating new view models //currently, view models are added for notes and nodes //connector view models are added during connection _model.Nodes.CollectionChanged += Nodes_CollectionChanged; _model.Notes.CollectionChanged += Notes_CollectionChanged; _model.Connectors.CollectionChanged += Connectors_CollectionChanged; _model.PropertyChanged += ModelPropertyChanged; HideCommand = new DelegateCommand<object>(Hide, CanHide); CrossSelectCommand = new DelegateCommand<object>(CrossingSelect, CanCrossSelect); ContainSelectCommand = new DelegateCommand<object>(ContainSelect, CanContainSelect); SetCurrentOffsetCommand = new DelegateCommand<object>(SetCurrentOffset, CanSetCurrentOffset); NodeFromSelectionCommand = new DelegateCommand(CreateNodeFromSelection, CanCreateNodeFromSelection); SetZoomCommand = new DelegateCommand<object>(SetZoom, CanSetZoom); FindByIdCommand = new DelegateCommand<object>(FindById, CanFindById); AlignSelectedCommand = new DelegateCommand<string>(AlignSelected, CanAlignSelected); SelectAllCommand = new DelegateCommand(SelectAll, CanSelectAll); FindNodesFromSelectionCommand = new DelegateCommand(FindNodesFromSelection, CanFindNodesFromSelection); DynamoSelection.Instance.Selection.CollectionChanged += NodeFromSelectionCanExecuteChanged; // sync collections Nodes_CollectionChanged(null, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, _model.Nodes)); Connectors_CollectionChanged(null, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, _model.Connectors)); Notes_CollectionChanged(null, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, _model.Notes)); }
private void DefineCellsPane_DataContextChanged(object sender, DependencyPropertyChangedEventArgs e) { if (this.DataContext == null || !(this.DataContext is WorkbookModel)) return; var myWorkbookModel = this.DataContext as WorkbookModel; var defineCellsCollection = new CompositeCollection(); #region collection containers var inputCellsCContoiner = new CollectionContainer() { Collection = myWorkbookModel.InputCells }; defineCellsCollection.Add(inputCellsCContoiner); var intermediateCellsCContainer = new CollectionContainer() { Collection = myWorkbookModel.IntermediateCells }; defineCellsCollection.Add(intermediateCellsCContainer); var outputCellsCContainer = new CollectionContainer() { Collection = myWorkbookModel.OutputCells }; defineCellsCollection.Add(outputCellsCContainer); #endregion var defineCellsBinding = new Binding() { Source = defineCellsCollection, Mode = BindingMode.OneWay }; this.CellDefinitionsList.SetBinding(ListBox.ItemsSourceProperty, defineCellsBinding); }
internal virtual void ShowContextMenu(Card card) { if (Player.LocalPlayer.Spectator) return; // Modify selection if (card == null || !card.Selected) Selection.Clear(); var menuItems = new CompositeCollection(); ContextGroup = group; ContextMenu = new ContextMenu {ItemsSource = menuItems, Tag = card}; // card has to captured somehow, otherwise it may be overwritten before released in the OnClosed handler, e.g. when rightclicking on a card, then directly right-clicking on another card. ContextMenu.Opened += (sender, args) => { ContextGroup.KeepControl(); var c = ((ContextMenu) sender).Tag as Card; if (c != null) c.KeepControl(); }; ContextMenu.Closed += (sender, args) => { ContextGroup.ReleaseControl(); var c = ((ContextMenu) sender).Tag as Card; if (c != null) c.ReleaseControl(); }; ContextCard = card; menuItems.Clear(); if (card != null) { //var cardMenuItems = await CreateCardMenuItems(card, group.Definition); var cardMenuItems = CreateCardMenuItems(card, group.Definition); var container = new CollectionContainer { Collection = cardMenuItems }; menuItems.Add(container); } if (ShouldShowGroupActions(card)) { var container = new CollectionContainer { Collection = CreateGroupMenuItems(group.Definition) }; menuItems.Add(container); } //else // Group is being shuffled // return; ContextMenu.IsOpen = false; // Required to trigger the ReleaseControl calls if the ContextMenu was already open ContextMenu.UpdateLayout(); // Required if the ContextMenu was already open ContextMenu.IsOpen = true; ContextMenu.FontFamily = groupFont; ContextMenu.FontSize = fontsize; }
public WorkspaceViewModel(WorkspaceModel model, DynamoViewModel vm) { _model = model; stateMachine = new StateMachine(this); //setup the composite collection var previewsColl = new CollectionContainer { Collection = Previews }; _workspaceElements.Add(previewsColl); var nodesColl = new CollectionContainer { Collection = Nodes }; _workspaceElements.Add(nodesColl); var connColl = new CollectionContainer { Collection = Connectors }; _workspaceElements.Add(connColl); var notesColl = new CollectionContainer { Collection = Notes }; _workspaceElements.Add(notesColl); var errorsColl = new CollectionContainer { Collection = Errors }; _workspaceElements.Add(errorsColl); // Add EndlessGrid var endlessGrid = new EndlessGridViewModel(this); _workspaceElements.Add(endlessGrid); //respond to collection changes on the model by creating new view models //currently, view models are added for notes and nodes //connector view models are added during connection _model.Nodes.CollectionChanged += Nodes_CollectionChanged; _model.Notes.CollectionChanged += Notes_CollectionChanged; _model.Connectors.CollectionChanged += Connectors_CollectionChanged; _model.PropertyChanged += ModelPropertyChanged; // sync collections Nodes_CollectionChanged(null, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, _model.Nodes)); Connectors_CollectionChanged(null, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, _model.Connectors)); Notes_CollectionChanged(null, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, _model.Notes)); Dispatcher = System.Windows.Threading.Dispatcher.CurrentDispatcher; }
// Called when CollectionProperty is changed on "d." private static void OnCollectionPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { CollectionContainer cc = (CollectionContainer)d; cc.HookUpToCollection((IEnumerable)e.NewValue, true); }
public WorkspaceViewModel(WorkspaceModel model, DynamoViewModel dynamoViewModel) { this.DynamoViewModel = dynamoViewModel; this.DynamoViewModel.PropertyChanged += DynamoViewModel_PropertyChanged; Model = model; stateMachine = new StateMachine(this); var nodesColl = new CollectionContainer { Collection = Nodes }; _workspaceElements.Add(nodesColl); var connColl = new CollectionContainer { Collection = Connectors }; _workspaceElements.Add(connColl); var notesColl = new CollectionContainer { Collection = Notes }; _workspaceElements.Add(notesColl); var errorsColl = new CollectionContainer { Collection = Errors }; _workspaceElements.Add(errorsColl); var annotationsColl = new CollectionContainer {Collection = Annotations}; _workspaceElements.Add(annotationsColl); //respond to collection changes on the model by creating new view models //currently, view models are added for notes and nodes //connector view models are added during connection Model.NodeAdded += Model_NodeAdded; Model.NodeRemoved += Model_NodeRemoved; Model.NodesCleared += Model_NodesCleared; Model.Notes.CollectionChanged += Notes_CollectionChanged; Model.Annotations.CollectionChanged +=Annotations_CollectionChanged; Model.ConnectorAdded += Connectors_ConnectorAdded; Model.ConnectorDeleted += Connectors_ConnectorDeleted; Model.PropertyChanged += ModelPropertyChanged; DynamoSelection.Instance.Selection.CollectionChanged += (sender, e) => RefreshViewOnSelectionChange(); // sync collections foreach (NodeModel node in Model.Nodes) Model_NodeAdded(node); Notes_CollectionChanged(null, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, Model.Notes)); Annotations_CollectionChanged(null, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, Model.Annotations)); foreach (var c in Model.Connectors) Connectors_ConnectorAdded(c); InCanvasSearchViewModel = new SearchViewModel(DynamoViewModel); InCanvasSearchViewModel.Visible = true; }
// Hook up to a newly-added CollectionContainer private void AddCollectionContainer(CollectionContainer cc) { if (InternalList.Contains(cc)) throw new ArgumentException(SR.Get(SRID.CollectionContainerMustBeUniqueForComposite), "cc"); CollectionChangedEventManager.AddListener(cc, this); #if DEBUG _hasRepeatedCollectionIsValid = false; #endif }
public WorkspaceViewModel(WorkspaceModel model, DynamoViewModel dynamoViewModel) { this.DynamoViewModel = dynamoViewModel; Model = model; stateMachine = new StateMachine(this); var nodesColl = new CollectionContainer { Collection = Nodes }; _workspaceElements.Add(nodesColl); var connColl = new CollectionContainer { Collection = Connectors }; _workspaceElements.Add(connColl); var notesColl = new CollectionContainer { Collection = Notes }; _workspaceElements.Add(notesColl); var errorsColl = new CollectionContainer { Collection = Errors }; _workspaceElements.Add(errorsColl); var annotationsColl = new CollectionContainer {Collection = Annotations}; _workspaceElements.Add(annotationsColl); //respond to collection changes on the model by creating new view models //currently, view models are added for notes and nodes //connector view models are added during connection Model.NodeAdded += Model_NodeAdded; Model.NodeRemoved += Model_NodeRemoved; Model.NodesCleared += Model_NodesCleared; Model.NoteAdded += Model_NoteAdded; Model.NoteRemoved += Model_NoteRemoved; Model.NotesCleared += Model_NotesCleared; Model.AnnotationAdded += Model_AnnotationAdded; Model.AnnotationRemoved += Model_AnnotationRemoved; Model.AnnotationsCleared += Model_AnnotationsCleared; Model.ConnectorAdded += Connectors_ConnectorAdded; Model.ConnectorDeleted += Connectors_ConnectorDeleted; Model.PropertyChanged += ModelPropertyChanged; DynamoSelection.Instance.Selection.CollectionChanged += (sender, e) => RefreshViewOnSelectionChange(); DynamoViewModel.CopyCommand.CanExecuteChanged += CopyPasteChanged; DynamoViewModel.PasteCommand.CanExecuteChanged += CopyPasteChanged; // sync collections foreach (NodeModel node in Model.Nodes) Model_NodeAdded(node); foreach (NoteModel note in Model.Notes) Model_NoteAdded(note); foreach (AnnotationModel annotation in Model.Annotations) Model_AnnotationAdded(annotation); foreach (ConnectorModel connector in Model.Connectors) Connectors_ConnectorAdded(connector); InCanvasSearchViewModel = new SearchViewModel(DynamoViewModel); InCanvasSearchViewModel.Visible = true; }
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { var sourceClass = value as TagClass; if (sourceClass == null) return null; //hax 2 tha max var nullTag = new TagEntry(null, null, "(null)"); var tagList = new CompositeCollection(); tagList.Add(nullTag); var mainTagListContainer = new CollectionContainer(); mainTagListContainer.Collection = sourceClass.Children; tagList.Add(mainTagListContainer); return tagList; }
public RoutineBuilder(Routine routine) { //View initialization InitializeComponent(); LivePreview = false; //Initialize Routine _routine = routine; _routine.RoutineBuilder = this; tbxRoutineName.Text = _routine.Name; this.Title = _routine.Name; //Build Canvas toolbar - drawing shapes icons toolbarButtons = new List<ToggleButton>(); toolbarButtons.Add(btnToolbarMove); toolbarButtons.Add(btnToolbarArc); toolbarButtons.Add(btnToolbarCircle); toolbarButtons.Add(btnToolbarDot); toolbarButtons.Add(btnToolbarLine); toolbarButtons.Add(btnToolbarPolyline); toolbarButtons.Add(btnToolbarRectangle); toolbarButtons.Add(btnToolbarReferencePoint); toolbarButtons.Add(btnToolbarAttrPoint); _activeTool = null; _drawing = false; _movingShape = false; _movingReferencePoint = false; _movingAttributePoint = false; _makingPath = false; _makingPathStep2 = false; attributePointPopup = new AttributePointPopup(); //Build "Add Fixture" popup addFixturePop = new AddFixturePopup(); addFixturePop.AddSelectedClick += new RoutedEventHandler(SubroutineBuilder_AddSelectedClick); //Initialize Timeline CollectionContainer items = new CollectionContainer(); items.Collection = _routine.RoutineFixtures; CollectionContainer newFixtureLineCollection = new CollectionContainer(); BindingList<string> newFixtureLine = new BindingList<string>(); newFixtureLine.Add("Click here to add a fixture..."); newFixtureLineCollection.Collection = newFixtureLine; CompositeCollection cmpc = new CompositeCollection(); cmpc.Add(items); cmpc.Add(newFixtureLineCollection); lbxTimeline.ItemsSource = cmpc; //lbxTimeline.ItemsSource = _routine.RoutineFixtures; _lastSelectedFixture = null; //Step items list. necessary? lbxSteps.ItemsSource = null; //Reference Point list. lbxReferencePoints.ItemsSource = null; }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.tablesComboBox = ((ICSharpCode.Data.EDMDesigner.Core.UI.UserControls.ComboBoxEditableWhenFocused)(target)); return; case 2: this.tableNullValues = ((System.Windows.Data.CollectionContainer)(target)); return; case 3: this.tablesValues = ((System.Windows.Data.CollectionContainer)(target)); return; case 4: this.hesCheckBox = ((System.Windows.Controls.CheckBox)(target)); return; case 5: this.tableMappingTreeView = ((System.Windows.Controls.TreeView)(target)); return; case 6: this.conditionsTreeViewItem = ((ICSharpCode.Data.EDMDesigner.Core.UI.UserControls.Mapping.TreeViewItemMapping)(target)); return; case 7: this.columnConditionsTreeViewItem = ((ICSharpCode.Data.EDMDesigner.Core.UI.UserControls.Mapping.TreeViewItemMapping)(target)); return; case 8: this.columnConditionsGrid = ((System.Windows.Controls.DataGrid)(target)); return; case 9: this.addColumnConditionButton = ((System.Windows.Controls.Button)(target)); #line 75 "..\..\..\..\UserControls\Mapping\EntityTableMapping.xaml" this.addColumnConditionButton.Click += new System.Windows.RoutedEventHandler(this.AddColumnConditionButton_Click); #line default #line hidden return; case 10: this.propertyConditionsTreeViewItem = ((ICSharpCode.Data.EDMDesigner.Core.UI.UserControls.Mapping.TreeViewItemMapping)(target)); return; case 11: this.propertyConditionsGrid = ((System.Windows.Controls.DataGrid)(target)); return; case 12: this.addPropertyConditionButton = ((System.Windows.Controls.Button)(target)); #line 105 "..\..\..\..\UserControls\Mapping\EntityTableMapping.xaml" this.addPropertyConditionButton.Click += new System.Windows.RoutedEventHandler(this.AddPropertyConditionButton_Click); #line default #line hidden return; case 13: this.propertiesTreeViewItem = ((ICSharpCode.Data.EDMDesigner.Core.UI.UserControls.Mapping.TreeViewItemMapping)(target)); return; case 14: this.propertiesMappingControl = ((ICSharpCode.Data.EDMDesigner.Core.UI.UserControls.Mapping.EntityPropertiesMapping)(target)); return; case 15: this.complexPropertiesMappingControl = ((ICSharpCode.Data.EDMDesigner.Core.UI.UserControls.Mapping.ComplexPropertiesMapping)(target)); return; } this._contentLoaded = true; }
private void ScenarioDetailPane_DataContextChanged(object sender, DependencyPropertyChangedEventArgs e) { if (this.DataContext == null || !(this.DataContext is Scenario)) return; var myScenario = this.DataContext as Scenario; //update bindings #region binding definitions var titleBinding = new Binding() { Source = myScenario, Path = new PropertyPath("Title"), Mode = BindingMode.TwoWay, UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged }; var authorBinding = new Binding() { Source = myScenario, Path = new PropertyPath("Author"), Mode = BindingMode.TwoWay, UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged }; var creationDateBinding = new Binding() { Source = myScenario, Path = new PropertyPath("CrationDate"), Mode = BindingMode.TwoWay, UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged }; var ratingBinding = new Binding() { Source = myScenario, Path = new PropertyPath("Rating"), Mode = BindingMode.TwoWay, UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged }; var descriptionBinding = new Binding() { Source = myScenario, Path = new PropertyPath("Description"), Mode = BindingMode.TwoWay, UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged }; #endregion #region set bindings //task pane title this.PaneTitle.SetBinding(TextBlock.TextProperty, titleBinding); //general #region general //title this.TitleTextBox.SetBinding(TextBox.TextProperty, titleBinding); //author this.AuthorTextbox.SetBinding(TextBox.TextProperty, authorBinding); //creation date this.CreateDatePicker.SetBinding(DatePicker.SelectedDateProperty, creationDateBinding); //rating this.RatingTextBox.SetBinding(TextBox.TextProperty, ratingBinding); #endregion //description this.DescriptionTextBox.SetBinding(TextBox.TextProperty, descriptionBinding); // input, intermediate and result cells data ScenarioDataCollection = new CompositeCollection(); #region collection container var inputDataCContainer = new CollectionContainer() { Collection = (this.DataContext as Scenario).Inputs }; ScenarioDataCollection.Add(inputDataCContainer); var intermediateCContainer = new CollectionContainer() { Collection = (this.DataContext as Scenario).Intermediates }; ScenarioDataCollection.Add(intermediateCContainer); var resultDataCContainer = new CollectionContainer() { Collection = (this.DataContext as Scenario).Results }; ScenarioDataCollection.Add(resultDataCContainer); #endregion /*this.ScenarioDataView = new ListCollectionView(scenarioDataCollection); this.ScenarioDataView.SortDescriptions.Add(new SortDescription("Location", ListSortDirection.Ascending));*/ this.ScenarioDataListBox.ItemsSource = ScenarioDataCollection; #endregion }
public WorkspaceViewModel(WorkspaceModel model, DynamoViewModel dynamoViewModel) { this.DynamoViewModel = dynamoViewModel; Model = model; stateMachine = new StateMachine(this); var nodesColl = new CollectionContainer { Collection = Nodes }; _workspaceElements.Add(nodesColl); var connColl = new CollectionContainer { Collection = Connectors }; _workspaceElements.Add(connColl); var notesColl = new CollectionContainer { Collection = Notes }; _workspaceElements.Add(notesColl); var errorsColl = new CollectionContainer { Collection = Errors }; _workspaceElements.Add(errorsColl); // Add EndlessGrid var endlessGrid = new EndlessGridViewModel(this); _workspaceElements.Add(endlessGrid); //respond to collection changes on the model by creating new view models //currently, view models are added for notes and nodes //connector view models are added during connection Model.Nodes.CollectionChanged += Nodes_CollectionChanged; Model.Notes.CollectionChanged += Notes_CollectionChanged; Model.Connectors.CollectionChanged += Connectors_CollectionChanged; Model.PropertyChanged += ModelPropertyChanged; DynamoSelection.Instance.Selection.CollectionChanged += this.AlignSelectionCanExecuteChanged; // sync collections Nodes_CollectionChanged(null, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, Model.Nodes)); Connectors_CollectionChanged(null, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, Model.Connectors)); Notes_CollectionChanged(null, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, Model.Notes)); }
private int DeduceFlatIndexForRemove(CollectionContainer sender, int x, object item) { // sender didn't provide an index, but we need to know at least // whether the removed item comes before or after CurrentPosition int flatIndex; if (_currentPositionX > x) { flatIndex = 0; } else if (_currentPositionX < x) { flatIndex = CurrentPosition + 1; } else { if (Object.Equals(item, CurrentItem)) { flatIndex = CurrentPosition; } else { object item2 = ((CollectionContainer)sender).ViewItem(_currentPositionY); if (Object.Equals(item, item2)) { flatIndex = CurrentPosition + 1; } else { flatIndex = 0; } } } return flatIndex; }
// Unhook a newly-deleted CollectionContainer private void RemoveCollectionContainer(CollectionContainer cc) { CollectionChangedEventManager.RemoveListener(cc, this); #if DEBUG _hasRepeatedCollectionIsValid = false; #endif }
// Token: 0x06001B49 RID: 6985 RVA: 0x00080688 File Offset: 0x0007E888 private void RemoveCollectionContainer(CollectionContainer cc) { CollectionChangedEventManager.RemoveHandler(cc, new EventHandler <NotifyCollectionChangedEventArgs>(this.OnContainedCollectionChanged)); }