Пример #1
0
        private void DeleteItem()
        {
            if (ulvPickItems.SelectedItems.Count == 0)
            {
                return;
            }

            if (MessageBox.Show("Are you sure that you want to delete this Picklist Item?",
                                "Confirm Delete",
                                MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) != DialogResult.Yes)
            {
                return;
            }

            UltraListViewItem lvi      = ulvPickItems.SelectedItems[0];
            PickItem          pickItem = lvi.Tag as PickItem;

            if (pickItem != null)
            {
                pickItem.Delete();
            }

            // Refresh the view
            RefreshTab();
        }
Пример #2
0
        /// <summary>
        /// Add a uPicklist and/or PickItem to the database
        ///
        /// </summary>
        /// <param name="lvi"></param>
        private void AddPicklist(UltraListViewItem lvi)
        {
            // Recover the data fields
            string listName = lvi.Text;
            string itemName = lvi.SubItems[0].Text;

            // Does the Picklist exist?
            PickList pickList = _listPickLists.FindPickList(listName);

            if (pickList == null)
            {
                pickList      = new PickList();
                pickList.Name = listName;
                pickList.Add();
                _listPickLists.Add(pickList);
            }

            // Does the pickitem already exist within the Picklist?
            PickItem pickItem = pickList.FindPickItem(itemName);

            if (pickItem == null)
            {
                pickItem          = new PickItem();
                pickItem.Name     = itemName;
                pickItem.ParentID = pickList.PicklistID;
                pickItem.Add();
            }
        }
Пример #3
0
        private void AddNewItem()
        {
            if (_activeItem == null)
            {
                return;
            }

            // Get the picklist so we add to it's items
            PickList picklist = _activeItem.Tag as PickList;

            // Add a NULL item to the end of the list which we then edit to create the new item
            PickItem nullPickItem = new PickItem();

            nullPickItem.Name     = "New PickItem";
            nullPickItem.ParentID = picklist.PicklistID;
            //added for fixing Bug No 859 Sojan E John, KTSInfotech

            FormAddPickItem form = new FormAddPickItem(nullPickItem, _activeItem);

            if (form.ShowDialog() == DialogResult.OK)
            {
                RefreshTab();
            }

            //UltraListViewItem lvi = new UltraListViewItem(nullPickItem, null);
            //lvi.Tag = nullPickItem;
            //ulvPickItems.Items.Add(lvi);

            //// Begin to edit the item
            //EditItem(lvi);
        }
        public void ConfirmPick(string username, int pickListNumber, string sku, int quantityPicked, char pickStatusCode)
        {
            PickList pickList = (from list in DB.GetTable <PickList>()
                                 where list.PickListNumber == pickListNumber
                                 select list).FirstOrDefault();

            if (pickList == null)
            {
                throw new NullReferenceException(string.Format("Pick list {0} could not be found.", pickListNumber));
            }
            PickItem result = (from item in DB.GetTable <PickItem>()
                               where item.PickListId == pickList.PickListId &&
                               item.Sku == sku
                               select item).FirstOrDefault();

            if (result == null)
            {
                throw new Exception(string.Format("Item with skew {0} on list {1} does not exist.",
                                                  sku,
                                                  pickListNumber));
            }
            string usernameLower = username.ToLower();
            User   user          = GetUser(username, true);

            result.QuantityPicked   = quantityPicked;
            result.PickedByUserId   = user.UserId;
            result.PickedByUserName = user.Username;
            result.PickStatusCode   = pickStatusCode;
            DB.SubmitChanges();
            if (PickListCompleted(pickList.PickListId))
            {
                pickList.Picked = true;
                DB.SubmitChanges();
            }
        }
Пример #5
0
        private void Receive(string data)
        {
            try
            {
                string[] vars   = data.Split('|');
                int      opcode = int.Parse(vars[0]);

                ClientPacket receivePacket = null;

                switch (opcode)
                {
                case 1: receivePacket = new AuthenticateUserTicket(); break;

                case 2: receivePacket = new UserJoinRoom(); break;

                case 3: receivePacket = new UserClickTile(); break;

                case 4: receivePacket = new UserPendingPlayers(); break;

                case 5: receivePacket = new InteractItem(); break;

                case 6: receivePacket = new RequestNavigatorRoom(); break;

                case 7: receivePacket = new ComposeInventoryRequest(); break;

                case 8: receivePacket = new InventoryPoseItem(); break;

                case 9: receivePacket = new InventoryPoseItemOnTile(); break;

                case 10: receivePacket = new PickItem(); break;
                }

                if (receivePacket != null)
                {
                    receivePacket.Client = this;
                    receivePacket.data   = vars;
                    new Thread(receivePacket.ExecuteAllThePacket).Start();
                }
                else if (ConfigManager.GetBool("connection.missing.packet"))
                {
                    Logger.Warn($"Received unknown packet. [{data}]");
                }
            }
            catch (Exception e)
            {
                Logger.Error("Error received data from GC => " + e.ToString());
            }
        }
Пример #6
0
 public FormAddPickItem(PickItem pickitem, UltraExplorerBarItem activeItem) : this()
 {
     m_activeItem = activeItem;
     _pickItem    = pickitem;
     if (pickitem.PickItemID == 0)
     {
         this.Text = "New PickItem";
         this.footerPictureBox.Image = Properties.Resources.pickitem_add_corner;
     }
     else
     {
         this.Text = "Pick Item Properties";
         this.footerPictureBox.Image = Properties.Resources.pickitem_add_corner;
     }
     //
     this.tbPickItemName.Text = _pickItem.Name;
 }
Пример #7
0
        /// <summary>
        /// Begin editing of a listview item
        /// </summary>
        /// <param name="lvi"></param>
        private void EditItem(UltraListViewItem lvi)
        {
            // Allow editing
            //this.ulvPickItems.ItemSettings.AllowEdit = Infragistics.Win.DefaultableBoolean.False;
            //lvi.BeginEdit();

            PickItem pickItem = lvi.Tag as PickItem;

            if (pickItem != null)
            {
                FormAddPickItem form = new FormAddPickItem(pickItem, _activeItem);
                if (form.ShowDialog() == DialogResult.OK)
                {
                    RefreshTab();
                }
            }
        }
Пример #8
0
        /// <summary>
        /// Called as we exit from edit mode - we need to ensure that what we have entered is valid
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ulvPickItems_ItemExitingEditMode(object sender, ItemExitingEditModeEventArgs e)
        {
            UltraListViewItem lvi            = e.Item;
            PickItem          editedPickItem = lvi.Tag as PickItem;
            //string name = (string)e.Editor.Value;
            string name = e.Editor.Value.ToString();

            // If the name is blank then it will be invalid
            if (name == "")
            {
                MessageBox.Show("Please specify a unique name for this pickitem", "Enter Name", MessageBoxButtons.OK, MessageBoxIcon.Information);
                e.Cancel = true;
                return;
            }

            // Get the picklist so we check it's items
            PickList picklist = _activeItem.Tag as PickList;

            // Does the specified value duplicate an existing pickitem?
            foreach (PickItem item in picklist)
            {
                if ((item.Name == name) && (item.PickItemID != editedPickItem.PickItemID))
                {
                    MessageBox.Show(
                        "The specified name matches that of an existing item in this picklist, please specify a unique name for this pickitem",
                        "Duplicate Name",
                        MessageBoxButtons.OK, MessageBoxIcon.Stop);
                    e.Cancel = true;
                    return;
                }
            }

            // If it's a new pickitem then we need to add it to the parent list also
            if (editedPickItem.PickItemID == 0)
            {
                picklist.Add(editedPickItem);
            }

            // Update the PickItem in the database
            editedPickItem.Name = name;
            editedPickItem.Update();

            // Prevent editing again for now
            this.ulvPickItems.ItemSettings.AllowEdit = Infragistics.Win.DefaultableBoolean.False;
        }
Пример #9
0
    public void Init(PlayerModel model)
    {
        playerModel = model;
        for (int i = 1; i <= 45; i++)
        {
            items.Add(i, null);
        }


        items[1] = new BowItem()
        {
            Count = 1
        };
        items[2] = new BackswordItem()
        {
            Count = 1
        };
        items[3] = new GrenadeItem()
        {
            Count = 999
        };
        items[4] = new PickItem()
        {
            Count = 1
        };
        items[5] = new TorchItem()
        {
            Count = 100
        };
        items[6] = new BlowBlockItem(0, 2)
        {
            Count = 10
        };

        items[7] = new AxeItem()
        {
            Count = 1
        };

        items[8] = new BlowBlockItem(0, (short)TileTypeEnum.Brick)
        {
            Count = 100
        };
        items[9] = new BlowBlockItem(0, (short)TileTypeEnum.Stairs)
        {
            Count = 1000
        };
        items[10] = new BlowBlockItem(0, (short)TileTypeEnum.Iron)
        {
            Count = 100
        };
        items[11] = new BlowBlockItem(0, (short)TileTypeEnum.Meat)
        {
            Count = 100
        };
        items[12] = new BlowBlockItem(0, (short)TileTypeEnum.Med)
        {
            Count = 100
        };
        items[13] = new BlowBlockItem(0, (short)TileTypeEnum.Bone)
        {
            Count = 100
        };

        RootContext.Instance.Player.UpdateBag(this);
    }
Пример #10
0
 public void AddToInventory(IItem item)
 {
     PickItem?.Invoke(item);
     Inventory.AddItem(item);
 }
Пример #11
0
    public void PickSlugItem(string hash, SerializablePropertys data, string slugCurrent, float x, float y, float w, ref float yGui, ref bool isWaitUI, PickItem onPick)
    {
        int idProperty = data.IndexOf(slugCurrent);
        var comboBox   = PropertysGUI.Instance.ComboBoxSlug(data);

        if (slugCurrent == null || slugCurrent == "")
        {
            comboBox.Empty = "NULL";
        }
        else
        {
            comboBox.Empty = slugCurrent + " (Not found)";
        }
        comboBox.SelectedItemIndex = idProperty;
        comboBox.Rect.x            = x;
        comboBox.Rect.y            = y;
        comboBox.Rect.width        = w;
        comboBox.Rect.height       = 32f;
        float limitHeight = 32f * 20;

        comboBox.Show(limitHeight, hash, (int idNext) => {
            onPick(data.AllKey[idNext]);
        });
        if (comboBox.IsDropDownWithHash(hash))
        {
            yGui    += limitHeight;
            isWaitUI = true;
            return;
        }
    }
Пример #12
0
    public void SetWepoanById(int id)
    {
        IItem item = null;

        switch (id)
        {
        case  0:
            break;

        case 1:
            item = new BackswordItem()
            {
                Count = 9999
            };
            break;

        //земля
        case 102:
            item = new BlowBlockItem(0, 2)
            {
                Count = 9999
            };
            break;

        //трава
        case 105:
            item = new BlowBlockItem(0, 5)
            {
                Count = 9999
            };
            break;

        //угаль
        case 101:
            item = new BlowBlockItem(0, 1)
            {
                Count = 9999
            };
            break;

        case 3:
            item = new BowItem()
            {
                Count = 9999
            };
            break;

        case 4:
            item = new GrenadeItem()
            {
                Count = 9999
            };
            break;

        case 5:
            item = new PickItem()
            {
                Count = 9999
            };
            break;

        case 6:
            item = new TorchItem()
            {
                Count = 9999
            };
            break;
        }


        if (item != null)
        {
            item.Use(this);
        }
        else
        {
            CurrentWeapon = null;
            ClearSlot(weaponSlo1);
        }
    }