/// <summary> /// Instructs the parent legend item to remove this item from the list of legend items. /// </summary> protected virtual void OnRemoveItem() { RemoveItem?.Invoke(this, EventArgs.Empty); // Maybe we don't need RemoveItem event. We could just invoke a method on the parent. // One less thing to wire. But we currently need to wire parents. }
/// <summary> /// Raises event 'RemoveItem' /// </summary> protected virtual void OnRemoveItem() { if (RemoveItem != null) { RemoveItem.Invoke(this, System.EventArgs.Empty); } }
private void BtnSubtract_Click(object sender, RoutedEventArgs e) { RemoveItem removeItem = new RemoveItem(Window, Item); removeItem.Topmost = true; removeItem.Show(); }
/// <summary> /// Finds the proper text to be used for a tree node /// </summary> /// <param name="node"> node to find name for </param> /// <returns>name of the node to display on tree </returns> public static string TextSelector(Object node) { if (node is ProxyNode) { node = ((ProxyNode)node).Original; } string text = node switch { Project p => p.Name, Target t => "Target " + t.Name, Folder f => f.Name, ProjectEvaluation pe => pe.Name, Microsoft.Build.Logging.StructuredLogger.Task ta => "Task " + ta.Title + " duration " + ta.DurationText, AddItem a => "Add Item " + a.Name, RemoveItem r => "Remove Item " + r.Name, Item i => i.NameAndEquals + " " + i.ShortenedText, Metadata m => m.NameAndEquals + " " + m.ShortenedValue, EvaluationProfileEntry epe => epe.Title + " " + epe.DurationText + " " + epe.ShortenedElementDescription, Property p => p.NameAndEquals + " " + p.ShortenedValue, Parameter p => p.Name, Message m => m.ShortenedText, Import i => "Import " + i.Name + " " + i.Location, NoImport ni => "NoImport " + ni.Name + " " + ni.Location + " " + ni.Text, Error e => e.ToString(), Warning w => w.ToString(), Note n => n.Text, SourceFile sf => sf.Name, SourceFileLine sfl => sfl.LineNumber + " " + sfl.LineText, ProxyNode pn => pn.TypeName, TimedNode t => t.Name, _ => node.ToString() }; return(text); }
public GeometryViewModel() { Geometries = AUTDSettings.Instance.GeometriesReactive; Current = new ReactivePropertySlim <GeometrySettingReactive?>(); AddItem = new ReactiveCommand(); RemoveItem = Current.Select(c => c != null).ToReactiveCommand(); UpItem = Current.Select(c => c != null && c.No.Value != 0).ToReactiveCommand(); DownItem = Current.Select(c => c != null && c.No.Value != Geometries.Count - 1).ToReactiveCommand(); AddItem.Subscribe(_ => { var item = new GeometrySettingReactive(Geometries.Count); Geometries.Add(item); Current.Value = item; }); RemoveItem.Subscribe(_ => { if (Current.Value == null) { return; } var delNo = Current.Value.No.Value; Geometries.RemoveAt(delNo); ResetNo(); Current.Value = Geometries.Count > delNo ? Geometries[delNo] : Geometries.Count > 0 ? Geometries[delNo - 1] : null; }); UpItem.Subscribe(_ => { if (Current.Value == null) { return; } var cNo = Current.Value.No.Value; var up = Geometries[cNo - 1]; Geometries.Insert(cNo - 1, Current.Value); Geometries.RemoveAt(cNo); Geometries[cNo] = up; ResetNo(); Current.Value = Geometries[cNo - 1]; }); DownItem.Subscribe(_ => { if (Current.Value == null) { return; } var cNo = Current.Value.No.Value; var down = Geometries[cNo + 1]; Geometries.RemoveAt(cNo + 1); Geometries.Insert(cNo + 1, Current.Value); Geometries[cNo] = down; ResetNo(); Current.Value = Geometries[cNo + 1]; }); }
public Task Handle(RemoveItem message, IMessageHandlerContext context) { return(sagaManager.Process <OrderSagaData>(message.CorrelationId, context, x => { x.Items.Remove(message.Item); return Task.FromResult(x); })); }
public async Task <bool> RemoveReceiptItem(RemoveItem receiptId) { var item = await _context.ReceiptItems.FirstAsync(x => x.Id == receiptId.Id); _context.ReceiptItems.Remove(item); await _context.SaveChangesAsync(); return(true); }
private void EhRemoveItem(object sender, RoutedEventArgs e) { var node = ((FrameworkElement)sender).Tag as NGTreeNode; if (node != null) { RemoveItem?.Invoke(node.Tag as IFitFunctionInformation); } }
public FormItemCollection() { InitializeComponent(); buttonNewColumn.Click += (sender, e) => AddItem.RaiseEventEx(this); addColumnToolStripMenuItem.Click += (sender, e) => AddItem.RaiseEventEx(this); removeColumnToolStripMenuItem.Click += (sender, e) => RemoveItem.RaiseEventEx(this); listBoxItems.SelectedIndexChanged += (sender, e) => SelectedItemChanged.RaiseEventEx(this); }
private void OnItemDroppedOut(ItemDroppedEventData data) { if (this.slots.Any(s => s == data.InventorySlot)) { return; } // Note: to prevent Empty item dropping into inventory slot Timer.Instance.WaitForFixedUpdate(() => RemoveItem?.Invoke(data.InventoryItem.Item)); }
public async Task RemoveItemFromCart(Guid cartId, RemoveItemRequest request) { var command = new RemoveItem { AggregateRootId = cartId, ProductName = request.ProductName }; await dispatcher.SendAndPublishAsync <RemoveItem, Cart>(command); }
public void RunAdminModule() { Console.Clear(); Console.WriteLine(">>> You have been authenticated. Welcome ADMIN user!\n"); while (option != exitValue) { DisplayAdminMenu(); Console.Write("\nChoose an option: "); input = Console.ReadLine(); bool result = Int32.TryParse(input, out option); if (result) { switch (option) { case 1: Console.Clear(); DisplayInventory.ListInventory(); break; case 2: Console.Clear(); NewItem.GetItemData(); break; case 3: Console.Clear(); ModifyItem.ModifyItemData(); break; case 4: Console.Clear(); RemoveItem.RemoveItemFromInventory(); break; case 5: Console.Clear(); Console.WriteLine("EXITING the application... Thank you!"); break; default: Console.Clear(); Console.WriteLine(">>> Invalid number. Please try again!\n"); break; } } else { Console.Clear(); Console.WriteLine(">>> Invalid input. Please try again!\n"); } } }
public void RemoveFirstOccurenceOfItem_ListAndItem_ThrowException() { var lista = new Items(); var item = new Item { Name = "sth" }; var remove = new RemoveItem(); remove.RemoveFirstOccurenceFromItem(lista, item); Assert.False(lista.ListOfItems.Contains(item)); }
public void NotifyRemoveItem(Champion c, byte slot, byte remaining) { var ri = new RemoveItem(c, slot, remaining); if (remaining == 0) // This is for stackable items such as Health Potions and Mana Potions { c.Spells[(byte)(slot + 6)].DeactivateSpell(); c.Spells[(byte)(slot + 6)] = new Spell(c, "BaseSpell", (byte)(slot + 6)); } _game.PacketHandlerManager.broadcastPacketVision(c, ri, Channel.CHL_S2C); }
/// <summary> /// Remove an item and put it into the removed items list /// </summary> /// <param name="item">Item to remove</param> /// <returns>True if the item was removed, false if not</returns> public bool Remove(T item) { if (newItems.Contains(item)) { var args = new RemoveItemEventArgs { Item = item, RemoveFromNewItems = true }; RemoveItem?.Invoke(this, args); if (!args.Cancel) { // Remove from new items and do nothing else newItems.Remove(item); var itemRemovedArgs = new ItemRemovedEventArgs { Item = item }; ItemRemoved?.Invoke(this, itemRemovedArgs); return(!args.Cancel); } } else if (items.Contains(item)) { var args = new RemoveItemEventArgs { Item = item }; RemoveItem?.Invoke(this, args); if (!args.Cancel) { // Remove from existing items and add to removed items list items.Remove(item); removedItems.Add(item); var itemRemovedArgs = new ItemRemovedEventArgs { Item = item }; ItemRemoved?.Invoke(this, itemRemovedArgs); return(!args.Cancel); } } return(false); }
public void ChangeItem(object objDr) { DataRow dr = (DataRow)objDr; string fileId = dr["fileId"].ToString(); ItemUploadFile item = (ItemUploadFile)dr["item"]; UploadFileDelegate ufd = UploadFile; ufd.BeginInvoke(dr, this.Complete, dr); while (true) { if (dr != null && dr.RowState != DataRowState.Detached && dr.RowState != DataRowState.Deleted) { long fileSize = 0; long currentSize = 0; try { fileSize = Convert.ToInt64(dr["FileSize"]); currentSize = Convert.ToInt64(dr["UploadSize"]); } catch (Exception ex) { Thread.Sleep(50); fileSize = Convert.ToInt64(dr["FileSize"]); currentSize = Convert.ToInt64(dr["UploadSize"]); } int value = (int)((currentSize * 100) / fileSize); item.Invoke(new Action(() => { item.value = value; item.Invalidate(); //item.Invalidate(); })); if (value >= 100) { this.sendMessage.Invoke(item.File); RemoveItem.Invoke(item.File); this.addFileMessage(item.File); lock (dtMission) { dtMission.Rows.Remove(dr); } break; } } else { break; } Thread.Sleep(500); } }
protected override void OnExternalObjectsDropped(GoInputEventArgs evt) { if (Selection.Primary is KanbanItem node && node.Document is GoDocument doc) { RemoveItem?.Invoke(node.Item); AddNode(node); ItemDropped?.Invoke(node.Item); node.Container = ContainerId; RefreshNodes(); } }
public IHttpActionResult RemoveItem(RemoveItem remove) { var menu = _context.FoodMenus.Include(f => f.FoodItems).SingleOrDefault(f => f.Id == remove.MenuId); var item = menu.FoodItems.SingleOrDefault(f => f.Id == remove.ItemId); if (menu == null || item == null) { return(BadRequest("not valid menuid")); } menu.FoodItems.Remove(item); _context.SaveChanges(); return(Ok("Deleted")); }
public void RemoveItem(RemoveItem rpc) { for (int i = 0; i < itemStacks.count; i++) { var itemStack = itemStacks[i]; if (itemStack.item.IsSameType(rpc.item)) { while (itemStack.count != 0) { if (rpc.amount == 0) { return; } itemStack.Pop(); --rpc.amount; } } } }
public RemoveItem RemoveItems(int itemId, int returnedItemQty, string sessionId, int checkedinId) { var connectionString = Startup.connectionstring; using (var con = new ShoppingContext(connectionString)) { var context = con.itemMasterEntity.Where(k => k.Active == true).SingleOrDefault(m => m.ItemId == itemId); context.ReserveQty = context.ReserveQty - returnedItemQty; context.AvailableQty = context.AvailableQty + returnedItemQty; var remove = con.CheckInEntity.Where(m => m.UserSessionId == sessionId && m.id == checkedinId).SingleOrDefault(); remove.Active = false; con.SaveChanges(); var count = con.CheckInEntity.Where(m => m.UserSessionId == sessionId && m.Active == true).Count(); var result = new RemoveItem() { count = count, successs = true }; return(result); } }
private void OnSlotItemRightClicked(InventoryItem inventoryItem) { RemoveItem?.Invoke(inventoryItem.Item); }
private void removeButton_Click(object sender, EventArgs e) { RemoveItem?.Invoke(this, new RemoveItemEventArgs(_filepair)); }
static async Task Start() { Log.Logger = new LoggerConfiguration() .MinimumLevel.Information() .WriteTo.Console() .CreateLogger(); LogManager.Use <SerilogFactory>(); Console.Title = "Frontend"; var config = new EndpointConfiguration("OnlyOnce.Demo0.Frontend"); config.Pipeline.Register(new DuplicateMessagesBehavior(), "Duplicates outgoing messages"); config.SendFailedMessagesTo("error"); var routing = config.UseTransport <LearningTransport>().Routing(); routing.RouteToEndpoint(typeof(SubmitOrder).Assembly, "OnlyOnce.Demo0.Orders"); config.EnableInstallers(); var endpoint = await Endpoint.Start(config).ConfigureAwait(false); Console.WriteLine("'submit <order-id>' to create a new order."); Console.WriteLine($"'add ({string.Join("|", Enum.GetNames(typeof(Filling)))}) to <order-id>' to add item with selected filling."); while (true) { var command = Console.ReadLine(); if (string.IsNullOrEmpty(command)) { break; } var match = submitExpr.Match(command); if (match.Success) { var orderId = match.Groups[1].Value; var message = new SubmitOrder { OrderId = orderId }; await Send(endpoint, message); continue; } match = addExpr.Match(command); if (match.Success) { var filling = match.Groups[1].Value; var orderId = match.Groups[2].Value; var message = new AddItem { OrderId = orderId, Filling = (Filling)Enum.Parse(typeof(Filling), filling) }; await Send(endpoint, message); continue; } match = removeExpr.Match(command); if (match.Success) { var filling = match.Groups[1].Value; var orderId = match.Groups[2].Value; var message = new RemoveItem { OrderId = orderId, Filling = (Filling)Enum.Parse(typeof(Filling), filling) }; await Send(endpoint, message); continue; } Console.WriteLine("Unrecognized command."); } await endpoint.Stop().ConfigureAwait(false); }
public void NotifyRemoveItem(IChampion c, byte slot, byte remaining) { var ri = new RemoveItem(c, slot, remaining); _packetHandlerManager.BroadcastPacketVision(c, ri, Channel.CHL_S2C); }
public async Task <IActionResult> RemoveReceiptItem(RemoveItem receiptItem) { var s = await _eventService.RemoveReceiptItem(receiptItem); return(Ok(s)); }
protected void deleteButton_Click(object sender, EventArgs e) { ICommand command = new RemoveItem(user, bindingSource, removeAccessLevel); command.invoke(); }
public static void notifyRemoveItem(Champion c, byte slot, byte remaining) { var ri = new RemoveItem(c, slot, remaining); PacketHandlerManager.getInstace().broadcastPacketVision(c, ri, Channel.CHL_S2C); }
/// <summary> /// This is either a layer collection or a colorbreak collection, and so /// this won't be called by us, but someone might want to override this for their own reasons. /// </summary> protected virtual void OnRemoveItem() { RemoveItem?.Invoke(this, EventArgs.Empty); }
public async Task Handle(RemoveItem command) => await Update(command?.OrderId, order => order.RemoveItem(from: command?.PersonName), command?.CommandId);
public HoloViewModel() { Holo = AUTDSettings.Instance.ToReactivePropertySlimAsSynchronized(i => i.Holo); HoloSettings = AUTDSettings.Instance.Holo.HoloSettingsReactive; Current = new ReactivePropertySlim <HoloSettingReactive?>(); AddItem = new ReactiveCommand(); RemoveItem = Current.Select(c => c != null).ToReactiveCommand(); UpItem = Current.Select(c => c != null && c.No.Value != 0).ToReactiveCommand(); DownItem = Current.Select(c => c != null && c.No.Value != HoloSettings.Count - 1).ToReactiveCommand(); AddItem.Subscribe(_ => { var item = new HoloSettingReactive(HoloSettings.Count); HoloSettings.Add(item); Current.Value = item; }); RemoveItem.Subscribe(_ => { if (Current.Value == null) { return; } var delNo = Current.Value.No.Value; HoloSettings.RemoveAt(delNo); ResetNo(); Current.Value = HoloSettings.Count > delNo ? HoloSettings[delNo] : HoloSettings.Count > 0 ? HoloSettings[delNo - 1] : null; }); UpItem.Subscribe(_ => { if (Current.Value == null) { return; } var cNo = Current.Value.No.Value; var up = HoloSettings[cNo - 1]; HoloSettings.Insert(cNo - 1, Current.Value); HoloSettings.RemoveAt(cNo); HoloSettings[cNo] = up; ResetNo(); Current.Value = HoloSettings[cNo - 1]; }); DownItem.Subscribe(_ => { if (Current.Value == null) { return; } var cNo = Current.Value.No.Value; var down = HoloSettings[cNo + 1]; HoloSettings.RemoveAt(cNo + 1); HoloSettings.Insert(cNo + 1, Current.Value); HoloSettings[cNo] = down; ResetNo(); Current.Value = HoloSettings[cNo + 1]; }); }
public void RemoveItem(RemoveItem rpc) { for (int i = 0; i < itemStacks.count; i++) { var itemStack = itemStacks[i]; if (itemStack.item.IsSameType(rpc.item)) { while (itemStack.count != 0) { if (rpc.amount == 0) return; itemStack.Pop(); --rpc.amount; } } } }