Ejemplo n.º 1
0
        private async Task LoadTemplate(string templateId)
        {
            if (string.IsNullOrWhiteSpace(templateId))
            {
                return;
            }

            Clear();
            _model = await _lootTemplateService.Get(templateId);

            if (_model == null)
            {
                MessageBox.Show($@"Object with ObjectId: {templateId} not found", @"Object not found");
                return;
            }

            BindingService.BindData(_model.MobXLootTemplate, this);
            _MobXLootTemplate_ID.Text = _model.MobXLootTemplate.ObjectId;

            var mob = _mobs.FirstOrDefault(x => _model.MobXLootTemplate.MobName == x.Name);

            if (mob != null)
            {
                await _modelImageService.LoadMob(mob.Model, pictureBox2.Width, pictureBox2.Height)
                .ContinueWith(x => _modelImageService.AttachImage(pictureBox2, x));
            }

            var bindingList = new BindingList <LootTemplate>(_model.LootTemplates.OrderBy(x => x.ItemTemplateID).ToList());
            var source      = new BindingSource(bindingList, null);

            dataGridView1.DataSource = source;
            SetGridColumns();
        }
Ejemplo n.º 2
0
        private void dataGridView1_SelectionChanged(object sender, EventArgs e)
        {
            BindingService.ClearData(this);
            pictureBox1.Image = null;
            _TemplateID.Text  = _templateId;

            var selected = GetSelected();

            if (selected == null)
            {
                _selected = null;
                return;
            }

            groupBox1.Text     = selected.Value;
            _Slot.SelectedItem = _Slot.Items.Cast <ComboboxService.SelectItemModel>().First(x => x.Id == selected.SlotId);

            if (selected.Item == null)
            {
                _selected = null;
                return;
            }

            _selected = selected.Item;
            BindingService.BindData(selected.Item, this);
            _imageService.LoadItem(selected.Item.Model, pictureBox1.Width, pictureBox1.Height)
            .ContinueWith(x => _imageService.AttachImage(pictureBox1, x));
        }
Ejemplo n.º 3
0
        private void dataGridView1_SelectionChanged(object sender, EventArgs e)
        {
            var selected = GetSelected();

            if (selected == null)
            {
                return;
            }

            if (_type == ModelType.Item)
            {
                _imageService.LoadItem(selected.ModelId, pictureBox1.Width, pictureBox1.Height)
                .ContinueWith(x => _imageService.AttachImage(pictureBox1, x));
            }
            else
            {
                _imageService.LoadMob(selected.ModelId, pictureBox1.Width, pictureBox1.Height)
                .ContinueWith(x => _imageService.AttachImage(pictureBox1, x));
            }
        }
Ejemplo n.º 4
0
        private void dataGridView1_SelectionChanged(object sender, EventArgs e)
        {
            _selected = GetSelected();


            if (_selected?.Item?.Model != null)
            {
                lblItemName.Text = _selected.Item.Id_nb;
                _modelImageService.LoadItem(_selected.Item.Model, pictureBox1.Width, pictureBox1.Height)
                .ContinueWith(x => _modelImageService.AttachImage(pictureBox1, x));
            }
        }
Ejemplo n.º 5
0
        private void dataGridView1_SelectionChanged(object sender, EventArgs e)
        {
            var selected = GetSelected();


            if (selected == null)
            {
                return;
            }

            _modelImageService.LoadItem(selected.Model, pictureBox1.Width, pictureBox1.Height)
            .ContinueWith(x => _modelImageService.AttachImage(pictureBox1, x));
        }
Ejemplo n.º 6
0
        private void Dgd_MobSearch_SelectionChanged(object sender, EventArgs e)
        {
            var selected = GetSelected();

            if (selected == null)
            {
                return;
            }

            lblMob_ID.Text = selected.ObjectId;
            _modelImageService.LoadMob(selected.Model, picNPC.Width, picNPC.Height)
            .ContinueWith(x => _modelImageService.AttachImage(picNPC, x));
        }
Ejemplo n.º 7
0
        private void LoadMob(string mobId)
        {
            if (string.IsNullOrWhiteSpace(mobId))
            {
                return;
            }

            ClearMob();
            _mob = _mobService.GetMob(mobId);

            if (_mob == null)
            {
                MessageBox.Show($@"Object with ObjectId: {mobId} not found", @"Object not found");
                return;
            }

            _modelImageService.LoadMob(_mob.Model, pictureBox1.Width, pictureBox1.Height)
            .ContinueWith(x => _modelImageService.AttachImage(pictureBox1, x));

            BindingService.BindData(_mob, this);
            BindFlags();
            BindWeaponSlots();
        }
Ejemplo n.º 8
0
        private void dataGridView1_SelectionChanged(object sender, EventArgs e)
        {
            var selected = GetSelected();

            pictureBox1.Image = null;

            if (selected == null)
            {
                return;
            }

            var mob = _mobs.FirstOrDefault(x => x.Name.Equals(selected.MobName, StringComparison.InvariantCultureIgnoreCase));

            if (mob != null)
            {
                _imageService.LoadMob(mob.Model, pictureBox1.Width, pictureBox1.Height)
                .ContinueWith(x => _imageService.AttachImage(pictureBox1, x));
            }
        }
        private void dataGridView1_SelectionChanged(object sender, EventArgs e)
        {
            var selected = GetSelected();

            if (selected == null)
            {
                return;
            }

            if (!string.IsNullOrWhiteSpace(selected.Model))
            {
                var modelId = new String(selected.Model.TakeWhile(Char.IsDigit).ToArray());

                if (int.TryParse(modelId, out int model))
                {
                    _imageService.LoadMob(model, pictureBox1.Width, pictureBox1.Height)
                    .ContinueWith(x => _imageService.AttachImage(pictureBox1, x));
                }
            }
        }
Ejemplo n.º 10
0
        private void LoadItem(string itemId)
        {
            Clear();

            if (string.IsNullOrWhiteSpace(itemId))
            {
                return;
            }

            _item = _itemService.GetItem(itemId);


            if (_item == null)
            {
                MessageBox.Show($@"Object with ObjectId: {itemId} not found", @"Object not found");
                return;
            }

            _modelImageService.LoadItem(_item.Model, pictureBox1.Width, pictureBox1.Height)
            .ContinueWith(x => _modelImageService.AttachImage(pictureBox1, x));

            BindingService.BindData(_item, this);
        }