private void OnItemRemoving(object sender, ItemRemovingEventArgs args) { var node = this.target as RouteNode; RouteNodeEvent item = node.Events[args.ItemIndex]; DestroyImmediate(item.gameObject); }
private void OnItemRemoving(object sender, ItemRemovingEventArgs args) { var routeset = this.target as RouteSet; Route item = routeset.Routes[args.ItemIndex]; DestroyImmediate(item.gameObject); }
private void OnRemoveMission(object sender, ItemRemovingEventArgs args) { GenericClassListAdaptor <Mission> listAdaptor = args.adaptor as GenericClassListAdaptor <Mission>; Mission mission = listAdaptor[args.itemIndex]; if (listAdaptor != null) { if (EditorUtility.DisplayDialog("Confirm to delete", "Confirm to delete mission [" + mission.ID + "]?", "OK", "Cancel")) { args.Cancel = false; GameKit.Config.UpdateMapsAndTree(); GameKitEditorWindow.GetInstance().Repaint(); MissionTreeExplorer missionTreeExplorer = GameKitEditorWindow.GetInstance().GetTreeExplorer( GameKitEditorWindow.TabType.Missions) as MissionTreeExplorer; if (missionTreeExplorer.CurrentSelectedItem == mission) { missionTreeExplorer.SelectItem(null); } } else { args.Cancel = true; } } }
private void OnItemRemovingHandler(object sender, ItemRemovingEventArgs args) { if (OnItemBeingRemoved != null) { OnItemBeingRemoved(args.ItemIndex, list); } }
private void TallyBuffer_ItemRemoved(object sender, ItemRemovingEventArgs <TallyAction> eventArgs) { var action = eventArgs.Item; var count = action.Count; if (count != null) { if (count.TreeCount > 0) { action.Count.TreeCount--; } if (action.KPI > 0 && count.SumKPI > 0) { count.SumKPI -= action.KPI; action.TreeEstimate.Delete(); } } if (action.TreeRecord != null) { this.DeleteTree(action.TreeRecord); } count.Save(); }
private void Items_ItemRemoving(object sender, ItemRemovingEventArgs <TabItem> e) { if (_internalAction) { return; } if (e.Item != null) { TabItemClosingEventArgs ee = new TabItemClosingEventArgs(e.Item); TabClosing?.Invoke(this, ee); if (ee.Cancel) { // don't remove or close anything, just exit closedTabIndex = -1; e.Cancel = true; return; } if (Items.SelectedItems.Contains(e.Item) && (SelectedTabClosedAction == SelectedTabCloseAction.SelectTabToLeft || SelectedTabClosedAction == SelectedTabCloseAction.SelectTabToRight)) { closedTabIndex = Items.IndexOf(e.Item); } else { closedTabIndex = -1; } } }
private void ListControlOnItemRemoving(object sender, ItemRemovingEventArgs args) { var warnAttribute = metadata.GetAttribute <WarnBeforeRemovingAttribute>(); if (warnAttribute != null) { args.Cancel = !EditorUtility.DisplayDialog(warnAttribute.warningTitle, warnAttribute.warningMessage, "Remove", "Cancel"); } }
void OnEntryItemRemoving(object sender, ItemRemovingEventArgs args) { DestroyImmediate(infoGroupCache.entries[args.ItemIndex], true); DrawSideBar_Entry = DrawSideBar_Entries_Normal; DrawEditor = DrawEditor_Normal; SaveDatabase(); }
protected override void OnItemRemoving(ItemRemovingEventArgs args) { base.OnItemRemoving(args); if (onItemRemoved != null) { onItemRemoved(args.itemIndex); } }
private void OnRemoveSubGate(object sender, ItemRemovingEventArgs args) { GenericClassListAdaptor <Gate> listAdaptor = args.adaptor as GenericClassListAdaptor <Gate>; Gate gate = listAdaptor[args.itemIndex]; (_currentGate as Gate).SubGatesID.Remove(gate.ID); GameKit.Config.SubGates.Remove(gate); GameKit.Config.UpdateMapsAndTree(); UpdateSubGatesPopupDrawers(); }
/// <summary> /// Remove the item at the specified index of this collection. /// </summary> /// <param name="index">The index of the item to remove.</param> /// <returns><c>true</c> if the item is removed, otherwise <c>false</c>. It will be <c>false</c> if the removal was cancelled via the ItemRemoving event.</returns> public new bool RemoveAt(int index) { T t = this[index]; ItemRemovingEventArgs <T> te = new ItemRemovingEventArgs <T>(t); ItemRemoving?.Invoke(this, te); if (te.Cancel) { return(false); } base.RemoveAt(index); return(true); }
private static void OnRemoveCommandExecute(object obj) { var tabItem = (TabItem)obj; var tabControl = (TabControl)ItemsControl.ItemsControlFromItemContainer(tabItem); var animationDuration = GetRemovingAnimationDuration(tabControl); var animationEase = GetRemovingAnimationEase(tabControl); var dataItem = tabControl.ItemContainerGenerator.ItemFromContainer(tabItem); var removingArgs = new ItemRemovingEventArgs(ItemRemovingEvent, dataItem); tabControl.RaiseEvent(removingArgs); if (removingArgs.Cancel) { return; } var action = new Action(() => { tabControl.Dispatcher.Invoke(new Action(() => { var collectionView = (IEditableCollectionView)tabControl.Items; if (collectionView.CanRemove) { collectionView.Remove(dataItem); } else { tabControl.Items.Remove(dataItem); } var removedArgs = new ItemRemovedEventArgs(ItemRemovedEvent, dataItem); tabControl.RaiseEvent(removedArgs); })); }); if (animationDuration != null && ((TimeSpan)animationDuration).TotalMilliseconds > 0) { var isLeftRight = tabItem.TabStripPlacement == Dock.Left || tabItem.TabStripPlacement == Dock.Right; AnimationUtil.BeginDoubleAnimation(tabItem, isLeftRight ? TabItem.HeightProperty : TabItem.WidthProperty, isLeftRight ? tabItem.ActualHeight : tabItem.ActualWidth, 0, animationDuration, null, animationEase, action); } else { action?.Invoke(); } }
private static void OnRemoveCommandExecute(object obj) { var listBoxItem = (ListBoxItem)obj; var listBox = (ListBox)ItemsControl.ItemsControlFromItemContainer(listBoxItem); var animationDuration = GetRemovingAnimationDuration(listBox); var animationEase = GetRemovingAnimationEase(listBox); var dataItem = listBox.ItemContainerGenerator.ItemFromContainer(listBoxItem); var removingArgs = new ItemRemovingEventArgs(ItemRemovingEvent, dataItem); listBox.RaiseEvent(removingArgs); if (removingArgs.Cancel) { return; } var action = new Action(() => { listBox.Dispatcher.Invoke(new Action(() => { var collectionView = (IEditableCollectionView)listBox.Items; if (collectionView.CanRemove) { collectionView.Remove(dataItem); } else { listBox.Items.Remove(dataItem); } var removedArgs = new ItemRemovedEventArgs(ItemRemovedEvent, dataItem); listBox.RaiseEvent(removedArgs); })); }); if (animationDuration != null && ((TimeSpan)animationDuration).TotalMilliseconds > 0) { AnimationUtil.BeginDoubleAnimation(listBoxItem, ListBoxItem.HeightProperty, null, 0, animationDuration, null, animationEase, action); } else { action?.Invoke(); } }
/// <summary> /// Removes the first occurrence of a specific object in the collection. /// </summary> /// <param name="item">The item to remove.</param> /// <returns><c>true</c> if the item is removed, otherwise <c>false</c>. It may be <c>false</c> if the item isn't actually in the collection or if the removal was cancelled via the ItemRemoving event.</returns> public new bool Remove(T item) { ItemRemovingEventArgs <T> te = new ItemRemovingEventArgs <T>(item); ItemRemoving?.Invoke(this, te); if (te.Cancel) { return(false); } bool res = base.Remove(item); if (res && selectedItems.Contains(item)) { selectedItems.Remove(item); } return(res); }
private void OnRemoveUpgradeItem(object sender, ItemRemovingEventArgs args) { GenericClassListAdaptor <UpgradeItem> listAdaptor = args.adaptor as GenericClassListAdaptor <UpgradeItem>; UpgradeItem upgradeItem = listAdaptor[args.itemIndex]; if (listAdaptor != null) { if (EditorUtility.DisplayDialog("Confirm to delete", "Confirm to delete upgrade [" + upgradeItem.ID + "]?", "OK", "Cancel")) { args.Cancel = false; GameKit.Config.Upgrades.Remove(upgradeItem); GameKit.Config.UpdateMapsAndTree(); (_treeExplorer as VirtualItemsTreeExplorer).OnVirtualItemUpgradesChange(_currentDisplayItem as VirtualItem); } else { args.Cancel = true; } } }
private void OnRemoveScore(object sender, ItemRemovingEventArgs args) { GenericClassListAdaptor <Score> listAdaptor = args.adaptor as GenericClassListAdaptor <Score>; Score score = listAdaptor[args.itemIndex]; if (listAdaptor != null) { ScorePropertyInspector scoreInspector = GameKitEditorWindow.GetInstance().GetPropertyInsepctor( GameKitEditorWindow.TabType.Scores) as ScorePropertyInspector; IItem[] items = scoreInspector.GetAffectedItems(score.ID); if (items.Length > 0) { EditorUtility.DisplayDialog("Warning", "Not allowed to delete becase the item is still used by following items: " + scoreInspector.GetAffectedItemsWarningString(items), "OK"); args.Cancel = true; } else { if (EditorUtility.DisplayDialog("Confirm to delete", "Confirm to delete score [" + score.ID + "]?", "OK", "Cancel")) { args.Cancel = false; GameKit.Config.UpdateMapsAndTree(); GameKitEditorWindow.GetInstance().Repaint(); ScoreTreeExplorer scoreTreeExplorer = GameKitEditorWindow.GetInstance().GetTreeExplorer( GameKitEditorWindow.TabType.Scores) as ScoreTreeExplorer; if (scoreTreeExplorer.CurrentSelectedItem == score) { scoreTreeExplorer.SelectItem(null); } } else { args.Cancel = true; } } } }
private void OnRemoveSubworld(object sender, ItemRemovingEventArgs args) { GenericClassListAdaptor <World> listAdaptor = args.adaptor as GenericClassListAdaptor <World>; World world = listAdaptor[args.itemIndex]; if (listAdaptor != null) { IItem[] items = GetAffectedItems(world.ID); if (items.Length > 0) { EditorUtility.DisplayDialog("Warning", "Not allowed to delete becase the item is still used by following items: " + GetAffectedItemsWarningString(items), "OK"); args.Cancel = true; } else { if (EditorUtility.DisplayDialog("Confirm to delete", "Confirm to delete world [" + world.ID + "]?", "OK", "Cancel")) { args.Cancel = false; (_currentDisplayItem as World).SubWorldsID.Remove(world.ID); RemoveSubWorldAndSubGateRecursivity(world); (_treeExplorer as WorldTreeExplorer).RemoveWorld(world); ScoreTreeExplorer scoreTreeExplorer = (GameKitEditorWindow.GetInstance().GetTreeExplorer( GameKitEditorWindow.TabType.Scores) as ScoreTreeExplorer); scoreTreeExplorer.RemoveWorld(world); GameKit.Config.UpdateMapsAndTree(); GameKitEditorWindow.GetInstance().Repaint(); } else { args.Cancel = true; } } } }
private void OnItemRemoving <T>(object sender, ItemRemovingEventArgs args) where T : SerializableItem { GenericClassListAdaptor <T> listAdaptor = args.adaptor as GenericClassListAdaptor <T>; T item = listAdaptor[args.itemIndex]; if (listAdaptor != null) { VirtualItemsPropertyInspector virtualItemInspector = GameKitEditorWindow.GetInstance().GetPropertyInsepctor( GameKitEditorWindow.TabType.VirtualItems) as VirtualItemsPropertyInspector; IItem[] items = virtualItemInspector.GetAffectedItems(item.ID); if (items.Length > 0) { EditorUtility.DisplayDialog("Warning", "Not allowed to delete becase the item is still used by following items: " + virtualItemInspector.GetAffectedItemsWarningString(items), "OK"); args.Cancel = true; } else { if (EditorUtility.DisplayDialog("Confirm to delete", "Confirm to delete item [" + item.ID + "]?", "OK", "Cancel")) { args.Cancel = false; if (item is UpgradeItem) { GameKit.Config.Upgrades.Remove((item as UpgradeItem)); } SelectItem(null); GameKitEditorWindow.GetInstance().Repaint(); } else { args.Cancel = true; } } } }
protected override void OnItemRemoving(ItemRemovingEventArgs args) { SmartCultureInfoListAdaptor smartAdaptor = args.adaptor as SmartCultureInfoListAdaptor; if (smartAdaptor == null) { return; } SmartCultureInfo info = smartAdaptor.GetCultureInfo(args.itemIndex); if (EditorUtility.DisplayDialog("Delete " + info.englishName + "?", "Are you sure you want to delete " + info.englishName + " and all of its content from the project? You cannot undo this action.", "Yes, delete it.", "Cancel")) { LanguageHandlerEditor.DeleteLanguage(info); base.OnItemRemoving(args); } else { args.Cancel = true; } }
protected override void OnItemRemoving(ItemRemovingEventArgs args) { SmartCultureInfoListAdaptor smartAdaptor = args.adaptor as SmartCultureInfoListAdaptor; if (smartAdaptor == null) { return; } SmartCultureInfo info = smartAdaptor.GetCultureInfo(args.itemIndex); if (EditorUtility.DisplayDialog("Удалить " + info.englishName + "?", "Вы уверены, что хотите удалить " + info.englishName + " и весь его контент из проекта? Вы не сможете отменить это действие.", "Да, удали это.", "Отмена")) { LanguageHandlerEditor.DeleteLanguage(info); base.OnItemRemoving(args); } else { args.Cancel = true; } }
private void OnItemRemoving(object sender, ItemRemovingEventArgs args) { }
protected override void OnItemRemoving(ItemRemovingEventArgs args) { base.OnItemRemoving(args); onItemRemoved(args.ItemIndex); }
private void OnItemRemoving(object sender, ItemRemovingEventArgs args) { UpdatePurchasePopupDrawers(); }
protected virtual void OnItemRemoving(object sender, ItemRemovingEventArgs args) { }