Beispiel #1
0
        private void SaveChangesLocker_Click(object sender, EventArgs e)
        {
            if (LockerTree.SelectedNode == null)
            {
                return;
            }

            if (LockerTree.SelectedNode.Children.Count > 0)
            {
                return;
            }

            InventoryEntry entry = LockerTree.SelectedNode.GetEntry();

            int partcount = entry.GetPartCount();

            for (int Progress = 0; Progress < partcount; Progress++)
            {
                entry.Parts[Progress] = (string)PartsLocker.Items[Progress];
            }

            entry.UsesBigLevel = InventoryEntry.ItemgradePartUsesBigLevel((string)PartsLocker.Items[0]);

            entry.Quantity     = (int)RemAmmoLocker.Value;
            entry.QualityIndex = QualityLocker.Value;
            entry.EquippedSlot = 0;
            entry.LevelIndex   = LevelIndexLocker.Value;
            entry.IsJunk       = (int)JunkLocker.Value;
            entry.IsLocked     = (int)LockedLocker.Value;

            if (entry.Type == InventoryType.Weapon)
            {
                entry.RecalculateDataWeapon();
                entry.BuildName();
            }
            else if (entry.Type == InventoryType.Item)
            {
                entry.RecalculateDataItem();
                entry.BuildName();
            }
            else
            {
                System.Diagnostics.Debug.Assert(true, "Invalid item type in locker");
                entry.Name = "Invalid ItemType (" + entry.Type + ")";
            }

            // When the item changes, it may not belong in the same location in
            // in the sorted tree because the name, level, or other sort key
            // has changed.  Remove the node then place it back into the tree to
            // make sure it is relocated to the proper location, then select the
            // node and make sure it is visible so the user is focused on the new
            // location after the changes.
            LockerTL.RemoveFromTreeView(LockerTree.SelectedNode, false);
            LockerTL.AddToTreeView(entry);
            LockerTL.AdjustSelectionAfterAdd();
            LockerTree.EnsureVisible(LockerTree.SelectedNode);

            LockerPartsGroup.Text = entry.Name;
            LockerTree.Focus();
        }
 private void ImportAllFromWeaponsLocker_Click(object sender, EventArgs e)
 {
     LockerTree.BeginUpdate();
     foreach (InventoryEntry weapon in db.WeaponList.Items.Values)
     {
         LockerTL.Duplicate(weapon);
     }
     LockerTree.EndUpdate();
     LockerTL.SaveToXml(db.OpenedLockerFilename());
 }
 private void NewItemLocker_Click(object sender, EventArgs e)
 {
     LockerTL.AddNew(InventoryType.Item);
     LockerTL.AdjustSelectionAfterAdd();
     LockerTree.EnsureVisible(LockerTree.SelectedNode);
 }