private static void EventSink_AddItem(AddItemEventArgs e) { LogHelper lh = new LogHelper("AddItem.log", false, true); lh.Log(LogType.Mobile, e.from, String.Format("Used [Add Item to create ItemID:{0}, Serial:{1}", e.item.ItemID.ToString(), e.item.Serial.ToString())); lh.Finish(); }
/// <summary> /// Eventhandler of the "AddItem" event. /// It sets the ImageIndex of text files to an image that has been added to the "SmallCustomImages" and "LargeCustomImages" properties of the ShellListView. /// Note the usage of the "ActiveImageList" property: it refers to the currently used imagelist independently of the current viewstyle. /// To make this work in all viewstyles, an image tagged "document_text.png" needs to be available in both image lists. /// </summary> /// <param name="sender">Source of the event.</param> /// <param name="e">Add item event information.</param> private void shellListView1_AddItem(object sender, AddItemEventArgs e) { if (System.IO.Path.GetExtension(e.Item.FullPath).ToUpper() == ".TXT") { e.Item.ImageIndex = shellListView1.ActiveImageList.Images.IndexOfKey("document_text.png"); } }
public void Broadcast(BroadcastEventType e, AddItemEventArgs aea = null, RemoveItemEventArgs rea = null, SwapItemsEventArgs sea = null, SwapItemsTrhuInvEventArgs siea = null, UseItemEventArgs uea = null, DropItemEventArgs dea = null, InitializeInventoryEventArgs iea = null) { //Debug.Log($"Broadcasting event {e}"); switch (e) { case BroadcastEventType.AddItem: OnAddItem?.Invoke(this, aea); OnChange?.Invoke(this, aea); break; case BroadcastEventType.RemoveItem: OnRemoveItem?.Invoke(this, rea); OnChange?.Invoke(this, rea); break; case BroadcastEventType.SwapItem: OnSwapItem?.Invoke(this, sea); OnChange?.Invoke(this, sea); break; case BroadcastEventType.SwapTrhuInventory: OnSwapTrhuInventory?.Invoke(this, siea); OnChange?.Invoke(this, siea); break; case BroadcastEventType.UseItem: OnUseItem?.Invoke(this, uea); OnChange?.Invoke(this, uea); break; case BroadcastEventType.DropItem: OnDropItem?.Invoke(this, dea); OnChange?.Invoke(this, dea); break; case BroadcastEventType.PickUpItem: OnPickUpItem?.Invoke(this, aea); OnChange?.Invoke(this, aea); break; case BroadcastEventType.InitializeInventory: OnInitializeInventory?.Invoke(this, iea); OnChange?.Invoke(this, iea); break; default: break; } if (autoSaveOnChange) { InventoryController.SaveInventoryData(); } }
/// <summary> /// Handles the adding item event. /// </summary> /// <param name="sender"> /// The sender. /// </param> /// <param name="e"> /// The <see cref="AddItemEventArgs"/>. /// </param> private static void ItemsOnAddingItem(object sender, AddItemEventArgs e) { var item = e.LineItem; if (item.ExtendedData.ContainsAny(ProductTaxExtendedDataKeys)) { item.ExtendedData.SetValue(Core.Constants.ExtendedDataKeys.TaxIncludedInProductPrice, true.ToString()); } }
private void SetFocusAndExpandItem(object sender, AddItemEventArgs e) { var view = (TableView)_grid.View; view.Focus(); _grid.CurrentItem = e.Item; _grid.CurrentColumn = _grid.Columns.First(c => c.AllowEditing == DefaultBoolean.True); if (_grid.AllowMasterDetail) { _grid.SetMasterRowExpanded(view.FocusedRowHandle, true); } Application.Current.Dispatcher.BeginInvoke(new Action(view.ShowEditor), DispatcherPriority.Loaded); }
private void OnAddTitleEvent(object sender, AddItemEventArgs <Title> e) { var title = e.item; if (title == null) { return; } if (pictureBox1.ImageLocation.IsNullOrEmpty()) { SetCurrentImage(title); } titleList.BeginInvoke(new Action(() => { titleList.Items.Add(title); })); }
private void Children_ItemAdded(object sender, AddItemEventArgs<SceneObject> e) { //if (e.NewItem.Parent == null) //{ // int index = this.scene.RootObject.Children.IndexOf(e.NewItem); // var node = new TreeNode(e.NewItem.ToString()); // node.Tag = e.NewItem; // e.NewItem.Tag = node; // this.treeView1.Nodes.Insert(index, node); //} //else { int index = e.NewItem.Parent.Children.IndexOf(e.NewItem); var node = new TreeNode(e.NewItem.ToString()); node.Tag = e.NewItem; e.NewItem.Tag = node; (e.NewItem.Parent.Tag as TreeNode).Nodes.Insert(index, node); } }
void ObjectList_ItemAdded(object sender, AddItemEventArgs<SceneObject> e) { if (e.NewItem.Parent == null) { int index = this.scientificCanvas.Scene.ObjectList.IndexOf(e.NewItem); var node = new TreeNode(e.NewItem.ToString()); node.Tag = e.NewItem; e.NewItem.Tag = node; this.objectsTreeView.Nodes.Insert(index, node); } else { int index = e.NewItem.Parent.Children.IndexOf(e.NewItem); var node = new TreeNode(e.NewItem.ToString()); node.Tag = e.NewItem; e.NewItem.Tag = node; (e.NewItem.Parent.Tag as TreeNode).Nodes.Insert(index, node); } }
private void Children_ItemAdded(object sender, AddItemEventArgs <SceneObject> e) { //if (e.NewItem.Parent == null) //{ // int index = this.scene.RootObject.Children.IndexOf(e.NewItem); // var node = new TreeNode(e.NewItem.ToString()); // node.Tag = e.NewItem; // e.NewItem.Tag = node; // this.treeView1.Nodes.Insert(index, node); //} //else { int index = e.NewItem.Parent.Children.IndexOf(e.NewItem); var node = new TreeNode(e.NewItem.ToString()); node.Tag = e.NewItem; e.NewItem.Tag = node; (e.NewItem.Parent.Tag as TreeNode).Nodes.Insert(index, node); } }
public static int Build(Mobile from, Point3D start, Point3D end, ConstructorInfo ctor, object[] values, string[,] props, PropertyInfo[] realProps, ArrayList packs) { try { Map map = from.Map; int objectCount = (packs == null ? (((end.X - start.X) + 1) * ((end.Y - start.Y) + 1)) : packs.Count); if (objectCount >= 20) { from.SendMessage("Constructing {0} objects, please wait.", objectCount); } bool sendError = true; if (packs != null) { for (int i = 0; i < packs.Count; ++i) { object built = Build(from, ctor, values, props, realProps, ref sendError); if (built is Item) { Container pack = (Container)packs[i]; pack.DropItem((Item)built); } else if (built is Mobile) { Mobile m = (Mobile)built; m.MoveToWorld(new Point3D(start.X, start.Y, start.Z), map); } } } else { for (int x = start.X; x <= end.X; ++x) { for (int y = start.Y; y <= end.Y; ++y) { object built = Build(from, ctor, values, props, realProps, ref sendError); if (built is Item) { Item item = (Item)built; item.MoveToWorld(new Point3D(x, y, start.Z), map); AddItemEventArgs e = new AddItemEventArgs(built as Item, from); EventSink.InvokeAddItem(e); // erl: stores person adding it if Spawner // or ChestItemSpawner type + calls change log if (built is Spawner) { Spawner sp = (Spawner)built; sp.LastProps = from; sp.LogChange("Spawner added"); } else if (built is ChestItemSpawner) { ChestItemSpawner sp = (ChestItemSpawner)built; sp.LastProps = from; sp.LogChange("ChestItemSpawner added"); } else if (built is ChestLootPackSpawner) { ChestLootPackSpawner sp = (ChestLootPackSpawner)built; sp.LastProps = from; sp.LogChange("ChestLootPackSpawner added"); } } else if (built is Mobile) { Mobile m = (Mobile)built; m.MoveToWorld(new Point3D(x, y, start.Z), map); } } } } return(objectCount); } catch (Exception ex) { LogHelper.LogException(ex); Console.WriteLine(ex); return(0); } }
void OnAddItem(object sender, AddItemEventArgs eventArgs) { Items.Add(eventArgs.Name); RaisePropertyChanged(nameof(Count)); RaisePropertyChanged(nameof(Items)); }
void OnAddItem(object sender, AddItemEventArgs eventArgs) { concurrentItems.Push(eventArgs.Name); RaisePropertyChanged(nameof(Count)); RaisePropertyChanged(nameof(Items)); }
void OnAddItem(object sender, AddItemEventArgs eventArgs) { _sourceList.Add(eventArgs.Name); }
void OnAddItem(object sender, AddItemEventArgs eventArgs) { throw new NotImplementedException(); }