public void ICVF_Remove() { EntitySet <City> entitySet; EntityCollection <City> entityCollection = this.CreateEntityCollection(out entitySet); IEditableCollectionView view = this.GetIECV(entityCollection); City city = (City)view.AddNew(); city.Name = "Des Moines"; city.CountyName = "King"; city.StateName = "WA"; view.CommitNew(); entityCollection.Add(this.CreateLocalCity("Normandy Park")); entityCollection.Add(this.CreateLocalCity("SeaTac")); // This one was added through the view and will be removed from both view.Remove(city); Assert.IsFalse(entityCollection.Contains(city), "EntityCollection should no longer contain the first entity."); Assert.IsFalse(entitySet.Contains(city), "EntitySet should no longer contain the first entity."); // This one was added directly and will only be removed for the collection city = entityCollection.ElementAt(1); view.Remove(city); Assert.IsFalse(entityCollection.Contains(city), "EntityCollection should no longer contain the entity at index 1."); Assert.IsTrue(entitySet.Contains(city), "EntitySet should still contain the entity at index 1."); }
private void Update_Click(object sender, RoutedEventArgs e) { if (_currentItem == null) { return; } var generator = new Generator { DomainField = { Text = _currentItem[0] }, UsernameField = { Text = _currentItem[1] }, OutputField = { Text = _currentItem[2] }, TimeUpdatedField = { Text = _currentItem[3] }, CommentField = { Text = _currentItem[4] }, TypeSelector = { Text = _currentItem[5] } }; generator.ShowDialog(); if (generator.Domain == null) { return; } Account.Storage.DomainList.Add(generator.Domain); IEditableCollectionView items = ListTable.Items; if (items.CanRemove) { items.Remove(ListTable.SelectedItem); } RefreshList(); _modified = true; _currentItem = null; }
private void remove_Click(object sender, RoutedEventArgs e) { PurchaseItem item = itemsControl.SelectedItem as PurchaseItem; if (item == null) { MessageBox.Show("No Item is selected"); return; } IEditableCollectionView editableCollectionView = itemsControl.Items as IEditableCollectionView; if (!editableCollectionView.CanRemove) { MessageBox.Show("You cannot remove items from the list."); return; } if (MessageBox.Show("Are you sure you want to remove " + item.Description, "Remove Item", MessageBoxButton.YesNo) == MessageBoxResult.Yes) { editableCollectionView.Remove(itemsControl.SelectedItem); } }
private void DeleteLabel_Click(object sender, RoutedEventArgs e) { IEditableCollectionView items = LabelsListBox.Items; //Cast to interface if (items.CanRemove) { items.Remove(LabelsListBox.SelectedItem); } }
/// <summary> /// Removes the specified item from the collection. /// </summary> /// <param name="item">The item to remove.</param> void IEditableCollectionView.Remove(Object item) { IEditableCollectionView iEditableCollectionView = this.currentView as IEditableCollectionView; if (iEditableCollectionView == null) { throw new InvalidOperationException(ExceptionMessage.Format(ExceptionMessages.MemberNotAllowedForView, "Remove")); } iEditableCollectionView.Remove(item); }
/// Remove selected items from the ListBox. private void Button_Click(object sender, RoutedEventArgs e) { IEditableCollectionView items = ma_ListView.Items; //Cast to interface if (items.CanRemove) { items.Remove(ma_ListView.SelectedItem); TotalPrice -= panier.prix_total; } }
private void Remove_Click(object sender, RoutedEventArgs e) { IEditableCollectionView items = ListTable.Items; if (items.CanRemove) { items.Remove(ListTable.SelectedItem); } _currentItem = null; _modified = true; }
private void Delete_Record(object sender, RoutedEventArgs e) { IEditableCollectionView items = MyData.Items; //Cast to interface if (items.CanRemove) { while (MyData.SelectedValue != null) { items.Remove(MyData.SelectedItem); } } }
private void btn_RemoveGroup_Click(object sender, RoutedEventArgs e) { IEditableCollectionView items = lView_Groups.Items; //Cast to interface if (items.CanRemove) { items.Remove(lView_Groups.SelectedItem); } if (lView_Groups.Items.Count == 0) { listView_CollectionChanged(lView_Groups, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset)); } }
/// <summary> /// Remove the given item from the underlying collection. /// </summary> void IEditableCollectionView.Remove(object item) { IEditableCollectionView ecv = ProxiedView as IEditableCollectionView; if (ecv != null) { ecv.Remove(item); } else { throw new InvalidOperationException(SR.Get(SRID.MemberNotAllowedForView, "Remove")); } }
// Token: 0x0600740F RID: 29711 RVA: 0x00212F4C File Offset: 0x0021114C void IEditableCollectionView.Remove(object item) { IEditableCollectionView editableCollectionView = this.ProxiedView as IEditableCollectionView; if (editableCollectionView != null) { editableCollectionView.Remove(item); return; } throw new InvalidOperationException(SR.Get("MemberNotAllowedForView", new object[] { "Remove" })); }
public void ICVF_Remove() { EntitySet <City> entitySet = this.CreateEntitySet <City>(); IEditableCollectionView view = this.GetIECV(entitySet); entitySet.Add(this.CreateLocalCity("Renton")); entitySet.Add(this.CreateLocalCity("Kent")); entitySet.Add(this.CreateLocalCity("Auburn")); City city = entitySet.First(); view.Remove(city); Assert.IsFalse(entitySet.Contains(city), "EntitySet should no longer contain the first entity."); }
private void ScoresList_KeyDown(object sender, System.Windows.Input.KeyEventArgs e) { if (ScoresList.SelectedItem == null) { return; } if (e.Key == System.Windows.Input.Key.Delete) { Scores tmp = (Scores)ScoresList.SelectedItem; DBAccess.RemoveFromDB(tmp); IEditableCollectionView items = ScoresList.Items; //Cast to interface if (items.CanRemove) { items.Remove(ScoresList.SelectedItem); } } }
private void DeleteAnnotation_Click(object sender, RoutedEventArgs e) { IEditableCollectionView items = AnnotationResultBox.Items; //Cast to interface if (items.CanRemove) { foreach (AnnoScheme.Label lp in labelcolors) { string selection = ((AnnoScheme.Label)AnnotationResultBox.SelectedItem).Name; if (lp.Name == selection) { labelcolors.Remove(lp); break; } } items.Remove(AnnotationResultBox.SelectedItem); } }
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e) { XMLData.SaveSettings(MainF); FootballHedge.Properties.Settings.Default.Save(); if (LeaguesChange) { MainF.UpdateEventsInMainDataBase(); } MainF.UpdateControls(); IEditableCollectionView items = SelectedLeagues.Items; if (items.CanRemove) { items.Remove(SelectedLeagues.Items); } e.Cancel = false; }
private void btn_Remove_Item_Click(object sender, RoutedEventArgs e) { if (lView_TargetList.SelectedItems.Count != 0) { IEditableCollectionView items = lView_TargetList.Items; while (lView_TargetList.SelectedItems.Count != 0) { if (items.CanRemove) { items.Remove(lView_TargetList.SelectedItems[0]); tbx_TitleKeyword.Text = ""; tbx_AnidbID.Text = ""; tbx_GroupMembers.Text = ""; tbx_Presenter.Text = ""; } } } lbl_TargetCounts.Content = "No. of Items : " + Targets.Count; }
public void Execute(object parameter) { var values = (object[])parameter; var tabItem = values[0] as TabItem; var tabControl = values[1] as TabControl; if (tabItem != null && tabControl != null) { var isVertical = tabItem.TabStripPlacement == Dock.Top || tabItem.TabStripPlacement == Dock.Bottom; tabItem.IsSelected = false; var anima1 = new DoubleAnimation() { From = isVertical ? tabItem.ActualWidth : tabItem.ActualHeight, To = 0, Duration = TimeSpan.FromSeconds(0.3), EasingFunction = new CubicEase() { EasingMode = EasingMode.EaseOut }, }; anima1.Completed += delegate { IEditableCollectionView items = tabControl.Items; //Cast to interface if (items.CanRemove) { items.Remove(tabItem); } TabControlHelper.RaiseRemoved(tabControl, tabItem, items.CanRemove); }; var anima2 = new DoubleAnimation() { To = 0, Duration = TimeSpan.FromSeconds(0.3), }; tabItem.BeginAnimation(isVertical ? TabItem.WidthProperty : TabItem.HeightProperty, anima1); tabItem.BeginAnimation(TabItem.OpacityProperty, anima2); } }
public void DeleteCurrent() { if (ItemsSource.CurrentItem != null) { Customers customer = ItemsSource.CurrentItem as Customers; IEditableCollectionView view = ItemsSource as IEditableCollectionView; if (customer != null) { if (view != null) { if (!view.IsEditingItem && !view.IsAddingNew) { view.Remove(customer); } } else if (ItemsSource.SourceCollection is IList) { ((IList)ItemsSource.SourceCollection).Remove(customer); } } } }
public void Remove(object item) { _collectionView.Remove(item); }
//use of items private void Use_Click(object sender, RoutedEventArgs e) { switch (item) { case "Health Potion": { //you can only use potions if you're below max health if (healthBar.Value < 100) { //if drinking the potion will give you more than your max health it will just set your health to 100 if (healthBar.Value + 10 < 100) { healthBar.Value = healthBar.Value + 10; IEditableCollectionView items = inventoryList.Items; if (items.CanRemove) { items.Remove(inventoryList.SelectedItem); } } else { healthBar.Value = 100; IEditableCollectionView items = inventoryList.Items; if (items.CanRemove) { items.Remove(inventoryList.SelectedItem); } } //using items isn't a free action if (isEnemyAlive == true) { Enemy_Attack(); } } break; } case "Sludge": { if (healthBar.Value <= 100) { healthBar.Value = healthBar.Value - 5; textCRWL.Text = "You feel nauseous..."; IEditableCollectionView items = inventoryList.Items; if (items.CanRemove) { items.Remove(inventoryList.SelectedItem); } //if after eating the sludge the player's health drops to 0 the game will close if (healthBar.Value == 0) { Close(); } //using items isn't a free action if (isEnemyAlive == true) { Enemy_Attack(); } } break; } } }
private static void OnIsClearbleChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { if (d is TabItem tabItem) { RoutedEventHandler handle = (sender, args) => { var panel = VisualTreeHelper.GetParent(tabItem); var grid = VisualTreeHelper.GetParent(panel); var tabControl = VisualTreeHelper.GetParent(grid) as TabControl; IEditableCollectionView items = tabControl.Items; if (items.CanRemove) { items.Remove(tabItem.DataContext); // Binding 移除方式 } else { tabControl.Items.Remove(tabItem); // TabItem 移除方式 } if (GetIsAnimation(tabControl)) { if (tabControl.TabStripPlacement == Dock.Top || tabControl.TabStripPlacement == Dock.Bottom) { StartRowAnimation(tabControl); } else { StartColAnimation(tabControl); } } }; if (tabItem.IsLoaded) { if (tabItem.Template.FindName("clearButton", tabItem) is Button clearButton) { if (GetIsClearable(tabItem)) { clearButton.Click += handle; } else { clearButton.Click -= handle; } } } tabItem.Loaded += (sender, arg) => { if (tabItem.Template.FindName("clearButton", tabItem) is Button clearButton) { if (GetIsClearable(tabItem)) { clearButton.Click += handle; } else { clearButton.Click -= handle; } } }; tabItem.Unloaded += (sender, arg) => { if (tabItem.Template.FindName("clearButton", tabItem) is Button clearButton) { if (GetIsClearable(tabItem)) { clearButton.Click -= handle; } } }; } }